Skip to content

Programming Glossary#

Terminology, Lingo, and Clarification for Programming.


Baseline Definitions#

Terms you already know or can "feel".


Programming Language#

Simple Definition:

  • A human interface that controls computers, usually textual and with formal rules.
  • Depends on who you're asking!

Syntax#

Simple Definition:


Semantics#

Simple Definition:

  • The meaning of the code written.
  • Something like 1 + 1 and add(1, 1) are semantically identical.

Execution#

Things listed below are parts of how the code actually becomes something that runs.

NOTE: All these items are subject to implementation detail beyond the most abstract answer.


Compiler#

Simple Definition:

  • A program that commonly converts code to other code (usually lower).
  • Sometimes refers to linking, optimizing, and other add-on features.

Stack & Heap#

Simple What:

  • How data is held in memory and used when running.
  • This is a complex subject that will vary by every programming & OS implementation.

Simple Why:

  • The way many popular languages split variable scope and object persistent.
  • Stack variables are faster to add and remove, where as heap variables are global and shareable.
  • Better explained here.

I'll leave it to the professionals to explain this:


Variable#

Simple Definition:

  • A Variable is named symbol that (may) contain data.

Simple Why:

  • It allows for reuse of code and easier comprehension of our code.
Examples

Input:

int i = 5;      // i = variable
string s = "hi" // s = variable


Literal#

Simple Definition:

  • A Literal is a value that is literally itself.
    • Such as "Words", or 12, or false
    • Good explanation and examples of literal vs non-literal here.

Simple Why:

  • Most languages have compile time advantages for values that won't change.
Examples

Input:

int i = 5; // 5 = literal
string s = "hi" // "hi" = literal


Constant#

Simple Definition:

Simple Why:

  • Most languages have compile time advantages for values that won't change.
  • Descriptively tells programmers that this value is immutable.
Examples

Input:

const int Months = 12;  // Months are unchanging
const double PI = 3.14; // Pi is unchanging


Types#

Simple Definition:

  • A Data Type (or Type) is a classification of data which tells a language how to handle it.

Simple Why:

  • Its creates formal logic, optimization opportunities, and easier to check code.
  • Learn more about why to use types here.
Examples

Input:

int i = 5;      // int = type
string s = "hi" // string = type


Common Data Types#

Simple Definition:

  • Most languages have these date types (non-exhaustive):
Type What
Integers -2, -1, 0, 1, 2 (Read More).
Floating Point -2.2, -1.0, 0.0, 1.3E-12, 2E9 (Read More).
Boolean false, true (Read More).
Char a, A, b, !, 😃 (Read More).
Null Null, sometimes Undefined or Empty (Read More)
Enum {LOW = 1, MEDIUM = 2, HIGH = 3} (Read More)
Array ["ford", "toyota", "dodge"] (Read More)
Record / Struct {string firstName, string lastName, int birthYear} (Read More)
  • Depending on language or library, they also may support these (and many more):
Type What
String Hello, A sentence, forty-two (Read More)
Time 23:00:00.000UTC (Read More)
Date 2023-09-27 (Read More)

Type Casting / Type Conversion#

Simple What:

  • Depending on language, implicitly or explicitly converts one type to another.
  • For instance, a int will usually automatically "widen" to a double.

Simple Why:

  • Sometimes you need to have a different type from data that already exists.
Examples

Implicit:

int myInt = 9;
double myDouble = myInt; // Now we have a 9 of type double!

Explicit:

double myDouble = 9.78;
int myInt = (int) myDouble;    // Notice how we define (int) since we may lose data.
Console.WriteLine(myDouble);   // Outputs 9.78
Console.WriteLine(myInt);      // Outputs 9 (!)

There are other ways to do these conversions, but these are the most common ways when people say "Type Casting"


Generics#

Simple Definition:

Simple Why:

  • Allows compile time checks & optimization.
  • Allows for reuseable code.
  • Eliminates boxing for languages the implicitly cast.
Examples
var myIntList = new List<int>();
myIntList.Add(10);
myIntList.Add("String");     // Error: string != int

var myStringList = new List<string>();
myStringList.Add("String");
myStringList.Add(10);        // Error: int != string

Strings#

Strings are a very common data type.

You'll use them


Escape Characters#

Simple Definition:

  • An Escape Character is a special character or action represented by a symbol.
  • Each language and tool has different ways of expressing the special characters.

Simple Why:

  • How does one represent a new line or the same quote character that closes the string?
Examples

Input:

Console.WriteLine("Hello\nWorld")

Output:

Hello
World


Input:

Console.WriteLine("\"Yay!\"")

Output:

"Yay!"


Common Escape Characters#

Simple Definition:

This list is non-exhaustive:

Type What
\n New Line
\r Carriage Return (MacOS New Line / Windows \r\n New Line)
\t Horizontal Tab
\v Vertical Tab
\b Backspace
\0 Null Character
\\ Literal \
\' Literal '
\" Literal "

Modulus#

Simple What:

  • Common way of getting remainder of number after division, represented by symbol %.

Simple Why:

  • Good for launching "Once every n times" operations.
  • Good for determining even & odd.
  • Good way to create chance system in combination with a random function.

image-20230930165909.png

Examples

Basic example:

int timeOne   = 23 % 12; // 11
int timeTwo   = 24 % 12; // 0
int timeThree = 25 % 12; // 1

Even or Odd:

if (num % 2 == 0) {
    // even
}

Compound Assignment Operators#

Simple What:

Simple Why:

  • Makes reading code sometimes more elegant. This is an audience question.

Increment / Decrement#

Simple What:

Simple Why:

  • Easy way to move up and down a number.
  • Useful during for loops or iterations.
Examples

Basic example:

int i = 1;
i++;       // i = 2

Order difference example:

int i = 1;
Console.WriteLine(i++); // "1"; i = 2
int i = 1;
Console.WriteLine(++i); // "2"; i = 2

Dictionary / Map / Key Value Collection#

Simple What:

  • Many names to describe a collection of keys and values, usually modifiable.
  • Formally defined as an Associative Array.
  • A Hash Map / Hash Table is an implementation of the underlying key sorting algorithm.

Simple Why:

  • Lots of things need a unique identifier with information under it.
    • For instance, a student (who has a unique ID) and their overall grades.
Examples

C# has a Hashtable and a preferred generic-capable Dictionary.

Dictionary accepts nearly any type for both <Key, Value>.

Student example:

using System.Collections.Generic;

var grades = new Dictionary<string, List<int>>();
grades.Add("Ed",       new List<int> {93, 87, 98, 95, 10});
grades.Add("Deadbeef", new List<int> {80, 83, 82, 88, 85});
grades.Add("Cafe",     new List<int> {84, 96, 73, 85, 79});

You may also initialize it with data a few different ways.

var grades = new Dictionary<string, List<int>>
{
    {"Ed",         new List<int> {93, 87, 98, 95, 10}},
    {"Deadbeef",   new List<int> {80, 83, 82, 88, 85}}
};
// ... You can still add them later normally
grades.Add("Cafe", new List<int> {84, 96, 73, 85, 79});

Stateful / Stateless Code#

Simple What:

  • Stateful code stores information about itself that can be recalled later.
  • Stateless code works regardless and consistently without memory of the past.
  • Good answers here.

Simple Why:

Examples

Stateless:

void addTwo(int a, int b)
{
    int statelessNumber = a + b;
    Console.WriteLine(statelessNumber);
};

addTwo(1, 2);

Stateful:

int statefulNumber;

void addMore(int a)
{
    statefulNumber = statefulNumber + a;
    Console.WriteLine(statefulNumber);
}

addMore(5);
addMore(5);

image-20231001141656.png


Access Modifiers#

Simple What:

  • Access modifiers are a popular OOP feature that restrict who can access what of a class.
  • Commonly expressed as public, protected, private, and a few others.

image-20231008105603.png

Simple Why: