I was charged with the responsibility of rolling out standards within our company.
There are a number of things that have worked and a number of lessons that I have learned. The development community that would be following these standards was about 25 strong.
The first thing to ascertain is the culture and appetite for standards as this will dictate your approach. One of the first things you will need is management buy-in. There may be project managers whose only perspective on standards is to perceive that they contribute to slipped deadlines. Fundamentally you need buy-in from senior technical managers who recognise that code reviews and standards are fundamental tools for tacking "Technical Debt." There are any number of justifications and resources out there describing this, but this is a huge challenge for any organisation with a large legacy code base.
If technical debt is a problem, then your organisation will already have issues with development timescales, testing, burgeoning support backlog, and possible even high staff turnover. These should all be possible to quantify (roughly) should you need to highlight the challenges to senior management.
The next people you need to persuade are the developers themselves. You will have some who are positive and some who are against this. In our company we formed a 'standards' group, and invited a cross-section of developers to sit on this. When the standards documents were introduced, the standards group discussed and agreed them before rolling them out.
We found it important to put across an inclusive and positive message. "WE" will be doing this, not "YOU" must be doing this. Statements like, "The Standards will help us all learn more, and will make our lives easier in the long term" also help. Present the standards as a tool for learning and picking up new skills (which you will, invariably).
Off the back of the standards were formal code reviews. The process for doing this may well have be tailored to your organisation's individual needs, but the most important thing is to put across that a code review isn't a criticism. It’s also important not to tie a personal performance to the number of failed code review they have. A general observation on their general willingness to support the process should suffice.
In our organisation, post-introduction of standards (especially early on) found them to be fairly fluid and subject to change (as we learned more about their relevance and applicability), so we had the issue of communicating changes to the development community. Rather than pinging out a document for developers to peruse at their leisure, we held training days and briefing sessions. These are times that developers are away from their desks, and helps individual feel that they have the opportunity to challenge and question. In these training sessions we also presented new techniques and ideas, again, with the message “This is really useful, it will make OUR lives easier”.
Periodically, we have a standards review session where everyone can feed back on what they feel does and doesn’t work. This all puts across the message that developers aren’t being dictated to, and that long-term we’re just trying to make their lives easier. Certainly a good grasp of standards and best practice (and involvement in them) will look good on anyone’s CV!
Any estimates for timescales should factor in code reviews, and management should recognise that for a short period of time, at least, following the introduction of standards, ‘output’ may fall.
Any resistance you do get will almost certainly be passive, people will refuse to follow the standards or code reviews. This is difficult to deal with (and can sometimes be unpleasant if you are friendly with them). If you have an adequate system for recording code reviews and participation, then you will have some metrics for feeding into performance reviews (though I would only advocate this as a last resort). This is where your management buy-in will be most important.
Finally, there will be those scenarios where, when chips are down, we have to just get our heads down and code like crazy. These often see standards go out the window. The important thing to do here is have standards and reviews so embedded into your process that it just isn’t possible.
I could probably write a whole essay on this, and go into much more detail. I hope the above makes sense as it is quite a brain dump!