December 28, 2010

Clipper was BASIC for my brain

I believe it was Dijkstra who said something like ‘BASIC ruin a programmer for programming work’. I never agreed too much with that comment, probably because many programmers I know started with BASIC and then moved to something else without too much trouble (the rest who didn’t are not programming anymore), but I think Clipper had that bad effect on me, and in a much more insidious and lasting way.

My first data access was keeping everything in memory, feeding it from the program code itself. Some time later I started using tapes, cassettes, then floppy disks, and when I got a hard disk I end up programming a subset of SQL to simplify my increasing access to a random file in Turbo Pascal.

The thing worked well, and it might still be in use in a few shops in Argentina, but a couple of years later I moved to Clipper and its tables, basically because development time was half compared with doing it in Pascal, even when the results were dull and boring and I stopped wanting to show my programs and just wanted to get money from them. I stayed there for many years, damaging my brain cells with that mess until I forgot any real programming and saw everything as rows and columns.

When Delphi arrived I moved to Windows, but my soul was too tired to see anything else but tables, and the programming model had moved from Pascal as a multi purpose language to ‘go to Delphi to talk with Oracle‘, basically drop everything in a form and call a database. The possibility of doing something better was always there, but hidden, with just a few dry examples and everything corralling you to drop a data connector somewhere and link your form to the data. At some point they made a special form to contain all your queries and tables representation, and the best practice was to use stored procedures to be a good citizen, but in practice we were all making a huge mess of monolithic code.

When .NET arrived I thought there was some light at the end of the tunnel, but still it was a very long tunnel full of rows and columns. The N-Tier architecture was reasonable, and in theory you were able to get rid of tables in the UI, but in practice the same garbage was in place. Too many of us were brain damaged, and most of the enterprise projects I have seen since 2003 are in the end moving the rows and tables up and down the line, with a few translations in the middle to drug people to think that the data layer is isolating SQL from the rest. The fire test is to try to replace the database with something else (my phrase is ‘we don’t have SQL, we have a flat file, what are we going  to do?’).

During the last four years I was trying to become a programmer again, instead of a table administrator. I read the blue book, tried to do my repositories, and to keep SQL in bay, but in the end the properties kept me on the same league. It was too easy to say ‘change the Campaign.Status to “Sending”, store in SQL, dance a little and change again, now to “Sent”.’ In the end, it was all still Clipper code, but now with a number of fancy words going around, and more code to get people confused.

Now, there is nothing wrong with Clipper code, except when you see everything as Clipper. When someone says ‘Lets check the object model’ and fire up SQL Management Studio, from my point of view there is something definitively broken, unless we are talking about the relational model which is rarely the case, because even when Microsoft talks about objects in SQL Server, few people see tables as objects, they are just, well, tables. And the big deal is that SQL is just one application, with one idea behind (everything is in rows and columns), which works great for reporting, and less than great for everything else.

The final blow, requiring me to do a brainwash and forget about tables and rows is application distribution. In the end, SQL can live only in one server and that can grow only so much. At some point, no matter what magic configuration you apply, if your application has to deal with Internet volumes you will hit the ceiling, and if you used the N-Tier architecture with the database at the bottom permeating the whole application, you will have to answer my question of ‘we don have SQL anymore, what will we do?’, and rewrite a massive amount of code, or hack your app until everyone hates it and move to more interesting projects.