KoffeeKoder


  • Working Application Supersedes Clean Code
    published on 11/2/2008 5:40:24 PM



  • Some time back I was working on a project which had a crazy deadline. The Project Manager told everyone that the application will be available on a certain date without first consulting me. This resulted in long work hours and continuous coding. I still remember that the day before the launch I was sitting in the office at 1:00 AM and making final adjustments.

    One of the requirements of the application was that it will only be available to the users after certain time.  The time was stored in the database table. Basically, I needed to check for the OpenDate field in the database and then compare the current date with the persisted date.

    I did not choose that path but I hard coded the date and time (I knew that the open time was 8:00 AM). Although this was a bad decision and I was leaving broken windows in my code but at that time this seems to be the fastest solution to the problem which will make the application work.

    Did I mention it was 1:00 AM?

    Anyway, the next day the application worked as expected and my boss was very happy! After couple of days I did fix the broken window.

    As software developers our first priority is to get the application working even if it involves desperate measures. But also always remember to fix the broken windows which are left behind due to desperation.      




  • by Ben Scheirman on 11/3/2008 1:10:32 PM
  • But "later" never comes. Your customers demand the next feature just as fast, and you're forced to take more shortcuts.

    Pretty soon you're living in a mess of an application that you cannot add features to.

    By making shortcuts you're really inflating your velocity. You're saying "look Mr. Customer.. I can deliver X in Y time!" Over time that becomes a lie.

    Deliver consistently good software and measure your velocity. It stabilizes quite nicely and provides a good tool for future planning.

  • by Mohammad Azam on 11/3/2008 1:27:25 PM
  • @Ben,

    I do agree that one should never take these shortcuts. But there are some scenarios where this is the only option. Sometimes, you cannot ask your boss to move the deadline forward and you are stuck with the project specially when the boss candidly announced the release of the software without first consulting you, the developer.

    I think the better approach would be to simply leave out the complete feature. But in this case it was required and no negotiations could be made.

    I called this kind of coding "Quick Sand Coding" which means more you code like this the deeper you get into a mess.