Essential programming nomenclature
Programmers treat terminology seriously. We are not happy when a function name or documentation is misleading. We also like to point out, when someone uses an incorrect terminology in discussions or technical writing. Publish a post, and use "argument" instead of a "parameter", and you will likely see a comment, or at least people will not treat you as a competent author. That is why terminology is so important. This is also why I collected the most important terms and explained them in this article.
Let's start from bare essentials. A variable is a symbolic name associated with a value and whose associated value may be changed. A function is a specific way to represent an action that a system can perform.
Both variables and functions declared at the file level are known as top-level. Those defined inside functions are known as local.
Inside functions, we can define parameters. A parameter is a variable defined as a part of function definition. When we call such a function, we specify arguments. An argument is a value used during function invocation, that is assigned to a specific parameter.
A statement is a syntactic unit of an imperative programming language that expresses some action to be carried out. In some languages, like Java, every statement ends with a semicolon. An expression is any part of code that produces a value. A single statement might be constructed from many expressions. One expression might consist of many other expressions. Statements are executed, expressions are evaluated.
A class is a definition for objects. Constructor calls create in instance of this class, also known as an object.
A type is a classification of data. Types can be considered as definitions of what can be safely done with an object. Types are often confused with classes, because each class generates a type with the same name, that is used to expect instanced of this class. However, it also generates a nullable type, so
User? is a type, not a class. We use types next to variables and functions.
An element is the most generic term, that includes all kinds of structures defined in code. In Kotlin, there are the following elements: variables, functions, classes, interfaces, object declarations.
All the elements defined inside a class are known as members. A pure member variable is called a field. When a language supports encapsulation (so setting custom setter or getter), we call it a property. So Java have fields, but Kotlin has properties.
All the elements that can be used from other files are known as an API. The public elements are known as the public API. The developer that uses our API is known as a user of our API. The code that uses our API is known as a client of our API.
When a function is defined together with body, it is function definition. When we define an abstract function, we define function declaration. The same with variables. Some say, that function definition always includes declaration as well.
A literal in programming is a notation for representing a value. So
123 is an integer literal, because it produces an integer value.
"ABC" is a string literal, that produces a value of type
String. Many languages have collection literals, that are dedicated structures to create list, sets, tuples or maps (dictionaries).
A function literal is a special structure we use to create a value representing a function. Since such a literal typically creates a function with no name, and in such cases, it is also known as anonymous function. There is also a popular structure known as lambda expression, typically defined using braces or an arrow. A closure is a lambda expression that captures references to local variables.
That is all for now. There are much more terms, but those are bare essentials.