Over the years, programming has taught me that should should have at least a semi-clear idea of what you want to build or design. With clarity, your projects will become a mishmash of ideas and in the context of programming, will need serious refactoring.
I’m going to take a project I’ve been working on as an example. In that project, I needed a modular way of adding commands and their functionality (like a console). In the first version of the project, I basically had a function which had a bunch of ‘if’ statements checking whether the user input matched a certain regex and if it did, I executed some function. While convenient, this would theoretically over the years make my search function, a really big mess of ‘if’ statements. This made me realize that I had to actually step back and figure out how I was going to implement this in a modular way.
Thus, another idea struck me. The idea revolved around dynamically loading class libraries at runtime as addons. Each addon would have a Regex property and an Execute function. I would load all addons at the start and on user input, cycle through each addon checking whether the user input matches the Regex pattern. If it matched, I would call the Execute function. This method of execution (in my opinion) is around 2900% better than my previous method. Since, I can just take out the addon from the Addons folder if I didn’t want it or add new ones easily, no recompilation of source code is needed. Another advantage of this method is that anyone can make addons since they can easily ‘hook’ into the addon system.
I am ecstatic that I took the time to re-implement my program. Now I can develop the command line-ish UI separately and develop commands externally. This is what the problem is open source programs is nowadays. With a lack of fundamental design philosophy, programs quickly turn into mashed up pieces of individual code.
As weird as it seems, I use Microsoft Paint a lot when implementing things. I’ll just draw out what needs to be done or what is being done. Algorithms are easier to implement for me if I have a Paint window open.