You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

Good Architecture Design Creates More Code and Takes More Time

Posted by Keith Elder | Posted in Programming, Web Services | Posted on 08-08-2007

I came to a realization this evening when working on a new release of our internal CRM application.  We are in the middle of re-designing our CRM from the ground up with new data structures and tons of new features.  That may sound like a drastic measure but the functionality of it as well as the scope has changed over the years so that’s why we are redesigning it.  As a result we are taking the time to build our middle-tier using Windows Communication Foundation leveraging the Web Services Software Factory for WCF. 

WCF brings a lot to the table for us such as duplex messages, TCP binary messages and so on.  I’m a big fan of multi-tier design and good architecture design.  You know, the typical  UI->Middle Tier->Database approach.  Anyone that has built an application using three tiered design should know the majority of the work is in the middle-tier and about 70% of your effort is focused in this area. 

For our redesign, in the middle-tier we are following good architectural guidance by creating entities, separated business logic, separated data access and so on (WSSF really helps with this).   At times though I wish I could just drag and drop a database table onto a WinForm, create a strong type dataset and bind to a DataGridView control and totally forget the middle tier.  It sure is faster to code everything in the UI and hit the database directly this is no doubt.  In the end there are tons of draw backs though such as deployment, centralizing business rules, etc.  This is the first case in point that good architecture creates more code and ultimately takes more time.

This evening I was playing around with a test WinForm app for a prototype screen and realized since we are returning entities from the services layer we can’t just bind the returned collection of entities to a DataGridView control and get all the sorting / filtering goodness we get with a Dataset.  In the end I had to write more code to be able to achieve this.  Sure it only turned out to be about 500-750 lines of code that will get re-used over and over and over again, but the fact remains that I had to write more code because I followed a good design practice.  This is case in point number two. 

For those that leverage consultants this is the difference in quotes you probably receive from various firms.  Or for those that ask developers how long something will take and he/she tells you two months when you were hoping they would say two weeks.  Sure you can find someone to get it done faster, but did they get it done correctly?  Will the system be easy to maintain?  Scale?   Be easy to extend in the future?  These are the things that developers over time have come to realize when building systems and it is hard to justify sometime to the business or to clients (if you are a consultant).  Sure it may take a developer longer to follow a good three tiered approach, but the business gets a lot of benefit down the road by going with a better architecture.   

Comments (1)

Couldn’t have put it better myself. I’m going to go ahead and print this to pin it to my cubicle to see if some coworkers and my boss get the hint.

Write a comment