For years I’ve been known among my colleagues by slaughtering those who don’t update their skills to the latest available. I’ve been arguing with friends on moving on to WCF from web services, ASP.NET MVC from WebForms, WPF from Winforms, etc… All this since I’m mainly a Microsoft developer. Strangely I fell recently into a deep predicament myself where I found myself right in the same corner where I attack my victims.
I also was holding high the principle of reading, reading and more reading as a learning method. I always consider video tutorials as an appetizer, or a starter kit. With all do respect to the pioneers who invest a very hard effort in preparing wonderful video tutorials to new technologies, they’re indispensable, but also -in my opinion- not enough. You must go beyond the phase of observing and watching to the phase of reading and practicing before you say you’ve mastered a tool.
Recently, I had a requirement to make a simple database driven Windows based application, and since I’m currently focusing on the web and a more abstract form of system analysis and design; I didn’t have the time to dive deep into WPF. So I found myself in need of finishing the software within 4 weeks and only in my spare time. So, I rolled up my sleeves and starting digging for videos to get e started quickly in DB driven WPF applications, and I found that the design pattern the would suit me most is the MVVM -Why in God’s name wouldn’t they just name it MVC!!-. Anyway I was overwhelmed with the extra amount of work and code I had to tolerate just to gain -maintainability and best practice compliance-.
Going even further I decided to read a 200 pages book about MVVM. For the life of me I felt like a child lost in the woods! Even though the very close similarities between MVVM and the web’s MVC concept -and generally the concept of n-tier design regardless of how many tiers and how you name them-; it was the bizarre WPF binding syntax that I never had the stomach for, and the intricacies of binding the Data Entity Framework into the bundle!! Sheesh. Well I know some people will crucify my for this, and perhaps argue of how easy it’s, and here is the point of my post.
Was I too lazy to truly invest time and effort in learning a new technology? Am I getting too old for this? I’ve always hated and criticized the drag-drop development concept and suddenly I find my self going way back to Typed datasets in Winforms and finishing the project in no time -with good results I hope-. My argument is what would WPF/MVVM combination give me more than what WinForms/Typed Dataset did already? I know that this is the future and we need to go this way, but just take a look at the introductory article for MVVM on MSDN? We make new technologies to make our life more productive, more efficient and yes; easier! Yes I’m willing to waste time in learning it, but at its current state what would WPF/MVVM save me in terms of time and effort with all the extra code I have to write and maintain.
In my opinion WPF is great technology for designing magnificent UI for Windows -with all the thrilling Metro style apps and all-, but to make a DB driven application, and quickly; I don’t think so. In the web MVC you have to write more code for a reason, you need to get involved with HTML markup for a very good reason, but why can’t the designer help me with the binding in WPF like it did in WinForms/Datasets? I lived hell when I tried to use MS Ajax Control Toolkit with the UpdatePanel, and I was willing to give up anything to avoid that agony in developing interactive web apps, but Winforms DB driven apps were just fine? Why can’t we get the grace of the WPF UI with the power of Data Entity Framework, while we maintain the easiness and simplicity of how we designed DB driven apps in the Winforms era?
So I spent some time designing the database itself on SQL server, trying to grasp the new concept and decided where to go; but I admit; I failed in taking the step and making it WPF/MVVM. So I decided to go the Winforms way. In the way I tried to use a component to bind Winforms to Data Entities instead of Typed datasets, but it didn’t work. Since it has been a long time since I did anything using Winforms it took me some time before it came back to me, but once it did it was like riding a bike; It took very little time to design the UI. In the project I needed an image annotation control. I thought that many controls would have been open source and free by now already, but to my surprise it was the contrary. Hardly I found a good one which was open source and I had to modify it to fit my needs. When I searched the other way in WPF I got many free open source controls for annotations with more than just text annotations! I even though I could host them in a WPF interoperability host inside my form, but things didn’t go well.
A nice thing in dealing with old technologies -apart from the availability of controls- is that any problem you may face have been killed in search and almost for certain you’ll find someone who found a solution or two for it. One small issue that faced me was that when I cleared the input of a text box bound to a numeric value it wouldn’t accept that as a null, because Microsoft wouldn’t add a missing parameter in the Bindings.Add method call for the null value. This implied that I had to modify the Designer.Cs file myself and certainly I wouldn’t do that since all my changes will be gone with the wind when I regenerate the file. So, I simply wrote a recursive function to loop over all my controls and add a null value for the Text property binding
MyTextBox.DataBindings["Text"].NullValue = "";
Upgrading tools and technologies is non questionable manner. The issue is that when we design/embrace a new technology or tool we need to consider and weigh the pros and cons. In my experience -and to my surprise- and perhaps in my particular scenario -small scale, low budget Windows based DB driven application with no need for fancy UI- I found that the old school WinForms/Typed dataset was way better for me than WPF/MVVM. Do you think I made the right decision? Do you think that spending more time in learning, developing in WPF/MVVM was worth it -at least to my small software-?