Monthly Archives: December 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.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Remember, Fortran is not object oriented

I spend most of my time programming, making bigger and bigger pieces of software. I am in the same thread since 1983, when I learned Fortran during the summer break, and one thing that happens is that every time I review some code from a few years ago, I think ‘how in the world was I thinking this was a good idea?’.

My last pet peeve is about properties. They are part of C# (and Delphi before that), they are shown in every example, and I learned to use them everywhere. You create your class, fill it with properties, and off you go. If you are fancy, now you show them in a grid and congratulate yourself for not being using tables.

Well, you are on the same  old train. It is not a table, but you are still editing values in a row, calling it an object. Doing that in Fortran surely will be messy, but the end result will be no more unmaintainable than C#, and in a few years the only solution for anyone sane will be to rewrite, or torture a junior developer adding still more properties and keeping them in sync in forty disconnected places.

The problem is, now you need to know what is the meaning of the values in that property. Say you have one of those ‘InProcess’ rats in there. True means something is happening and the object should be left alone, false and you are free to do something else. But a few months later you find there are two different kinds of ‘InProcess’ status, and you can do Foo in one, an Bar on the other. Then you change the boolean with an integer, refactor the 80 lines that were using InProcess directly, fix the unit tests, if you have them, and declare the bug closed.

Wrong, the bug is still there, and now you have a few new guys doing different things based on that status, and changing it, and the junior dev will add a third value (hey, it is just an int, and the pattern to copy is there!), and two years later nobody know how that works, and a senior dev has to trace what the hell is going on, and make a document with a web of disconnected numbers, connected with lines. Great, time to rewrite! We will do it after we add this new value to the property ‘IsDeleted’, because now we want to delete things but keep them visible for the accountants :)

I was reading my own code from the last ten years and just hate it and want to burn it all, except that it is still producing money, and my goal for the next few months is to keep the number of properties in my classes to the minimum. Think three times before putting that innocent setter in there. Do I really need to change a value? An isolated value in a class, disregarding the context? If the context is not important, why is the property in the class then? OK, if the context add value, why the need to change an isolated property, forcing the next guy ‘to know’ what he is doing?

Can you express the idea better with a method? Are you sure it is more work to do that? Is it more work in the five minutes you need to write the method, disregarding the hours wasted later trying to know why the whole program is going bananas in a situation that happens only once every thousand calls? Funny thing now is that everything seems to get called a million times a day, but still finding a bug in a thousand is difficult, and you waste some hours, and your day is more miserable, and life would be better just rewriting all the code.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Kanban and Pomodoro

One of the things I do with Evernote is to keep a log of my activities at work.The idea is to make my life easier when I am asked what I was doing in the last few days.

It goes fine, except that very frequently it contains only one line indicating that I started doing something, or that I stay working on the same as the day before. What happens is that after I start a non trivial task I get a better understanding, and it end up in many small things, that I forget to note (because I am doing them, instead of writing!).

Since I put my 20 cents kanban in place, each time a new sub task appear it goes as a stickie to my ‘Ready’ page, which takes only a second (being the same to scribble in a todo list or in a stickie).

When it moves to the ‘In progress’ page, the first thing I do is to start a pomodoro (at the moment I am using Promodoro in the iPhone). Making a pencil line in the stickie each time it ends is trivial, and at the end of the day I just count them, divide by two and write the date besides.

Less than a minute a day and my reporting is done, and visible for everyone.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Visual management and personal Kanban

A few days ago I was viewing some of the talks in Øredev 2010, and two of them dealing with agile methodologies fired my interest a bit.

The first is about visual management, and the interesting point for me was that the guy is applying it for any kind of project, including the birth of his daughter. Usually I regard agile with programming, but his approach is very interesting. The video is full of tips and practical ideas, and left me lingering for something similar in the office (even than we do Scrum, there are no white boards around us).

The second is about a personal kanban, and the ideas are simple and extremely practical. Even if the rest of the team is not applying them, there is nothing stopping me from using a similar process on my own. Some time later I was checking the Internet for small boards and stuff. The total cost should be around ten or twenty cents, which is not too bad for an experiment.

This morning I was thinking about implementation, and given than my philosophy is to not acquire anything until I go slower for not having the right tool, I decided to give it a go on the cheap. Here is the result:

A personal kanban for 20 cents

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

A tip using Launchy

As part of my current toolbox, every day as soon as the PC boots I start TrueCrypt, Evernote, Remember The Milk, Total Commander, Dropbox and Everything.

Going through each was taking a couple of minutes every morning, even using Launchy. After a while I did some research about how to automate the task, with the result of a small batch file called ‘all.bat’ having the following code:

@echo off
if not "%1"=="" "c:\Program Files\Truecrypt\truecrypt.exe" /auto favorites /password %1 /quit
if "%1"=="" "c:\Program Files\Truecrypt\truecrypt.exe" /auto favorites /quit
echo TrueCrypt ready
start /d "c:\Program Files\Evernote\Evernote3.5\" Evernote.exe
echo Evernote ready
start /d "c:\Program Files\Total Commander\" totalcmd.exe
echo Total Commander ready
start /d "c:\Program Files\Everything\" Everything.exe
echo Search Everything ready
start C:\Users\shanahane\AppData\Local\Google\Chrome\Application\chrome.exe --app=""
echo Remember the milk ready
if not "%1"=="" start C:\Users\shanahane\AppData\Roaming\Dropbox\bin\Dropbox.exe /home

When I am ready, I just call Launchy with an Alt-Space and write all, press Tab and then write the password for my TrueCrypt disk. A few seconds later I am ready to go.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather