“How does one lead free men? By being better than they… By being better and thus commanding their emulation.”
This is also true for clean coding. The best form of evangelism is always behaviour.
Let’s say you are assigned to a project where the moral is below the line, where people are not willing to help each other and where the code base is just a freakin’ mess.
What are you going to do?
Will you start preaching about the usefulness of SOLID principles? Will you present endless talks at team meetings about the importance of helping each other while you keep your eyes down if someone asks for help? Will you build an ivory tower around yourself and will you practice your orating skills from there?
That’s one way to do it and some parts of it might be necessary. But most probably the effects will be suboptimal, to say the least. Instead, I’d advise you a little less conversation and a little more action. Action on your side. Be humble, sit down and continue working. That’s the best you can do. First, do yourself what you want the others to do.
If you practice clean coding and you improve the repository’s shape, soon the others will follow you. If they don’t know how to follow you, someone will show up at your desk, asking for help. And there you go! At that point, you might start directly educating your colleagues. But you shouldn’t forget even then to be humble.
A real leader will influence by example and that’s why you should aim for too. Lead by example, if you really want to change your environment and not just to pose as a wiseguy.