| Why Data Binding and the like are evil | ||
Take a quick look at Visual Basic related newsgroups and you'll see them peppered with questions about how to bind this piece of data to that control and so forth. The good souls that inhabit this virtual space patiently answer these questions without actually understanding that while they intentions are good, the road to hell is paved with them.
Visual Basic enabled a lot of people to take a quick six-month community college VB course and call themselves programmers. Egged on by the salaries and vagaries of the dot-com era, they go on job interviews where they extol the virtues of the address book application they've written as their final assignment. Of course, it is almost next to impossible to go from a lamen to a real programmer in such a short amount of time, regardless of how brilliant the instructor was. Plus, given the short period of time and the goal of making a real programmer, the instructors are forced to teach something that is easily understood and can somewhat stick. So, here is what students are taught in six month VB course. First, the teacher drops a couple of controls on the form and shows how "easy" programming in VB really is. Second, they go over language constructs like loops, operators, etc… This in itself is kind of difficult for a first time "programmer". Then, a quick intro into database concepts, nothing really relational, just one, maybe two tables in Access. By this time, you are in the second part of the semester. Time to connect the dots. So how do we connect the database to the VB app. Well, let's drop a data control on the form, visually bind it to various text boxes and have the users press the "back", "next", "first", "last" buttons to get around the recordset. Voila, you are a programmer.
Better yet, if the course is taught in VB6 (instead of VB5 or VB4), will connect the dots using the Data Environment - set up the connection, add a command or two and then drag this beautiful creation onto the form. DE will even create all the necessary textboxes for you. Another scenario for the class is to build a web site using Web Classes. Yoo hoo, so now you are not only a programmer, you are a web developer. The title may overshadow the fact that you have no experience and have trouble getting around MS Word, much less troubleshoot IIS problems. Is this the student's fault? No. The problem is with the course. Is this the student's problem? Absolutely.
So why is Data Binding, Data Environment and various associated wizards so evil? Well, they limit you - the programmer. They prevent you from becoming better, making more money and getting promotions. You don't know what happens behind the scenes, so when something goes wrong, you are so lost. Also, Data Binding locks you in - when you have to go beyond its abilities (which happens in all but most trivial apps), it is incredibly difficult to break through its limits.
So what are the practical problems you'll encounter with Data Binding? The first one you are likely to run into very quickly is the inability to exercise data concurency control. Say you have 2 users accessing the same row of data. This is difficult enough to control with ADO - with Data Binding it is nearly impossible. The second, much more difficult problem to resolve, you'll run into later, when the product has already been designed and written. This predicament is the inability of the data binding engine to adjust itself to your database situation. The data binding engine does not know where your database is, whether the pipe the data is travelling through is high or low bandwidth. It does not know how many records to cache or to get just the fields the application needs at this particular point. The third problem is a killer: your fellow developers will look down on you, much as the RDBMS developers (rightly or wrongly) look down upon Access developers. Data Binding, as Jesse "Body" Ventura points out, is a crutch the for weak-minded. The faster you abandon Data Binding, the faster you will become a true programmer.
I advise you to learn ADO (or ADO.NET) - there are a zillion books on the topic, including some on our site. Consider this, no successful programmer I know of uses Data Binding or Data Environment for any apps, other than most trivial.
Data Binding is also part of the reason why VB earned a somewhat deserved reputation for a toy language. The fact is that the IDE allows toy programmers write toy code, thus resulting in toy apps. And even though VB.NET is a brand-spanking new language with very little in common with classic VB, it will probably also carry the same mantle. While VB.NET forces to write at least a little bit of code and its Data Binding techniques are only that in name (i.e. much different from VB6), it still allows one to drag and drop things and to create a quickie app without writing much code at all.
Anyway, bottom line, drop Data Binding, learn ADO.
First off, being a very technically minded person, I will agree with you that data controls are relational to the spawn of Satan.
Though, I am a student in the second year of a BTEC National Diploma for IT Practitioners. I believe the statements you made about the 6 month VB course are biased.
I would say my course has included the equivalent to a 6 month VB course. Yet what you stated about the students knowledge after completion of this, is biased.
You are probably reading this laughing at how petty this email is. Like you care what I think, right?
So, why am I writing to you on such a pointless note? Well the fact is, being a student, I know that the majority of the experienced members in the software development community are, like you, biased and I am now speaking out for those of us who are made to feel bad for this.
I pride myself with remarks made to me in the past about my programming skills. Yes, we did drag data controls onto a form and bind them during the unit, yes we did use the hello world example, but why are you stating this in your article? I think it is irrelevant. Remember, everyone starts somewhere.
There are people who finish VB courses who are still unsure. But please relate to these people in your article as “The majority”. What you wrote has been aimed at individuals such as myself. Like I said about priding myself with comments made towards me. Such comments were , “Sam is the best programmer I have ever seen on a BTEC course”, “The level of Sam’s programming is way above normal for his age” and the general response I get from class members. Yes it’s “Geeky”, but I like it!
What I am saying is that you refer to people in a 6 month VB course as though they know very little. Yet I have experience with ADO, DAO, relational databases, sorting methods, arrays, loops, SSADM, and many degree level programming concepts.
I agree with you, ADO is better. In fact, I’ve just changed all my data controls to ADO code in my project, which is not an address book application. :D
The reason for this article is to explain how your article is biased. Please update it! You can add this to the bottom of your article If you like for others to read.
Regards, Sam.