Thursday, 22 May 2008

Antipatterns; Building unextensible software

For some time I have been writing some posts about design patterns. To show why they are important and how they help let me also introduce you The Anti-Patterns.

Recently a friend asked help for some professional advice for their company's running software, so i went as a consultant and examine their software and needs. First let me give you some brief imformation (without mentioning the companys name). They are a small-mid size company in health business, who have very basic network and computer setup. The have a professional financial software which works fine, but what they fail is their custom built software. They started coding the project 2-3 years ago. Since they didn't have an IT team (and they still don't have a real one) they asked a software company to guide them and hired some professionals(?). The developer on their side has changed up to 4 times and the software company who guides them had only one developer who know about their project and he already left the company. So now nobody can help about the new software needs and bugs.

When I first entered the server room instead of checking the interfaces, I wanted to see the database (as a Domain Driven developer). They had 160 tables coupled with 140 stored procedures and about 20 views. Heavy use of stored procedures caused the business buried into database but the software also still has some of the business logic which make the business flow divided into two (Layered architecture failed). When they showed me the functionality of the interfaces I was so suprised that I have seen so many tables for so simple functionality (over complicated db structure). Meanwhile when I checked the tables i saw that they are not normalised and some have more than 30-40 columns (db normalisation failed). I wanted to check the classes but the first thing i figure out was some classes has over 15000 lines of code (keep your classes short). Then they mentioned about their reporting needs. They have some reports which can not be sorted, new parameters or columns can not be added. I was so suprised when the marketing department said we cant get the patients ordered by city so we just count them one by one over the report. That report which their IT stuff cannot get ordered, is a report querying just one table and the city information does not rely on any other table, it is just an embedded column in that table. Come on even a fresh graduates would order by that query in few minutes.
Their software has all major anti-design patterns including spaghetti, dead end, golden hammer, lava flow, the blob... and just like most IT projects the software does not have any documentation, and the back office part is not completed (ex. they can't add new doctors to db).
One of the thing they complain about was funny. The software closes all instances of internet explorer when the user session is expired and they are not happy with that. Without checking the code, I told them to use firefox to browse the internet but continue using ie for their software. Well simple solution but works ok for them. Rest of the problems, i suggested not modifying the current software since nobody knows the structure so it will take too much time and would be so fragile. Instead we can make a new one which has only the features the current one lacks. So they would need to run both same time.
Well the other option I suggested was if they have enough budget and time to built a new one from strach with new and modern technologies like Java and Flex.