Geeks With Blogs
Lee Brandt's Blog You're only as smart as your last line of code

I, like many developers, was raised on the idea of getting the database complete before writing the code. The database was the foundation of our application, and building a house without a finished foundation is insane. Also, don’t even THINK about changing the foundation once the house-building has begun. If you MUST change the foundation once development has begun, you’d better have a damn good reason.

When I started to learn about agile and lean software development, I learned about emergent design. Build only what you need for the small piece of the application you are currently building. That includes database, domain objects, services, DAL, everything. It felt very weird to be building membership stuff with no idea of how the rest of the database was going to look. Of course, there is an overall IDEA of what the design MIGHT look like, but until you need it, don’t build it.

There are two main reasons I think emergent design results in better designed software:

You Are Only Thinking About The Thing You Are Building Right Now

On the surface, this might seem like a bad thing. Focusing on the piece that you are currently building helps you to focus on the needs of the functionality you are adding and refrain from building “hooks” into a module for functionality that may never be added, or maybe added in a totally different way. Thinking about future modules (or already implemented modules for that matter) can influence the way you design this small piece of the application as well. Focusing on the fact that other modules need to “use” this module is different than thinking that module x needs to use this module. That thought can lead you to build in coupling between the current module and module x.

You Are Forced To Constantly Change The Application

Again, this may seem like a negative, but changing small pieces constantly makes the application easier to change. If I have to constantly change a module here and a module there every time I add new functionality, I am forcing myself to make each module easier to change. It allows me to see where pieces of my design become brittle and hard to change. This refactoring to ease change leads to loosely coupled, highly cohesive systems, which is what we’re are trying to design.

Use The Force, Luke

In the beginning, it may take some faith and some suspension of disbelief, but once you start seeing designs that are loosely coupled, highly cohesive and easier and easier to change, you’ll start to understand what the original XP Masters were talking about. Just stick to your principles, of writing a spec (test) before you build each granular piece, write the simplest thing that will make that spec pass and then refactor to clean up duplicate or complex code.

Posted on Monday, November 30, 2009 9:18 PM | Back to top

Comments on this post: Emergent Design

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Lee Brandt | Powered by: