Retaining top technical talent is never easy. For example, one in four software engineers expect to job hunt in the next three months, according to a Glassdoor survey. They’re also constantly getting recruited, so joining the army of recruiters trying to bring them in means fighting an uphill battle.  

Here are four best practices for recruiting for technical positions:

Related: 4 Tips for Attracting Google-Quality Software Engineers

1. Commit to a long-range plan. The company may need to staff up quickly, but history and economics say it’s better to invest the time needed to source and hire the right people. Quickly hiring candidates who aren’t a good match for the positions or the firm costs time and money. According to the Bureau of Labor Statistics, the average cost of a bad hire is 30 percent of the person’s salary.

After finding the right people, however, don’t drag out the process for individual candidates. Once the recruiting process has begun for a candidate, try to move him or her through the steps with momentum. When candidates experience lags of time without hearing from a company or the recruiter, they begin to doubt whether the firm is a good fit for them. Check reviews of the company's interview process on jobs sites to make sure that the pace of the recruiting process is not hindering the firm from bringing in top talent.

2. Bring it in-house. If the company does not have recruiters on staff, consider hiring some to work in-house. Those with experience may already have a network of engineers to draw from, and recruiters employed by a company are likely to do a better job selling the firm and finding people who will be a good fit.

Related: Building an All-Star Virtual Team

3. Develop a referral network. Often the best way to recruit tech talent is to receive a referral from other technical people. Encourage the company's IT staff, engineers and other tech minds to help with networking efforts by offering financial incentives for recommending someone who accepts an offer from the firm.

But don’t limit the referral network to the company's staff. Keep in touch with former employees via social media or occasionally meet them for coffee to maintain relationships. It's hard to predict when any of these connections may look for another job and consider returning to the company or when they may know someone else who might be a good fit.

Attend technology industry meetings and events, serve on committees and become involved. In the process, develop relationships with others who work with technology folks -- and don’t be afraid to ask for referrals from this network. Make it reciprocal; be sure to refer potential candidates to others in this network when learning of someone who may be a good fit for what they’re looking for. Taking the time to deliberately build a network of referral sources will pay off in spades when it's time to recruit more engineers at the company.

Related: NSA's Cryptic Tweet Was Actually a Recruiting Tool

4. Understand why the company's offers get rejected. When it's the stage of the process to extend an offer, it’s vital to be able to “close the deal.” Otherwise, the process will have be started all over again unless there are equally desirable backup candidates also awaiting an offer. If more than 25 percent to 40 percent of candidates are turning down the company's offers of employment, it’s time to improve that ratio.

Consider conducting post-process interviews with all candidates, including both those who accepted offers and those who didn't. Approach the candidates in a genuine fashion, simply seeking information. Find out what led to the decisions to refuse the company's offer. Maybe there is something about the company or culture that is turning off candidates. Look for trends in their responses; then make changes to correct the problems and improve the program.

It’s never easy to bring in top tech talent, let alone get people to stay. Glassdoor survey results show that one in four software engineers stay with the same company on average for two to three years, 24 percent say they do so for more than five years, and about 13 percent say they remain for on average for one to two years.   

Related:  6 Ways to Land the Perfect Employee Who Isn't Job Hunting