When I start a project I usually just write the part on whatever it is needed at that time. There is no planning, no notes and no white board and I just do whatever my intuition is telling me. I feel if I stop coding the momentum will stop and I reset. I would then have these many micro projects that do only one thing and then convert them into single functions on the main project. I avoid classes if possible.
I would seize the opportunity while I’m full on velocity. Quickly diving into my code editor without any thoughts of any fear of failure and uncertainty. This is the time when I am naive is important. It is the moment that I can create new things. The result a new but broken prototype that kind of works.
The next day I would see the code and it will be a mess. I wouldn’t dare to show this to anyone as I think they will never consider working with me in the future when they see it. It’s not that I’m a bad programmer it’s just I don’t pay much attention to the source code architecture.
The problem with source code architecture is that it’s objective also. I would think that every person has different tolerance on what is messy and what is clean. I have worked with code bases that was serving 2k+ monthly paying customers but majority of its code is sitting on a single index.php file and a few extra component classes. A lot of us will think this is poor design choice but the product doesn’t care what you think while it is making money.
It is also hard to prioritize the refactoring when every day people find bugs and you have to patch them on the current non-refactored state. Once you add these fixes it just makes it harder and harder to refactor as the refactoring could cause regression on these fixes. It’s like you’ve already invested and you don’t wanna touch it anymore.
Thus the popular solution is to start adding unit tests. But that will just take more time as you have to write and maintain extra lines of unit test code. This may be a valid solution to companies with vast resources like FAANG companies. But to a simple person (a.k.a the 90%) this may only delay everything else.
Just look at WordPress the software that powers 60% of the websites around the world https://core.trac.wordpress.org/browser/branches/5.6/src/wp-includes/functions.php
I would say I love functions very much and the no-architecture software architecture fits me. I like how Sublime Text 3 and CMD+R would let me quickly type the function name and jump to that section of the code. It’s also feels good that I have a working prototype for myself at the end of the day.
Happy new year! wishing you all a healthy 2021