Dev Trick #005 : How to think a dev ? (Patreon)
Content
Hello there!
Ok, it's been a while, but today we're going to talk about development! Yes, some big code, some crazy test sessions and of course... a lot of bugs.
Yes, that's true, but it's very rare (at least for the first two parts ;) )... No, today we're going to talk about development logic, algo and companies.
Because, I spend my time repeating it in my job as a developer, but the goal of good code is to be :
- Understandable (being able to read the code again and "easily" understand what the code you are reading does, thanks to comments, well-chosen function and variable names, indentation and code cleanliness),
- Maintainable (when a bug is discovered, to be able to "easily" fix it),
- Scalable (to be able to modify the code to add a new feature without having to redevelop everything each time).
If you can achieve these three goals, you will certainly be a good developer.
But to achieve them, there are some mandatory steps you need to go through before you write the code.
First of all, know what you want to do: It sounds silly, but a lot of developers jump into developing a new feature without thinking it through, and then find themselves in the middle of it going off in all directions. It also means that you have narrowed down the development. What is your feature going to do, and what is it not going to do? That's the first thing you have to define.
This is the testing part, but the idea here is simply to take your feature, put it in its final environment (your game for example) and see if it fits, if it doesn't cause any other problems, etc... The easiest way to do this is to play your game and see what your feature should or should not do, and see if it fits.
Now you have a well-defined feature that, if designed correctly, will do its job. That's a lot!
The next step is to use pseudocode, function blocks, diagrams or other tools to define how this functionality works. This is where you break the whole functionality down into sub-functions and link them together to work out how you get from point A to the end of the scenario.
Then, when that is done, you take those sub-functions and recommend them, and so on.
Until you get to a fine enough cardinality that you have your whole algorithm in front of you.
And only then, only then, are you ready to code it!
And this applies to all languages. Exploring the language is good for testing, for getting ideas, but don't make your game or your program that way. Write it down, test it, develop it, and it will be better.
A teacher once told me: Always code thinking that the developer who will have to maintain and modify your code is a psychopath with a knife who knows where you live. And I personally would add: And besides, that psychopath could (probably?) be you!
That's it for today, and I know it doesn't necessarily apply to your future game, but it's the best advice I can give you as a senior developer.
See you next time!
MoonLight