I started coding in 1992 when the internet was non-existent, StackOverflow didn’t exist, and we were not sure if there would be GitHub someday. We only had access to books, programming manuals, self-practice, and peer help to find solutions whenever we used to get stuck.
I have read dozens of books, attended many courses, and learnt from some of the finest minds in the software developer world since I started coding 30 years ago.
I am writing these tips so that you can become a better programmer faster without wasting unwanted time and effort.
There are many ways to become a better programmer, and the specific steps you should take will depend on your current skill level and goals. Here are a few general strategies that can help you improve your skills:
My way of practice was to write code and then challenge myself to improve it to produce the same results with half of the original code. The more you code, the more comfortable you will become with the syntax and structures of your chosen programming language(s). Try working on your projects to reduce lines of code, processing speed, memory utilisation and stability.
Take advantage of online resources such as tutorials, blogs, and forums to learn from other experienced programmers. Attend meetups or conferences, and consider joining a study group or finding a mentor to help guide your learning.
Technology and programming languages are constantly evolving, so it’s important to stay current with new developments and best practices. Keep learning about semantics, structures, methodology, tools and techniques as they become available.
Don’t be afraid to tackle projects that are outside of your comfort zone or that seem too difficult at first. These types of projects can be great opportunities to learn and grow as a programmer.
Pay attention to details and are thorough in your work. Take the time to understand the problem you are trying to solve and design an efficient and effective solution.
As you gain experience, it’s important to develop good coding habits, such as writing code that is easy to read and understand, and commenting your code to explain your thought process. This will make it easier for others to work with your code, and it will also make it easier for you to come back to your own code later on.
Use comments and documentation to explain your thought process and to make your code more accessible to others. Here are a few tips for writing clean code:
- Use descriptive and meaningful names: Choose descriptive and meaningful names for your variables, functions, and other elements in your code. Avoid using abbreviations or single letters unless they are well-known and widely accepted (e.g. “i” for a loop index).
- Use consistent formatting: Use a consistent style for formatting your code, including things like indentation, whitespace, and curly braces. This will make your code easier to read and understand.
- Keep it simple: Don’t overcomplicate your code. Use simple, straightforward solutions whenever possible. Avoid writing unnecessarily complex code, as it will be harder to understand and maintain.
- Break up long blocks of code: If you have a long block of code, consider breaking it up into smaller, more manageable chunks. This will make your code easier to read and understand.
- Use comments: Use comments to explain your thought process and to provide context for your code. However, be sure to use comments sparingly and only where they are necessary. Too many comments can make your code harder to read.
Adhere to coding standards and guidelines that are relevant to your programming language and project. This will help ensure that your code is consistent with industry best practices. Here are a few examples of coding standards and guidelines that are commonly followed in different programming languages:
- In Python, the PEP 8 style guide is a widely accepted set of coding standards and guidelines. It covers topics such as code layout, naming conventions, and best practices for writing Python code.
- In Java, the Java Code Conventions is a set of guidelines for writing Java code. It covers topics such as naming conventions, code layout, and commenting.
- In C++, the C++ Core Guidelines is a set of coding standards and guidelines developed by the C++ community. It covers topics such as naming conventions, code layout, and best practices for writing C++ code.
- In C#, the C# Coding Conventions is a set of guidelines for writing C# code. It covers topics such as naming conventions, code layout, and commenting.
It would be best if you always referred to the standards and guidelines for programming languages and projects specific to your development expertise.
Test your code thoroughly to ensure that it is working correctly and as intended. This will help you catch and fix any issues before they become problems. Here are a few steps you can follow to test your code as a programmer:
- Identify the goals of your test: Before you start testing, it’s important to understand what you are trying to achieve. What are you testing for? What do you hope to accomplish with your test? Having a clear set of goals will help you focus your efforts and make your testing more effective.
- Read/Write test cases: Test cases show specific scenarios under which the software should work, and you should test it. It describes the expected inputs and outputs for your code. Reading/Writing test cases before you start coding can help you understand what your code needs to do and can also help you identify any potential issues or edge cases that you might need to account for.
- Run your tests: Once you are done with the software development, you can start running your tests. This typically involves executing your code with the test cases as inputs and verifying that the outputs are as expected. You may need to run your tests multiple times to ensure that your code is working correctly.
- Debug your code: If your tests fail, you will need to debug your code to identify and fix the issue. This may involve using a debugger or other tools to step through your code, or simply reviewing your code and identifying any errors or bugs.
- Refactor your code: As you test and debug your code, you may find that certain parts of your code can be improved or made more efficient. In this case, you may want to refactor your code, which involves making changes to the structure or design of your code without changing its behavior.
- Repeat as necessary: Testing is an ongoing process, and you may need to run your tests multiple times and make changes to your code as you go. Be sure to continue testing and debugging until you are confident that your code is working correctly and is of high quality.
By making testing a regular part of your workflow, you can ensure that your code is reliable and of high quality.
Don’t give up easily. Be willing to put in the time and effort to solve complex problems, and you can stay focused and motivated even when faced with challenges.
Become a good programmer with the ability to explain your ideas and solutions in writing and person.
You are ready to adapt to changing requirements and technologies. Show your team members and stakeholders you are flexible and able to learn and apply new skills as needed.
That’s it from me. Let me know if I missed any point you think is important to become a good programmer.