The first step in creating an environment for happy developers is to build a good relationship with them. You must start things off on the right foot. This all starts before your first interaction with them. This first interaction could be an interview if you manage developers. It could be the company's all hands meeting where they are introduced. Your first impression of a developer can be incredibly skewed because of developer stereotypes.
Society has cemented stereotypes and cliches into our brains. They influence our first impression of people and cause us to be judgmental. Stereotypes in the work place put barriers between work groups and developers become victims of this pretty frequently due to the nature of what society makes them out to be.
There are plenty of appearance and hobby stereotypes for developers. They don't care about their appearance, spend 20+ hours a week playing MMOs, and know the Star Wars lore inside and out. You can find out if there is any truth pretty quickly. Asking a developer "What do you geek out on?" may not yield positive results if the person doesn't consider themselves a nerd or geek about something. Leading with an Office Space quote isn't going to lead to positive conversations. You'd be surprised how different the typical developer is outside of work. Personally, I've worked with former US Marines, a marathon runner, multiple MMA/Kickboxers, several carpenters, a former pastor, and the list goes on.
Lets focus on actual work related stereotypes. The above may get an occasional eye roll or laugh, but they shouldn't affect developer morale across your company… unless you're just a total jerk about it. Removing work related stereotypes will improve your relationship with the developers you work with on projects, you manage, or the ones you simply work with.
#1 Developers will get your project done if you simply throw pizza and redbull at them.
There isn't a developer in the world that will be willing to do this for no reason. Developers don't want to be treated like slave labor. The quality of work will reflect how you treat them.
#2 Developers are difficult to work with
This is hard to defend because developer's job is hard to do. Developers ask a lot of questions, challenge requirements, and resistant to change. There is a lot of truth in this xkcd comic.
A simple task can turn into a mountain with one requirement. Imagine you are told that you told to build a two page web app. That should be simple right? It's a search page and a results page. Super simple! Oh we need the search page to search the entire internet…. Yeah, it'll be just like Google. Both of you need to slam on the brakes. The developer is most likely going to panic and say it'll take 10 years to do. You, the person wanting this product built, need to ask the right questions before throwing your hands up and requesting a different developer. Developers have a good idea of the level of effort required for work. You have to find a middle ground. Trust them and work towards success together.
#3 Young developers are better than older developers
This has become an increasingly more common thought over the past few years. New and hungry programmers will typically overshadow their well-seasoned counterparts. They've been engulfed in technology longer and pick things up quickly. There is a lot more to programming than simply knowing the latest language or framework. Older developers have already learned how to work efficiently, problem solve without panicking, and can offer a unique perspective.
#4 Foreign developers aren't reliable
This stems from another myth that offshore work doesn't produce as high quality work as local. Developers from a foreign ethnicity or speak English as a second language have an incredibly hard barrier to break down to get hired. There is a bunch of other garbage that we can throw around this that is hard to go into.
#5 Female Developers aren't as good as Male Developers
Let's pause for a second. Do you believe the above? If so, go ahead and punch yourself in the face….. Go ahead and do it again for good measure…
Women have struggled to get into the tech space. There are a lot of movements to help get women into the field Girl Develop It provides affordable programs to get women into development.
I've had the privilege of working with about 10 women developers over the years. Their skills stood out a great deal and they were all very motivated to excel in their respected programming languages. Because of this, I really have a hard time wrapping my head around the fact that this stereotype is still a thing.
Bonus: Inner Developer Stereotypes
Here is a bonus for you if you manage a group of developers. Developers love to banter with each other about what languages they use for some reason. This banter can quickly turn south and turn toxic. Keep an eye on your team and don't tolerate disrespect due to tech stack.