How to Design Programs
After 20 years of programming, this is what comes to my mind when I hear "How do Design Programs":<p>1: Start with the data structure<p>The tools to operate on the data can be rewritten or improved without much pain. Changing the data structure is what hurts. If the data structure is elegant, the code will fall into place. If the data structure is messy, the code will grow into a giant hairy ball of madness.<p>2: Don't use a DB. Use human-readable text files<p>It makes everything so much easier. You can see if your data structure is elegant. Because then the files will be easy to read and navigate.
You will be able to start up your software 20 years from now without any installation and without having to go through the hell that is setting up the environment and updating dependencies. The website you are reading this on, Hacker News, stores all data in text files.<p>3: Build small tools to operate on the data<p>Like Linus started git by writing small tools "git-add", "git-commit", "git-log" etc. On the web you can have one url to do one thing (/urser, /item, /edit here on HN) and map them to one code file on your disk. If you want to use a framework like Django, Laravel or Express, those will unfortunately make it a bit harder to do that. But you can still stick somewhat closely to this approach.<p>4: Let people use it right away<p>If you are building it for yourself, you already have a user. Great. If not, let your target group use it right away. Otherwise, you will waste many years of your life building software features nobody understands or even wants.