Cargo Cult Programming: The Importance of Understanding Your Why
The term cargo cult was coined in the 20th century in Melanesia as a result of the cargo planes that were flying in and out of there during the two World Wars. It was the first time any Indigenous Melanesian person had experienced Western machinery, cargo like aircraft and satellite dishes. Small cult-like groups started to form, building replica versions of this machinery out of wood and conducting rituals so they would fly. Unfortunately, prayers are not enough to lift a plane made from palm fronds into the sky — no matter how hard you try.
So what does this have to do with software programming?
The transition of cargo cults into other industries becomes any group of people who copy an idea or method without understanding how it works.
A variety of ‘cargo cult’ subgroups have started to form since the inception of this movement, traversing industries and cultures throughout the world, including software development. The same principles are applied as seen in 20th century Melanesia — put into practice in an area of modern-day life. People are simply copying the basic idea of something and hoping it works, which it rarely does. We commonly see this happen in software development, where people copy code without understanding what it does — hence the term cargo cult programming.
Overview of cargo cult programming
Cargo cult programming is a style of programming that is primarily influenced by the inclusion of code or program structures that serve no real purpose. The programmer then has no idea why a problem crops up in what they’re trying to do. They might have included this copied code because it helped fix a bug last time, but the programmer doesn’t truly understand what the bug is or how it came about. This is very similar to what we saw happen in Melanesia, just because you can build a plane out of palm fronds and it looks right in every regard, doesn’t mean it works like you think it will.
At some point in every programmer’s career, they will exhibit some of these traits as they do not have the knowledge or skills to know better. This is a very normal part of the learning process, and these mistakes (or bugs) help create a better programmer in the long run. If this is something that continues to happen and the programmer is unable to solve a problem for themselves, approaching it from a different angle, they might be stuck in this cargo cult mindset.
The investigative process is an important part of learning from (and about) your mistakes — no matter your professional field. The ability to problem-solve and investigate further is a major component of a programmer’s job. Their investigative prowess is often used as a metric to determine their skillset. If a developer is continually blind copying and pasting code or frameworks and thinking “I hope this works like last time!” throughout their work, there may be a lack of skill or laziness that is under the surface that will rise when their current practices stop working. Understanding your code and how it works is just as important as the code actually working.
The cargo cult mindset in leadership
It’s easy to forgive newcomers for making cargo cult programming decisions early on in their career — no one fully understands their industry when they first start in it. However, if these same practices are carried through to a point of leadership after significant experience, where they are being passed on to others, this becomes a problem. This means that the team is taking on these practices as legitimate, it impacts their own learning as well as the organisation as a whole.
This cargo cult programming mindset is more common than you think, and it often affects the overall team culture and morale in a major way. A workplace culture that does not actively participate in working to understand their own work and why it performs as it does will be restricted in how they grow and innovate as an organisation.
In certain workplace cultures, senior staff are expected to know all the answers and it’s seen as a weakness to ask for help or consult employees further down the food chain about the gaps in their knowledge. This environment spurs this mindset along even further, encouraging continual usage of past practices to try and change future work. Past performance is not an indicator of future success.
Tools to implement to not become a cargo cult programmer
So how can you avoid becoming a cargo cult programmer and help prevent other team members from developing this mindset? We’ve put together a few handy tips and tricks to aid in your programming journey:
- Get a second pair of eyes to review your work once you’re done, whether it’s a code review/pair programming or a team member.
- Test your work before you deploy anything — and note what broke so you can find out why.
- Learn from others by spending time on a platform like GitHub to see what other people are doing and learn why.
- Learn about the rules of the different frameworks you use — and the reasoning behind them.
- Create a workplace culture that encourages knowledge sharing to problem solve. This is, of course, easier said than done and will require cooperation from management and your entry-level team members to work together to change their environment.
Programming is a skill and industry that is continually changing and adapting as technology and our clients’ needs adapt, so adopting a forward-thinking and progressive mindset about your work can help improve your employability and your work. Understanding the challenges of bugs and changes in software is vital to improving your skill and knowledge in not only programming but to the rest of your professional and personal life.
Originally published at https://hutsix.com.au.