November 18, 2019
Today’s software developers must have talent and creativity to write good code. However, it’s also important that they have self-discipline. Successful developers should always be studying and following current best practices for their work.
To help you and your team consistently create better code, we asked 14 members of Forbes Technology Council to share their best advice for developers.
1. Make The Code Speak For You
Code readability remains the top priority for code quality. Make it a practice to review the open-source code and jot down the likes and dislikes. Now, treat your code the same way you want others to treat theirs. Code is a way to express your ideas and style to others—hence, make the code speak for you with good comments. – Anto Joseph, RecVue
2. Implement A Peer Code Review System
The most important and the easiest step in creating better code is the code review. Have all your code reviewed—not even by your supervisor, but by a peer—and you will see immediate results. Your code will get better and overall product quality will dramatically rise. – Dennis Turpitka, AprioritForbes Technology Council is an invitation-only community for world-class CIOs, CTOs and technology executives. Do I qualify?
3. Write Code That Your Fellow Developers Can Understand
Coding and building a project is a group effort. An important step that I would emphasize is that the developer makes sure that the code that is being written is readable by other developers. This is important since it not only makes the code easy to maintain but also makes it easier to debug by others in case there are issues in the future—which is almost always the case with development! – Mihir Shinde, B&H Photo Video Pro Audio
4. Remain Consistent In Your Team Standards
Follow the same guidelines and standards throughout your work so that it is easy to follow along. Have it constantly reviewed by others so they can share feedback. Provide thorough comments so that anyone can understand it even ages later. – Ankit Sharma, Inventive Byte
5. Automate Your Security
Seek ways to truly automate security. This means reducing the manual processes required and increasing speed. Too often security is “automated” merely by kicking off the same old tools during a pull request, build or deployment, which doesn’t increase operational efficiency in any meaningful way. – Manish Gupta, ShiftLeft
6. Code For Testability
Good code is about testability as much as it is about enabling desired functionality. Developers should build tests for failure conditions as part of the development cycle that eventually feed into a test suite that caters to larger groups of functionality. This practice, in conjunction with peer reviews, inherently provides coverage for deterministic functionality and eases maintenance. – Arun Samuga, Elemica International, Inc.
7. Think About Long-Term Maintenance
Don’t just write code that works. Write code that can be maintained in perpetuity, not just by you but by any who follow. KISS (”Keep It Simple Stupid”) and DRY (”Don’t Repeat Yourself”) are good mottos to live by both in life and in code. – José Morey, Liberty BioSecurity
8. Encourage Discussion Among Peers
I am a huge advocate of flat hierarchical work structures because peer review and discussion are vital ingredients for better code. When a team feels able to show errors or ideas for advice, the work will be more creative, tuned and efficient. Traditional top-down organization discourages this due to unhealthy competition, toe-stepping worries and less communication. – Artem Petrov, Reinvently
9. Include Source Code Comments
Writing code is similar to writing prose. Everyone has a different style and distinctive voice. Everyone thinks that their code makes total sense. However, at a future date, the code may not appear to be so elegant—to another programmer, it may not make sense at all. To overcome this, the housekeeping must be consistent and programmers must include source code commenting throughout their code. – David Morris, FalconStor Software, Inc.
10. Minimize Technical Debt Wherever Possible
Engineers are often told to code as quickly as possible to meet deadlines. But that yields sloppy code, quick fixes and Band-Aids that will later break at the worst possible time (like when your company finally gets that big press hit). As a developer, it’s your responsibility to argue for the time you need to clean up technical debt so it’s clear all the way to the top of the chain of command. – Pete Kistler, BrandYourself.com
11. Follow The SOLID Method
A simple way to create better code is by following the five SOLID object-oriented design principles. First promoted by Robert C. Martin, these principles have become standard among developers, and implementing them helps create clean code that is more flexible, extendable and maintainable. When SOLID is appropriately applied, it makes code easier to read, understand, debug, change and refactor. – Christopher Yang, Corporate Travel Management
12. Prioritize Proper Documentation To ‘Pass the Baton’
Oftentimes when using agile methodologies there’s pressure to hit deadlines and push the code out without having the documentation complete. But this is shortsighted. Proper documentation pays dividends in the future by catalyzing further collaboration. Team members new to a project can get initialized faster. In turn, this enables faster progress and fewer headaches in development. – Marc Fischer, Dogtown Media LLC
13. Create A Mental Map Before You Start Coding
The best code is created before you type a single character onto the keyboard. It starts with a well-thought-out design and a mental map of what you want to build. Once you have the design, with its associated details, planned out, you are ready to code. Those developers who stick to this process often create the best code—code that can be easily maintained by others in their organization. – Mohit Aron, Cohesity
14. Don’t Compromise On Standards
Whether it’s linting, test coverage, naming conventions, complexity or other internal standards, don’t let exceptions to rules slip through the cracks. Hold yourself accountable and don’t rely on code review to catch this stuff. Most checks can be automated, incorporated into a pre-commit hook or added right into your integrated development environment. Resist the urge to add ignore statements to rule configurations. – Chris Sullivan, Ampion