How much progress should be made before going back and refactoring? I often run into the issue where I’m either overdoing the code cleanup aspect, or I’m spiraling out of control with something that becomes hard to maintain. There is an urge to make sure every detail of every function is completely optimized, but is that really necessary? I’ve recently started abiding by the 1,000 lines of code rule. Especially with games, if my project is less than 1,000 lines, I won’t consider major refactors. Only minute details need to be reworked without having to constantly rewrite along the way.
There is a tendency to assume your code behaves like an automobile in the sense that what’s under the hood matters as much as how cool it looks on the outside. However, I’ve noticed myself running into situations where over-optimizing and refactoring into more generic types can result in code that actually becomes more difficult to fulfill its purpose. Fortunately for code and coders, computers are usually quick enough to compensate for corners that may be cut or overlooked.
With the speed of C++ and the eloquence of modern languages, you would think that D is the goto for development these days. Although C++ is my favorite, I like to pick on it as well as Java. Here are some “Hello World” examples from each of the mentioned languages.
writeln("Hello World without explicit compilations!");
using namespace std;
cout << "Hello World" << endl;
Perhaps a “Hello World” isn’t the best way to showcase a language preference, but I think even something as trivial as the simplest program is revealing about each of these languages. In the last example, Java’s verbosity is evident with a somewhat substantial main declaration as well as the print statement. C++ isn’t too bad, but the way the print statement is handled isn’t the cleanest. By contrast, D is super straightforward.
Have you tried coding with D? It’s easy to setup for Visual Studio and is a pleasure to work with (https://dlang.org/).