There Is No Perfect Design

code 0 comments suggest edit

Many developers, especially those fresh out of college (though older developers are just as prone), fall into the trap of believing in an absolute concept of “the perfect design”. I hate to break such youthful idealism, but there’s just no such thing.

Design is always a series of trade-offs in an arduous struggle to implement the best solution given a set of competing constraints. And there are always constraints.

Not too long ago, I had an interesting discussion with a young developer who was unhappy with the design of a project he was working on. This project had a very aggressive schedule, and he complained about the poor design of the system.

“So why do you think it is poorly designed, the system appears to have met the requirements, especially given the short time constraint”, I asked him. He explained how he would have preferred a system that abstracted the data access via some form of Object Relational Mapping, rather than simply pulling data from the table and slapping that data on a page via data binding. He also would have liked to clean up the object model. It was’t in his mind, “good design”.

I pointed out that it also wouldn’t have been good design to spend time choosing and getting up to speed with an ORM tool, only to deliver the software late (which was not an option). Sure, the code would have been well factored, but we had a hard deadline, and missing it would have been a huge burden on the company.

I suggested to him that constraints are necessary for a software project. I told him,

If a project doesn’t have a time constraint, it will never get finished.

That lit a lightbulb for this developer.

That explains why I never finish my personal projects.

Absolutely! With no time constraint, this developer would spend more time after more time attempting to hit that elusive goal of the “perfect design”. But that goal will never be reached because perfect design is asymptotic. You can get infinitely close, but you can never reach it.

In the end, I told the developer that he’ll have the opportunity to refactor the code into a better design in the second phase of the project, as the time constraint is no longer so aggressive. I also suggested he skim Small Things Considered: Why There Is No Perfect Design by Henry Petroski. The book makes its main point in the first chapter, that design is about compromise and managing trade-offs to meet constraints. The rest of the book is a tour of various design decisions in history that illustrate this central theme.

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.

Comments

avatar

14 responses

  1. Avatar for Sharp as a Marble
    Sharp as a Marble May 30th, 2005

    GUILTY!!



    At work, I often have a gun at the back of my head to get something completed. I miss deadlines occasionally due to trying to make something architecturally perfect.



    Looking back on my ASP days, it's hard to accept that what I did was correct. Architecturally, it sucked, but it got the job done and in time. If a function is supposed to take in 2 integers and return the sum, it doesn't matter how it's done so long as the return value is correct. You can refactor it later after the deadline has passed.

  2. Avatar for Ken
    Ken May 31st, 2005

    I can totally agree, it is often very difficult to accept the fact that you have to create a balance between "perfect" design and getting a project done.



    There are many times here at my job that I would love to be able and spend extra days on producing the perfect object model and database design to support that model, but the time just doesn't exist.



    Although, I do think that the requirement of working at a acceptable speed with quality has caused me (over time mind you) to produce better code than I sometimes would if I spent many days working on a single component as opposed to hours. I do think every once in a while people overthink solutions in the pursuit of "perfection". Great Post, thanks for a good blog.

  3. Avatar for Rocky Moroe
    Rocky Moroe June 2nd, 2005

    This is one of the hardest lessons learned as a developer. Even for my own projects, it is hard to strip the "goal" project to a more simplistic model in order to get the core functional and add continue to develop in phases.



    However, in this instance, I am not sure it would have taken much extra tiem to have a database layer and not tie the database to the UI. I personally, always at a minimum, build a simple database layer that consists of a "Data Manager" class that handles all communication with the database and use strong typed datasets as dataobjects for the UI. This little time, but still keeps the UI/Database seperated.



    In VS2003, I would create a component class (as the manager class) and drop all my DataAdapters, Commands, Connection(s) on the component designer, and build that as a dll. That allows me to pull the strong typed datasets in as components in my ui and bind to them easily with the wizards and at the same time leaves my data layer modular.

  4. Avatar for max
    max February 26th, 2007

    hello! You right!

  5. Avatar for Community Blogs
    Community Blogs December 8th, 2007

    Note: If you hate reading and just want the code, it is at the bottom. Eons ago, I was a youngster living

  6. Avatar for you've been HAACKED
    you've been HAACKED December 10th, 2007

    Favor Composition over Inheritance and other Pithy Catch Phrases

  7. Avatar for M
    M December 10th, 2007

    It's not just the perfect design. Many people also fall into the trap in one (or more) of the following:
    - Perfect OS
    - Perfect language
    - Perfect framework
    - Perfect database

  8. Avatar for Matt Blodgett
    Matt Blodgett December 10th, 2007

    "Perfect design is asymptotic." is one of the more profound things I've heard in a while. I won't forget that.

  9. Avatar for Matt Blodgett
    Matt Blodgett December 10th, 2007

    Perfect Design Is Asymptotic

  10. Avatar for Pierre Chauvin
    Pierre Chauvin February 25th, 2008

    "because perfect design is asymptotic." a.k.a DesignAsRequirement antipattern ;-).

  11. Avatar for Umer
    Umer June 2nd, 2008

    Trade-off's is what design is always about.
    There should be tend towards making things according to Engineering principles and its an evolving process to IT professionals.
    Evolve, Inovate and be different in the future OR Code to deliver always and belive that stone age is the best age and live happily there

  12. Avatar for Kamran Shahid
    Kamran Shahid July 13th, 2008

    Nice Post,
    100 % agreed

  13. Avatar for NickZA
    NickZA December 14th, 2008

    Hi
    I wanted to comment on something Ken said, which is similar to what my take on this is:
    'Although, I do think that the requirement of working at a acceptable speed with quality has caused me (over time mind you) to produce better code than I sometimes would if I spent many days working on a single component as opposed to hours. I do think every once in a while people overthink solutions in the pursuit of "perfection".'
    My experience is that some of the best *improvement* of your development you will ever do is when you do have an undefined period of time (eg. your free time) in which to plan/code/design. I think this is particularly true from an architectural point of view, as you need time to see the bigger picture and see how it could best be implemented.
    For everybody, to some degree or another, I think it's necessary to be able to take time with things in order to really understand them. That way, you won't have to rethink a problem when you see it again in a different context -- and when time pressure is indeed very great.

  14. Avatar for Mohammed
    Mohammed December 14th, 2009

    Hello ! i'd like personally to thank you for this blog,because,it supports me somehow.
    im a Senior industrial design student and my grduation project is designing an interior design for a Metro subway compartment especially the seating unit of it.and i was discussing with my teacher who believes in a perfect design.witch bugs me alot..
    how can i convince him that theres no perfect design ?