Aaaaah, nothing cheers me up more than a clean, tidy piece of code!
Jammin’ does not mean rushing, because hurry is a programmer’s worst enemy.
You’re like “hey, let’s to that any old way, I don’t have much time to waste on optimization, indentation, comments and crap like that, right?”
Every time you write a class without havin clear in mind what it has to do, the risk of making mistakes rise up to alarming levels!
You can’t obviously waste time by deep planning every single interaction, since it will take way too much time for a jam, but here comes the real thing. Just follow my reasoning.
If you can’t pay too much attention to the planning phase you’re going to make mistakes.
Then you’ll have to FIND those mistakes.
Neat code helps you having a better overview to the whole thing, which actually makes bug finding A LOT FASTER!
What are the tools you can use to change a shapeless hell to a well organized heaven?
Let’s look at them together!
Beautiful invention, yet uttelry underestimated by a lot of coders.
Basically plain text inside your code whose job is to explain what are you going to do with a certain line or an entire block of code. It’s an explicit declaration of your intents
// I am a single line comment
* I am a multiline comment
There is also a special kind of comment, but I’ll talk about it in one of the next posts.
You know that nice little gray boxes that appear when you hold your cursor above something in the inspector?
You can create them too with a ludicrously simple line of code above the variable you want it to appear above
[Tooltip(“Hi, I’m a tooltip!”)]
public int crap;
Regions are a C# preprocessor directive.
You can use them to envelop great portions of code to quickly identify them basing on your personal criteria.
Everything can be put inside a Region, from variables to functions. Here’s an example in my code (you can see it in the top image of this article.
// I nemici vengono gestiti come coda circolare, in modo da mantenere una certa varietà nelle apparizioni a schermo
private GameObject enemiesList;
private int head;