During my career, whether as a founder, manager, interviewer or fellow developer, I have had many opportunities to work with software developers as they begin their careers. Often, these aspiring developers ask me for advice on how to become a better software developer. Here are some of the key principles that I find myself repeating time and time again.
1. Practice, practice, practice
The only way to become a great software developer is by writing code. Lots of it.
While you can certainly learn about software development by reading books and articles and taking classes, there is no substitute for writing code. No classroom or book can provide the learning and growth that comes with writing, testing and debugging your own code.
I see many developers building software mostly by copying and pasting code found online (such as from Stack Overflow). They build software as if it were a patchwork quilt, stitching together patches of code here and there to implement a solution, without actually writing much code themselves. I don't think you can ever become a good (let alone great) developer with this workflow. You simply must write the code yourself, and do it over, and over and over.
I encourage you to have your own personal projects to accelerate your programming experience. It doesn't really matter what software you decide to build. Just pick something interesting, and develop the software. When you're done, repeat the process, again and again.
2. Persistence
As with most challenging topics, mastery of software development does not come easy. Repeatedly, you will be faced with problems that you aren't sure how to solve. Have faith in yourself and your problem-solving skills.
Give yourself completely to the craft of software development. It will be hard. You will struggle. You need those experiences where you spend two days straight chasing down a difficult bug, where you become so frustrated that you want to throw your keyboard through the window. Don't give up. Stick with it until you find the answer.
By persevering through these difficult problems, your software development skills will improve by orders of magnitude.
Persistence is key here. Great software developers battle through difficult challenges and "ship" code. If you give up on a project once it gets difficult, you will never become a great software developer. Without question, finishing matters.
3. Value understanding above correctness
Frequently, I see junior developers (and sometimes even senior developers) try to fix code bugs by making random tweaks (usually via Stack Overflow snippets) until they get a working piece of software. This type of approach squanders any opportunity for learning and growth. You may arrive at a solution, but not be entirely sure why it works. The biggest problem with this approach is the simple fact that there is no understanding (and hence growth) for the developer.
Don’t let anything about your software be a mystery. Make sure you understand what every line of your code is doing.
This may slow you down in the short-term, but will pay off immensely in the future. Each time you chase down one of these mysteries, you are making a deposit to your software development account. By taking the time to fully understand the code and how it works, you are dramatically improving your software development abilities.
4. Review great code written by others
One of the best ways to learn a craft is by studying the works of experts. Just as artists, architects, and others study the masters of their fields to improve their own work, software developers should read and analyze code written by masterful software developers.
Seek out the work created by developers or projects you admire. For example, identify an open source project written in your preferred language that is well respected by the community. Clone the repo, and study the code. Some aspects you should pay especially close attention to include:
- Is there a consistent coding style?
- How readable is the code? How quickly are you able to understand what the software is doing?
- What documentation is provided with the code?
- What types of tests are included? Are they manual or automated?
When studying the work of great software developers, don't just read the software, but strive to truly understand how it works. Doing so will accelerate your growth as a software developer.
5. Details matter
Imagine a skyscraper built by a team with little attention to detail. The team focuses on simply completing the building, without much care about the building details. They might use multiple types and sizes of brick for the facing. Perhaps windows are of various sizes. And maybe they install doors on only half the rooms. What would you think of such a building? You'd probably immediately judge the building to be of low quality (and perhaps not even safe). Attention to detail and strictly adhering to a building's specification is crucial for delivering a high-quality skyscraper.
Just as building a safe and effective skyscraper requires a keen eye for details, so does writing great software.
Great software is consistent through the enforcement of a coding standard. Each file of the project has the same look and feel. Even though many developers may have contributed to the code, the reader is unaware of this because of the uniform consistency across the project. Given that it is easy to enforce this consistency via automatic linting, there is no excuse for writing inconsistent code.
Great software is organized. Just from glancing at the directory structure, the reader should be able to intuit exactly where to find the various components of the software project, such as configuration, tests, database models, and endpoint implementations.
Great software doesn't have any unused code or files. Including unused code or files in a project increases the contextual load for anyone reviewing the project. Don't make others spend time trying to understand code only to discover that the code isn't actually used. Unused code or files are weeds in your software garden. Tend to your software by ruthlessly yanking out unused code and files.
6. Optimize for clarity
Earlier in my software development career, I took great pride in writing highly performant code. I used techniques such as unrolling loops, lookup tables and memory mapping to build the fastest software possible. While the software may have been performant, it was also very complicated, making it difficult to understand, troubleshoot and maintain.
Great software prioritizes readability and maintainability. Others will need to update and maintain your code. Keep the software as simple as possible to help reduce the contextual load associated with understanding your software. Perhaps a good measure of simplicity is how many comments are necessary to document the code. I believe that the best software requires no inline comments. Because the software is clear, concise and simple, it is self-documenting.
Be careful about premature optimization. Optimization that compromises simplicity should be carefully considered. Performance is most greatly affected by the software’s architecture, design and algorithms, and not by individual lines of code.
Great software avoids using idioms, especially those which are complicated or obscure. It is tempting to include tricky one-liners when writing code, but that's not great software. Great software doesn't force the reader to spend an inordinate amount of time trying to understand it. Keep it simple.
When you write clear and concise software and prioritize readability and maintainability, your teammates will thank you. Those who inherit your codebase will thank you. And you yourself will be grateful when you need to make a change to software you wrote six months ago (or even three weeks ago).
7. Testing
The best software developers take complete accountability for testing their code. They don't expect others to find their bugs. In fact, when bugs escape their detection and are found by others, they are disappointed.
Be relentless with your testing. Great software includes a collection of both unit and integration tests, with significant code coverage.
While the primary reason for developing test cases is to validate new code additions, test cases also serve as an investment, which over time, will produce substantial dividends. As a software codebase grows, having a robust suite of test cases gives confidence when making changes that there are no unexpected side effects.
By emphasizing testing as an essential component of software development, you will be forced to understand your code more fully and anticipate edge cases. Good software works under normal conditions, but great software works under unexpected conditions as well.
Roll up your sleeves and get to work
The path to becoming a great software developer is not easy, but it is also not a mystery.
Be diligent and persistent. Seek understanding and clarity. Study great code written by others. Take pride in the code you write. Pay attention to details. Test your code.
As with any goal worth attaining, you must put in the effort. If you commit yourself to these principles, you will become a better software developer.
Now go write some code!