Maintainable Code is a presentation I delivered to the Wellington .NET Users Group Code Camp 2009, held on 13-14 June 2009.

This presentation has the overall theme of Maintainability - how can we make our code easier to maintain - with a particular focus on changes we can make to our code.

Name things well

Names are the first thing a developer encounters, and the last thing to be lost. Giving your interfaces, classes, methods, members and variables good (informative, trustworthy) names is important.

Provide Commentary

Write comments that provide additional information, not ones that repeat what the code already says.

Manage your Dependencies

Each dependency you take on adds weight to your system - consider carefully the balance between the value gained and the cost of management.

Write Less Code

Code that doesn’t exist can’t have any bugs. Don’t write any more code than you need to - reuse of existing code that someone else has already debugged can save you time. Keep the tension in mind with managing your dependencies though.

Test your Assumptions

Every piece of code makes assumptions - about the environment in which it will be called, about the presence/state of parameters, and so on. Make these assumptions concrete by including tests where possible.


Audience Date
Wellington .NET User Group June 2009