You cannot control people, you can merely encourage an option to be in their best interests.
With respect to code, we all want standard, consistent code - but the question is how? Especially if you have a group of individuals who all are used to doing things their own way. There are some ways to encourage standardization:
- Code Reviews (XP uses the ultimate code-review: peer programming). This will encourage people to share ideas and "melt" their concepts together, ideally picking the best of everyone's world.
- Refactoring and Reusable components. If you eliminate the possibility of bad variation, your encourage good standardization. For example, there are many different ways to format a DateTime. But if you have a strongly-typed DateTime control that handles the formatting and validation for you, and developers simply drag and drop that control onto their page, you've got a win-win: (1) it's faster for the dev to create, and (2) all your DateTimes are now standardized.
- Static Code Analysis (like FxCop, built into VS 2005). This is like compiler warnings on steroids. This gives you proactive warnings about your code, like naming standards and style. It's great if you're starting to code from scratch, but could give excessive noise if used on legacy code. It's also hard to enforce - i.e. FxCop gives you back a 1000 warnings, and most developers then just dismiss it as noise.
- Code Generated templates based on model-driven languages - Using a tool like CodeSmith, you can take an XML file and generate a bunch of ascii text - like C# and HTML code. This shrinks the gap between what it takes to describe a feature (a minimalist XML file), and what it takes to implement the feature (the generated C# and HTML).
A lot of this ties into software factories. I'm currently reading Practical Software Factories in .NET by Gunther Lenz and Christoph Wienands - it provides a lot more insight about this.
Post a Comment