If left unchecked, sloppy coding habits on the part of developers can become a thorn in the side of a tech leader. It’s an issue that doesn’t simply affect a single developer’s work—it can cause multiple problems, from bugs to frustration to delays in production, that impact fellow team members and clients.
There can be multiple reasons why developers create less-than-ideal code, but with the right preemptive strategies, tech leaders can guide their team members to better habits that yield positive results in terms of productivity, speed, accuracy and team morale. Here, 16 members of Forbes Technology Council share some specific advice to help both tech leaders and developers ensure their teams are producing 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 the code for best practices and performs security vulnerability scanning. Ensure all high-priority issues are resolved before pushing them to production. – Madhu Madhusudhanan, Oloid
2. Hold 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 have to utilize their outputs—as well as their future selves who have to revisit the code. – Adrian Dunkley, StarApple AI
3. Follow A Multistep Process
There are multiple steps that developers can take to create better, cleaner code. First, they should comment on their code liberally 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 ensure 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 and not metrics and delivery dates. The reason you have bad code is that you’re going too fast or you’ve hired a team of hackers, not engineers. Give your company the autonomy to embrace quality-centric practices such as test-driven development. – Jeremy Duvall, 7Factor Software
5. Adopt ‘Shift Left’ Principles
Integrate security early in the development cycle by embracing “shift left” principles that include continually testing code for both vulnerabilities and flaws. Use DevSecOps tools that plug into CI/CD processes and developers’ preferred development (integrated development environment) interfaces. This will allow them to identify and remediate errors sooner 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 drive code quality higher: pairing and mobbing. Pairing is where one developer is on the keyboard and another is providing overall direction—then they switch. It is especially helpful to pair an experienced developer with one who is less experienced. Mobbing is when one developer is at the keyboard and two or more people are providing input and observing. – Dave Todaro, Ascendle
7. Assign A Code Owner
Assign one person to be the code owner of the project. If multiple developers are working on the project, ask the code owner to do code reviews. If no one is responsible for the code, it is pretty much a guarantee the code will be shortsighted. When you have a code owner, you most likely will 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 piece of art. It’s functional, it’s beautiful and it has your signature written all over it. Write code that you can proudly showcase 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 continuous integration, continuous development process. In doing so, over-invest in documentation to remove ambiguity for the developers and quality assurance engineers. Structure development sprints in three-week, not two-week, cadences. Use the third week to complete QA reviews, stress test and debug. These are key elements to producing quality code. – Mark Francis, Electronic Caregiver
10. Document Shared Coding Practices
Developers, and by extension managers, need to document their shared 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 everybody can see and reference is the best way to solidify it. – Andrew Zhou, Kona
11. Shift Away From A Culture That Favors Speed Over Quality
Mistakes will happen, but organizations must shift away from a culture that ignores quality in favor of speed. Embracing 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 launch of applications and APIs through automation and improved compliance monitoring. – Carlos Morales, Neustar Security Services
12. Leverage Low-Code Platforms For Low-Level Coding
Rushed coding can lead to sloppy code, even from developers with good habits. Replace low-level coding with low-code development. Examine what areas of a project can be relegated 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 when coding what matters most. – Ed Macosky, Boomi
13. Ensure Your Developers Have Enough Time For Careful Coding
Organize developers’ work schedules so they have enough time to code. When you’re having meeting after meeting, the time allocated for coding gets shorter and shorter. 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 they have enough maker time to deliver quality code. – Alex Circei, Waydev
14. Collaborate With Mentors On Challenges
Take your time and produce the best code that you can. Finding mentors to collaborate with when you have challenges is also good practice. Additionally, if the opportunity presents itself with your team, encourage proper Agile practices and implementations of open-source platforms that inspect code quality and detect bugs, such as SonarQube. – Steve Taplin, Sonatafy Technology
15. Consider How Others Will Read Your Code
Think through what you write, and ask yourself how each piece of code might be read by others and how they might be using 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 an excellent writer, to create good code, developers need to read code from their highly admired peers. When writing their own code, developers need to channel the learning they have received from reading others’ code in terms of code quality, style, comments, coding conventions and test cases. This will help developers write cleaner, better code. – Vishwas Manral, Skyhigh Security
For more information talk to us today or follow us on LinkedIn and Facebook for news, updates, and discussions with industry professionals. #sonatafytechnology #forbes #techleaders