Whenever I embark on coding, this shall serve as my mental framework for becoming a proficient programmer:

Make it works

Your first priority is to create a working code, whether it’s experimental, a proof of concept, or a prototype. It doesn’t have to be perfect; it just needs to solve the problem or meet your initial expectations. Having a working code is crucial for proving your progress.

Ensure correctness

It’s not enough for the code to work; it must work correctly. Check that your code meets all the acceptance criteria, which are usually based on how users or customers will use the feature. Correctness is the ultimate goal, and it validates the effectiveness of your software.

Prioritize simplicity

Aim for code that reads like a story, not a puzzle. High complexity leads to errors, so try to reduce it by refactoring when necessary. If you can solve a problem with less code, that’s even better. Simplicity ensures that your code is easy to maintain, debug, and extend. Follow principles like “Don’t Repeat Yourself (DRY)” and “Keep It Simple Stupid (KISS)” to guide your coding practices.

Optimize when needed

Plan ahead, but if performance issues arise during testing, consider optimization. Measure or benchmark your code’s performance early in the design phase. If you find issues, optimize the code by changing algorithms or methods. Optimization can also happen when fixing bugs that require changes to your code’s structure. Examples include changing algorithms for better performance, refactoring due to design changes or bug fixes, cleaning up code, and adding necessary documentation.