Naming things (= variables, properties, functions, methods, classes) correctly and in an understandable way if an extremely important part of writing clean code.

Indeed - if poor names are chosen - pretty much all other concepts taught throughout the course will not help that much.

Be Descriptive

Names have one simple purpose: They should describe what's stored in a variable or property or what a function or method does. Or what kind of object will be created when instantiating a class.

If you keep that in mind, coming up with good names should actually be straightforward

Untitled

Naming Rules

Variables & Properties

Variables and properties hold data - numbers, text (strings), boolean values, objects, lists, arrays, maps etc.

Hence the name should imply which kind of data is being stored. Therefore, variables and properties should typically receive a noun as a name. For

example: user, product, customer, database, transaction etc.

Alternatively, you could also use a short phrase with an adjective - typically for storing boolean values. For example: isValid, didAuthenticate, isLoggedIn, emailExists etc.

Typically, if you can be more specific, you should be more specific. For example, prefer customer over user if the code at hand is doing customer-specific

operations with that data. This makes your code easier to read and understand.

Untitled

Functions & Methods

Functions and methods can be called to then execute some code. That means that they perform tasks and operations.

Therefore, functions and methods should typically receive a verb as a name. For example: login(), createUser(), database.insert(), log() etc.

Alternatively, functions and methods can also be used to primarily produce values - then, especially when producing booleans, you could also go for short phrases with adjectives. For example: isValid(...), isEmail(...), isEmpty(...) etc.