Left unchecked, sloppy coding habits on the part of developers can become a thorn in a technology leader’s side. It’s an issue that doesn’t just affect a single developer’s work — it can cause multiple problems, from bugs to frustration to production delays that affect team members and customers.
There can be many reasons why developers create less than ideal code, but with the right proactive strategies, technology leaders can guide their team members into better habits that yield positive results in terms of productivity, speed, accuracy and team morale. Here, 16 members of the Forbes Technology Council share some specific tips to help both tech leaders and developers ensure their teams produce better quality, cleaner code.
1. Use a proven CI/CD tool
Keep it simple. Use a good continuous integration and continuous delivery tool that scans code for best practices and performs security vulnerability scanning. Make sure all high-priority issues are resolved before pushing them to production. – Madhu Madhusudhanan, Oloid
2. Conduct Weekly Code Reviews
Including weekly code reviews as part of team exercises teaches developers consistency, pride in the quality of their work, and empathy for other developers who must use their results—as well as their future selves who must review the code. – Adrian Dunkley, StarApple AI
The Forbes Technology Council is an invitation-only community for world-class CIOs, CTOs and technology executives. Am I eligible?
3. Follow a multi-step process
There are many steps developers can take to create better, cleaner code. First, they should comment their code freely to explain what they are doing and why. Second, they should use consistent coding conventions and style guides. Third, they should refactor their code regularly to keep it clean and maintainable. Finally, they should test their code to make sure it works as expected. – Sean Toussi, Glo3D Inc.
4. Manage morale, not metrics
Bad code is the worst. You can mostly avoid this by focusing on managing the morale of your team members rather than metrics and delivery dates. The reason you have bad code is because you’re moving too fast or you’ve hired a team of hackers, not engineers. Give your company the autonomy to adopt quality-focused practices like test-driven development. – Jeremy Duvall, 7Factor Software
5. Adopt ‘Shift Left’ principles.
Incorporate security early in the development cycle by adopting “shift left” principles that include continuously testing code for both vulnerabilities and defects. Use DevSecOps tools that tie into CI/CD processes and developers’ preferred development interfaces (integrated development environment). This will allow them to detect errors earlier and fix them before they become more costly and time-consuming to fix. – Vince Arneja, GrammaTech
6. Experiment with Pairing And Mobbing
I recommend experimenting with two techniques to increase code quality: coupling and mobbing. Coupling is where one developer is at the keyboard and another provides the overall direction — then they switch. It is especially helpful to pair an experienced developer with someone who is less experienced. Mobbing is when one programmer is at the keyboard and two or more people provide input and observe. – Dave Todaro, Ascendle
7. Assign a password owner
Assign a person as the project code owner. If multiple developers are working on the project, ask the code owner to do a code review. If no one is responsible for the code, it’s almost a guarantee that the code will be short-sighted. When you have a code owner, you will likely have much better project code quality. – Arturs Kruze, Magebit
8. Treat code as a piece of art
Write your code as you would create a work of art. It’s functional, it’s beautiful, and it’s got your signature written all over it. Write code that you can proudly show off to the rest of the world. And before anything, test it and make sure it does the job. – Suresh Chintada, Subex
9. Embrace DevOps and structure three-week sprints
Embrace the importance of DevOps and implement a rigorous process of continuous integration, continuous development. In this way, overinvest in documentation to remove ambiguity for developers and QA engineers. The development of the sprint structure is done in three-week, not two-week, rhythms. Use the third week to complete QA reviews, stress testing and debugging. These are essential elements for producing quality code. – Mark Francis, Online Caregiver
10. Common Document Coding Practices
Developers, and by extension administrators, need to document their common coding habits and practices. Treating coding habits as “community knowledge” leads to frustration, misalignment, and long review times. Documenting this kind of knowledge in an accessible place that everyone can see and refer to is the best way to embed it. – Andrew Zhou, Kona
11. Move away from a culture that favors speed over quality
Mistakes will happen, but organizations must move away from a culture that ignores quality in favor of speed. Integrating DevOps and DevSecOps techniques to integrate quality and security throughout the software development lifecycle will deliver higher quality code, early vulnerability detection, and more efficient application and API launch through automation and improved compliance monitoring. – Carlos Morales, Neustar Security Services
12. Leverage low-code platforms for low-level coding
Coding in a hurry can lead to bad code, even by developers with good habits. Replace low-level coding with low-code development. Consider which areas of a project can be downgraded to low code. User interfaces, API creation, and platform integrations are easier and faster to implement through low-code platforms, leaving developers free to focus on getting the small details right while coding what matters most. – Ed Macosky, Boomi
13. Make sure your developers have enough time for careful coding
Organize developers’ work schedules so they have enough time to code. When you have meeting after meeting, the time available to code becomes less and less. When developers have less than two hours between meetings to focus entirely on coding, they tend to lose focus and deliver sloppier code. The solution is to organize their workdays so that they have enough developer time to deliver quality code. – Alex Circei, Waydev
14. Work with mentors on challenges
Take your time and create the best code you can. Finding mentors to work with when you have challenges is also good practice. Additionally, if the opportunity arises with your team, encourage appropriate Agile practices and implementations of open source platforms that inspect code quality and find bugs, such as SonarQube. – Steve Taplin, Sonatafy Technology
15. Consider how others will read your code
Think about what you write and ask yourself how each piece of code might be read by others and how they might use it. Write code that is easy to read and easy to maintain. Keep your code dry (don’t repeat yourself) and avoid spaghetti code by keeping your code as modular as possible. Keep functions and code blocks as small as possible. – John Giordani
16. Read code from developers you admire
Just as one needs to read and write a lot to be a great writer, to create good code, programmers need to read code from peers they greatly admire. When writing their own code, developers must channel the learning they’ve gained from reading other people’s code in terms of code quality, style, comments, coding conventions, and test cases. This will help developers write cleaner and better code. – Vishwas Manral, Skyhigh Security