HACKER Q&A
📣 curious4void

What and how to think before jumping to write code


As soon as I get the basic idea of new feature and or design that needs to be developed. I directly start implementing it without considering basic things it'll need in immediate future, extensiblity etc. So I want to know how to improve this bad habit. From where can I start improving it. Considering xyz or some basic checklists/good reads will help alot. Thanks!


  👤 vivegi Accepted Answer ✓
Welcome to HN!

Try to write the documentation for the feature from a end user's perspective first. Stick to the bare essentials and effectiveness for the user.

Then try to write a brief about how the feature can be implemented using the developer's perspective. List down the translation units (i.e., source files), libraries/executables, databases/filesystem structures/files that will be impacted.

There will be multiple ways in which you could implement the feature. While writing this down, you can list all the alternatives briefly and then note down which alternative you have chosen and the rationale for it.

Then try to write a brief about how you will test it. At this time, it can be your overall test strategy and some key test cases (not necessarily all).

Keep all of this brief (you are not writing War and Peace).

With all this prep work, your mind would start using its associative capabilities to suggest how you can proceed with the actual coding.