4 ms·
Here is my dumb army guy approach to programming anything. It doesn't work for everybody. 1. Think about the problem. 2. Form a tentative plan (the visual pa
by austincheney 5y ago
Here is my dumb army guy approach to programming anything. It doesn't work for everybody.
1. Think about the problem.
2. Form a tentative plan (the visual part).
3. Write a rough draft of code (the code doesn't have to work yet).
4. Test it and make it work (minimum viable effort).
5. Refactor. Polish the code and eliminate tech debt.
Think about the problem. Get a solid vision for what you want done. Once you have solid emotional confidence about that end state balance it against what you have. With that you know what you are missing. That stuff that is missing is the work you must perform.
When you think functionally everything is an input and an output depending upon context. This allows thinking about the flow control directly without worry for the composition. If you have been programming for more than a couple of days the leet code of loops and conditions are completely ignored from planning as implied tasks much like you don't spend your time actively thinking about breathing when planning your day. Now you have a plan. Plans often fail as soon they become necessary, so the plan itself is irrelevant. What's important is the planning, the thought exercise not the product, the thinking about what needs to be done so you know what to do.
Programming then becomes a conceptually visual experience. Simply the write the code you see in your mind. The most important thing here is that you have a visualized a plan and know what you need to write. The code doesn't even have to work at this point.
Then write the code. Test what you have written. Fix the code so that it solves the desired problem. Only then should you actively toil with composition. When composition is saved for last it becomes an exercise in refactoring.
Refactoring is a form of code polish. It allows cleaning away the rough spots from the rough draft in order to achieve conformance to code style, build rules, and validation criteria. Refactoring also allows the combining of similar mechanisms which increases simplicity and reduces tech debt.