Archive

Archive for May, 2008

Development patterns session at Austin Code Camp

May 13th, 2008 Scott Lilly Comments off

I’m going to be leading a session on development patterns this Saturday (the 17th) at the Austin Code Camp.

Over the years, I’ve ended up working on a lot of existing codebases, some of it good, some of it bad. I’ve spent a good deal of time thinking about what separates good code from bad code, and what can I do to ensure that the code I write is good. Agile development has been great because of the practices of writing unit tests, high code coverage, and continuous integration. With that, I can safely modify existing code and quickly know if my change broke some other part of the application. Design patterns have also helped by letting me know how to write a standard solution to common scenarios.

However, even with those tools in the toolbox, it’s still possible to write bad code. What I’ve been working on lately is trying to bridge the gap between writing the unit test and ending up with great code. “Development Patterns” is what I’ve come up with (although I’m sure I’m not the first person to think this up). If I’m creating a new class, and have a property that doesn’t need any additional code in the getter and setter, should I just make it a public variable, or do I go ahead and write the simple getter and setter? When I need to instantiate an object, do I just write “Employee user = new Employee();”, or should I get an IPerson object from a PersonFactory? What are the costs and benefits or writing my code either way? What makes the code more flexible? What makes the code easier to maintain? Which is clearer to a new developer coming in to made changes to the system six months from now?

This is what my session will be about at the Austin Code Camp. I don’t expect there to be too many answers, but I am hoping for plenty of good questions. I put together a quick website to go into the details of this some more. It’s developmentpatterns.com. It currently has a simple wiki with a few patterns listed and only one mostly filled out (oh, the joys of moving and being without the Internet for weeks). There is also a discussion board there to talk about why the pattern is useful or not, and how to improve it. I’ll be working on my personal projects using the current ‘best patterns’, and expect that will lead to quite a bit of change to them over time.

If you have any thoughts on the subject, please check out the website and add a comment to the forum. If you see me at the code camp, please let me know what patterns you follow that makes your code great.