Unreal friendly naming

8_tx_uc2
#1

In this lesson we cover good naming and self documenting our code.

We also make sure to name our variables in Unreal’s preferred naming convention which is UpperCamelCase, also known as PascalCase.

Why does good naming matter? How does self documenting code help us?

#2

I find that giving variables meaningful names makes it so much easier for me to understand my own code and also to know what each variable contains, particularly several weeks down the line when I’ve added more code and forgotten everything before it.

Also other people can follow your code more easily if you are seeking help on forums or if you are working in a team.

Same is to be said for commenting your code.

#3

Personally, I overlook comments. Too many comments are bad in that if you change how something works then you have to change the comment as well and if you forget then it gets all sort of confusing and more time is lost over just having good names for everything.

Ideally, you want to quickly look at something without comments and know how it works. If you can’t do that then its too difficult or the naming is bad.

Of course, there are times where it makes sense to comment like for documentation of a Function others will be using such as with UE and may need to know how to obtain specific value(s) can be passed. Ie id… well what id because it could be anything? Since naming might not work there, documenting it does.

#4

All questions can be anwered by : for readability reasons.

The more code it is added, the less it is readable, even if there is only one person working in the project. Thus, comments and naming conventions help us to work more efficiently.

#5

Writing good names to our variables is used to know how that variable is going to be used, documenting our program serves to make as much as we as others understand our code and thus to know exactly what each part of the code does.

My TripleX game goes this way for now:

#6

Here is my TripleX program

#7

Good naming is just good practice, it reduces the amount we need to actively remember and allows us to read our code and file saving structure better.

Self-documenting allows us to remind ourselves and others about the reasoning behind parts of code e.g. what a certain bit of it is doing there.

#8

Here is my terminal triplex-terminal

Good naming matters because it makes for better readability, and self documenting code helps us understand what our code does just by reading the code.

#9

my current code

#10

Mi console output below!

Good naming plays a similarly role to good commenting: it’ll help you not to get lost asking yourself what was that variable for. In the same way it helps other people who reads your code to understand better what you are doing.

#11

Good naming conventions and self documenting your code helps by making the intentions of the code you write clear and consistent, both to yourself when you come back to pieces of code later, and to others that might work on a program that you’re coding for.

progress screenshot:

image

it’s been like four days since I was last here. Gonna try my best not to fall off the wagon and keep a good pace. I’ve been writing simple programs in a physical notebook just to make sure I don’t forget anything I’ve learned

#12

The Terminal.

#13

My progress so far: 72%20(3)

Decided to add an screenshot of the code itself rather than just the terminal, cause why not!

#14


Here is a quick screenshot showing how my program is coming together so far. As for the questions

Why does good naming matter?

Good names let us figure out what something is just by looking at it in code. This makes it far easier to understand what is happening, preventing mistakes.

How does self documenting code help us?

If the code is well self documented then other people, or ourselves in the future. Can figure out what code was meant to do, or what we were thinking when we wrote the code. Improving their understanding of how everything has been built and therefore make it much easier to be able to work on that code without introducing nasty bugs.