Here's a theory: if you want to hire and keep developers, assume that they will soon go on to better things and do everything in your power to help them get there.
There are many ways this might manifest.
Do they want to go into (product) management? Be up front about the potential for them to do so with you. Put them in situations where they can exercise the required skills to make that transition.
Do they want to spend more time with their family? Make provisions for them to work from home. That might mean changing your personal work style to accommodate them.
Do they want to hang out their shingle as a freelancer/consultant? Do everything you can to help them get off the ground. If you're a consultancy, earmark some leads that are too small for you to hand over to them when they leave.
Do they want to build their own product? Many developers (secretly) fantasize about running a little SaaS business for passive income. Give them opportunities to develop the sales/marketing skill required to do so.
Do they want to contribute to open source? Give them regular time to do so. Not "the next time you have slack". An honest to goodness weekly session during working hours to develop whatever open source project they like.
Do they want to speak at events and conferences? Help them write submissions to CFPs and set aside some time for them to do talk prep.
Do they want to improve their technical skills? Give them time to work on throwaway training projects. Give them budget for books, courses and conferences that they ask for (i.e. don't impose training on them).
Do they want to improve their writing skills? Work with them to put together content for your company blog. If that's not appropriate, give them time to work on content for their own blog.
Do they have no idea what they want to do? When asked "where do you see yourself in five years?" most people give an entirely sensible answer: "I don't know, I'll see what things are like and make a decision when I get there". That's fine. Ask them what they want to learn next instead.
You help developers by helping to build their expertise and allowing them time to generate creative output with it. One day a week to work on self-directed training is a good start.
Planning an exit strategy
When a developer works for you, they are making an investment of around three years. Three years. We only get about eighty of them. That's three years spending more time with you than the people they care about. Those years are worth much more to them than a ten million pound investment is to an MBA at a venture capital firm.
Much like investors plan an exit strategy, it's your job to help plan an exit strategy for your developers. What are they going to do when they leave? What are the different ways they might end up leaving?
In the worst case scenario: you have to let them go because you're out of cash. Before this happens you're going to do the following:
- Knowing what you know about the developers goals, make a list of three companies the developer would do well at next. Have emails to them asking about hiring your developers ready to go in your drafts folder.
- Write three bullet points that describe concrete value that the developer provided while working for you. Let him or her add those points to their CV.
- Write a generic letter of recommendation for the developer that they can show to any company they apply to. Give that letter to them before they ask for it.
If you do all of the above and have given them time to work on their skills they will be monstrously hire-able when they leave. They will sleepwalk into their next job.
What if they decide to leave because they've found a better job elsewhere? Wish them the best and support them in any way you can. That means sending over a letter of recommendation to their next company, even if they've already secured an offer. It means refraining from bullying, cajoling, counter-offering or begging them to stay.
What if they want to consult for their own clients? Become a case study that they can put on their website to attract more work. Go through your network recommend them to anyone you think might be on the market for their services. Do everything in your power to give them a soft landing.
Make their experience of leaving you so good that they tell other developers about how surprisingly good it was. Be clear that they're welcome back at any time on the same terms, and go out of your way to make sure that won't feel as though they're "begging for their job back".
Discuss the exit strategy with them and invest in it genuinely. Demonstrate that you care about their career and well-being, even after their time with you is but a sub-section on their CV.
Your best employees care about the goals of your business and help you to reach them. This is a fairly boring and uncontroversial statement to make.
It stands to reason that the best employers care about the goals of their employees and help them to reach them.
The best effort that most employers make is weekly affirmations about how great it is to work for them. They constantly repeat how wonderful everything is with the hope that if they wish it hard enough, their employees might start to believe it. The minute you show any signs of dissent , your voice must be stamped out. No other place could possibly be better, so you are a logical inconsistency.
Many employees, either consciously or otherwise, buy into the hype. Experienced developers will stay at a partially insane company, if only to avoid the potential for thundering clowntown drool-spraying lunacy elsewhere.
For experienced developers, there's nothing more mind-numbingly boring than yet another web form with some AJAX goop on it. Your web application is probably a bunch of web forms with AJAX goop on them. There's little that you can do to excite them (though they'll be happy to play along with you if they must).
Scale back on the coffee machines, nerf battles and foosball tables. Show even the tiniest amount of genuine interest in their long-term careers and you stand high above the vast majority of companies looking for developers. If they consistently end their week as a better version of themselves, a decision to leave will be extremely difficult to make.
1: Want to witness an intelligent CEO transform into a petty, blustering child? Leave their company of your own free will and watch what happens.