People writing bad code is just a symptom of ignorance (which is different from being dumb). Here's some tips for dealing with those people.
- Peoples own experience leaves a stronger impression than something you will say.
- Some people are not passionate about the code they produce and will not listen to anything you say
- Paired Programming can help share ideas but switch who's driving or they'll just be checking email on their phone
- Don't drown them with too much, I've found even Continuous Integration needed to be explained a few times to some older devs
- Get them excited again and they will want to learn. It could be something as simple as programming robots for a day
- TRUST YOUR TEAM, coding standards and tools that check them at build time are often never read or annoying.
- Remove Code Ownership, on some projects you will see code silos or ant hills where people say thats my code and you can't change it, this is very bad and you can use paired programming to remove this.