Book 01 · Cheat sheet
Programming Fundamentals
Core concepts you meet in every language: variables, functions, asynchronous code and programming paradigms.
Software Dictionary · softwaredictionary.org/categories/programming/cheat-sheet
- 01Abstraction
- Abstraction is hiding the complicated details of how something works behind a simpler interface, so code can use it by knowing only what it does.
- Abstraction hides how something works behind what it does.
- Software is built from layers of abstraction, from hardware up.
- Interfaces and abstract classes are the main OOP tools for it.
- 02Algorithm
- An algorithm is a finite, step-by-step set of instructions for solving a problem or completing a task, such as sorting a list or finding the shortest route.
- An algorithm is a finite, ordered set of steps that turns an input into an output.
- It is language-independent; code is just one way to express it.
- Efficiency is described with Big O notation for time and memory.
- 03Array
- An array is an ordered collection of values stored under one name, where each item is accessed by its numeric position, called an index, usually starting at 0.
- An array stores an ordered list of values under one name.
- Items are accessed by index, which usually starts at 0.
- Reading an item by index is fast, O(1), no matter how large the array is.
- 04Async/Await
- Async/await is a syntax for writing asynchronous code that reads like ordinary step-by-step code, pausing at each await until a promise or task finishes.
- async marks a function as asynchronous; in JavaScript it always returns a promise.
- await pauses only the current function, not the whole program, until a promise settles.
- Errors can be handled with ordinary try/catch blocks.
- 05Base64
- Base64 is a way to write any binary data, such as an image or a key, using only 64 safe text characters, so it can pass through systems built for text.
- Base64 writes any bytes using 64 text characters.
- Every 3 bytes become 4 characters, so the data grows by about a third.
- It carries binary data through email, JSON, URLs and HTTP headers.
- 06Big O Notation
- Big O notation describes how an algorithm's running time or memory use grows as its input gets larger, focusing on the growth rate rather than exact speed.
- Big O describes how time or memory grows as the input size n increases.
- Common classes are O(1), O(log n), O(n), O(n log n), O(n^2), and O(2^n).
- Constants and smaller terms are dropped, so 3n + 5 becomes O(n).
- 07Callback
- A callback is a function passed as an argument to another function, which then calls it later, for example when a task finishes or an event happens.
- A callback is a function passed into another function to be run later.
- The receiving function controls when and how often the callback runs.
- Callbacks can be synchronous (like map) or asynchronous (like setTimeout).
- 08Character Encoding
- Character encoding is the set of rules that turns text into bytes and back again, so any letter can be stored and sent; today the standard is UTF-8.
- A character encoding maps text to bytes and back.
- Unicode numbers every character; an encoding such as UTF-8 decides how those numbers become bytes.
- UTF-8 uses 1 to 4 bytes per character and leaves ASCII text unchanged.
- 09Class
- A class is a blueprint in object-oriented programming that defines the data and behavior shared by a group of objects, which are created from it as instances.
- A class defines the properties and methods that its objects share.
- An object created from a class is called an instance.
- The constructor sets up each new instance's starting state.
- 10Closure
- A closure is a function that remembers the variables from the scope where it was created, so it can keep using them even after the outer function has returned.
- A closure is a function plus the variables it captured from its surrounding scope.
- Captured variables stay alive as long as the closure exists.
- Closures capture variables by reference, so they always see the latest value.
- 11Compiler
- A compiler is a program that translates source code written in a programming language into a lower-level form, such as machine code, that a computer can run.
- A compiler translates source code into machine code, bytecode, or another language.
- It works in stages: tokenizing, parsing, checking, optimizing, and generating code.
- Compile-time errors are caught before the program ever runs.
- 12Concurrency
- Concurrency is a program's ability to make progress on several tasks in overlapping time periods, such as serving many users at once rather than one at a time.
- Concurrency lets a program make progress on multiple tasks in overlapping time periods.
- It can be achieved with threads, event loops, async/await, goroutines, or actors.
- Parallelism means tasks run at literally the same time on multiple cores; concurrency does not require it.
- 13Constructor
- A constructor is a special method that runs when a new object is created from a class, setting up its starting values so it is ready to use.
- A constructor runs automatically when a new object is created from a class.
- Its job is to give the object a valid starting state.
- It is called constructor in JavaScript, __init__ in Python, and takes the class's name in Java and C#.
- 14Data Type
- A data type is a classification that tells a program what kind of value a piece of data holds, such as a number or text, and which operations work on it.
- A data type defines what kind of value data holds and which operations are allowed on it.
- Common primitive types include integers, floating-point numbers, strings, and booleans.
- Composite types such as arrays and objects group several values together.
- 15Debugging
- Debugging is the process of finding out why a program misbehaves, locating the faulty code and fixing it, often with the help of a tool called a debugger.
- Debugging means finding the cause of a bug and fixing it.
- Start by reproducing the problem reliably, then narrow down where it happens.
- Debuggers let you pause at breakpoints, step through code and inspect variables.
- 16Dynamic Typing
- Dynamic typing means types belong to values, not variables, and are checked while the program runs, so a variable can hold a number now and a string later.
- Types belong to values and are checked at runtime.
- Python, JavaScript, Ruby and PHP are dynamically typed.
- It is fast for scripts, prototypes and exploration.
- 17Encapsulation
- Encapsulation is the practice of bundling data with the methods that use it and hiding internal details, so outside code works only through a public interface.
- Encapsulation bundles data and the methods that operate on it in one unit.
- Access modifiers such as private and public control what outside code can see.
- All changes go through methods, which can validate input and keep data consistent.
- 18EnumEnumerated Type
- An enum is a data type that defines a fixed set of named values, such as an order's possible statuses, so code can't use a value outside that set.
- An enum is a type with a fixed set of named values.
- It prevents invalid values and reads better than magic numbers or strings.
- In C, enums are named integers; in Java, Rust and Swift they can carry methods or data.
- 19Exception
- An exception is an event that interrupts a program's normal flow when an error occurs, which code can catch and handle instead of letting the program crash.
- An exception interrupts normal execution when an error occurs at runtime.
- Code throws an exception, and a try/catch block can catch and handle it.
- Uncaught exceptions move up the call stack and can crash the program.
- 20Framework
- A framework is a reusable foundation of code, tools, and conventions that provides the structure of an application, so developers only fill in their own logic.
- A framework provides the structure of an application; you fill in the details.
- Inversion of control: the framework calls your code, not the other way around.
- It handles common tasks like routing, rendering, and data access.
- 21Function
- A function is a named, reusable block of code that performs a specific task, optionally taking inputs called parameters and returning a result.
- A function is a reusable, named block of code that does one job.
- Parameters are the inputs a function declares; arguments are the values you pass in.
- A return statement sends a result back to the caller.
- 22Functional Programming
- Functional programming is a style of building software from pure functions that avoid changing shared data, making code more predictable and easier to test.
- Functional programming builds software from pure functions without side effects.
- Data is treated as immutable: create new values instead of changing existing ones.
- Higher-order functions like map, filter, and reduce combine small functions into bigger ones.
- 23Garbage Collection
- Garbage collection is automatic memory management in which the language runtime finds data a program can no longer use and frees that memory for reuse.
- Garbage collection automatically frees memory that a program can no longer reach.
- Most collectors trace references from roots; unreachable objects are garbage.
- It prevents many memory bugs but can add short pauses and extra memory overhead.
- 24Generics
- Generics are a language feature that lets you write functions, classes, and types that work with many data types while still keeping full type safety.
- Generics let one function, class, or type work safely with many types.
- A type parameter such as T is a placeholder filled in by the caller or by type inference.
- The compiler still checks types, unlike any, which turns checking off.
- 25Higher-Order Function
- A higher-order function is a function that takes another function as an argument, returns a function, or both, so behavior can be passed around like data.
- A higher-order function takes a function as input, returns a function, or both.
- It requires first-class functions, which most modern languages support.
- map, filter and reduce are the classic examples.
- 26IDEIntegrated Development Environment
- An IDE (integrated development environment) is an application that combines a code editor, a debugger, build commands and other developer tools in one place.
- An IDE combines an editor, debugger, build tools and code navigation.
- It understands the code: errors, completion, go-to-definition and refactoring.
- IntelliJ IDEA, Visual Studio, PyCharm, Xcode and Android Studio are IDEs.
- 27Immutability
- Immutability means a value cannot be changed after it is created, so every update produces a new value instead of modifying the original in place.
- An immutable value never changes after it is created; updates produce new values.
- Immutable data can be shared safely between functions and threads.
- Functional languages make immutability the default and use persistent data structures to keep copies cheap.
- 28Inheritance
- Inheritance is an object-oriented programming feature that lets a new class reuse, extend, and override the fields and methods of an existing class.
- A child class inherits the fields and methods of its parent class.
- Subclasses can add new members and override inherited methods.
- super calls the parent's constructor or its version of a method.
- 29Interface
- An interface is a named set of method and property signatures that a type promises to provide, without saying how those members are implemented.
- An interface defines which methods and properties a type must have, not how they work.
- A class can implement several interfaces but usually extends only one class.
- Java and C# require an explicit implements; Go and TypeScript check the shape automatically.
- 30Interpreter
- An interpreter is a program that runs source code directly, step by step, instead of first translating the whole program into a separate executable file.
- An interpreter runs code directly, without producing a separate executable first.
- Most interpreters parse code and run bytecode on a virtual machine rather than raw text.
- JIT compilation inside an interpreter turns hot code into fast machine code at runtime.
- 31Iterator
- An iterator is an object that lets code step through the items of a collection one at a time, remembering its position, without exposing how the data is stored.
- An iterator returns items one at a time and remembers its current position.
- An iterable is the collection; an iterator is the cursor created from it.
- Loops such as for...of and Python's for use iterators behind the scenes.
- 32JIT CompilationJust-in-Time Compilation
- JIT compilation turns the busiest parts of a program into machine code while it runs, combining an interpreter's quick start with compiled speed.
- A JIT compiler turns frequently run code into machine code while the program runs.
- Programs start in an interpreter, and hot code is compiled once it proves worth it.
- What it sees at runtime lets a JIT specialize code, and deoptimize when a guess fails.
- 33Lambda Function
- A lambda function is a small function written inline without a name, usually passed straight to another function such as a sorting or filtering helper.
- A lambda is a function without a name, defined inline where it is used.
- Syntax varies: => in JavaScript and C#, -> in Java, lambda in Python.
- Lambdas usually capture surrounding variables, which makes them closures.
- 34Library
- A library is a collection of ready-made code, such as functions and classes, that a program calls to do common jobs without writing that code itself.
- A library is reusable code your program calls to do common jobs.
- Each language has a standard library; package managers add third-party ones.
- You call a library, while a framework calls your code.
- 35Loop
- A loop is a control structure that repeats a block of code, either a set number of times, once for each item in a collection, or while a condition stays true.
- A loop repeats a block of code; each repetition is called an iteration.
- for loops count, while loops check a condition, and for-each loops visit every item in a collection.
- break exits a loop early, and continue skips to the next iteration.
- 36Memoization
- Memoization is an optimization technique that stores the results of function calls and returns the saved result when the same inputs occur again.
- Memoization saves a function's results and reuses them for repeated inputs.
- It is safe only for pure functions with no side effects.
- It can turn exponential recursive algorithms, like naive Fibonacci, into linear ones.
- 37Method
- A method is a function that belongs to an object or class and is called on it, so it can read and change that object's data, as in user.rename("Ada").
- A method is a function that belongs to an object or class.
- It reaches its object through this (or self in Python and Ruby).
- Instance methods work on one object; static methods belong to the class.
- 38Null
- Null is a special value that means "no value here", used when a variable deliberately refers to no object or data at all instead of holding something real.
- Null represents the deliberate absence of a value.
- Using null as if it were a real object causes some of the most common runtime errors.
- Kotlin, Swift, TypeScript and C# can track nullable types at compile time.
- 39Object
- An object is a bundle of related data and behavior: values in named fields, often called properties, and functions that work on them, called methods.
- An object groups related data (properties) and behavior (methods).
- In class-based languages an object is an instance of a class.
- JavaScript also has object literals and prototype-based inheritance.
- 40OOPObject-Oriented Programming
- OOP, or object-oriented programming, is a way of structuring code around objects that bundle related data together with the functions that act on that data.
- OOP structures code around objects that combine data and behavior.
- A class is a blueprint; an object is an instance created from it.
- The four pillars are encapsulation, abstraction, inheritance, and polymorphism.
- 41Package Manager
- A package manager is a tool that installs, updates and removes software packages and their dependencies, resolving versions automatically.
- A package manager installs packages and resolves their dependencies.
- It reads a manifest and downloads from a registry such as npm or PyPI.
- Language managers handle libraries; system managers install programs.
- 42Parallelism
- Parallelism is running several computations at literally the same time, on multiple CPU cores, GPUs or machines, so a large job finishes faster.
- Parallelism runs computations at the same time on multiple processors.
- Data parallelism splits the data; task parallelism runs different tasks.
- CPU-bound Python work usually uses processes because of the GIL.
- 43Parameter
- A parameter is a named input in a function's definition, and an argument is the actual value passed in that place when the function is called.
- Parameters are the named inputs in a function definition.
- Arguments are the values passed in when the function is called.
- Arguments can be positional, named, defaulted or variadic.
- 44Pointer
- A pointer is a variable that stores the memory address of another value instead of the value itself, letting code read or change that data indirectly.
- A pointer stores a memory address rather than the data itself.
- Dereferencing a pointer reads or writes the value at that address.
- Pointers avoid copying large data and make linked data structures possible.
- 45Polymorphism
- Polymorphism is the ability of code to work with values of different types through one shared interface, with each type supplying its own behavior.
- Polymorphism means one interface, many implementations.
- Subtype polymorphism picks the right overridden method at runtime based on the object's actual type.
- Method overloading and generics are other forms of polymorphism.
- 46Promise
- A promise is an object that represents the eventual result of an asynchronous operation, letting code react to success or failure once the work completes.
- A promise represents a value that will be available in the future.
- It starts pending, then becomes either fulfilled with a value or rejected with an error.
- Use .then(), .catch(), and .finally() to handle the outcome.
- 47Pure Function
- A pure function always returns the same output for the same input and has no side effects, meaning it does not change anything outside itself.
- A pure function returns the same output for the same input, every time.
- It has no side effects: no changes to outside state, arguments, files or the network.
- Pure functions are easy to test, cache and run in parallel.
- 48Recursion
- Recursion is a technique in which a function solves a problem by calling itself on smaller versions of the same problem until it reaches a simple base case.
- A recursive function calls itself on a smaller version of the problem.
- It must have a base case that stops the recursion.
- Each call uses space on the call stack; very deep recursion can cause a stack overflow.
- 49Regular Expression
- A regular expression, or regex, is a pattern written in a compact syntax that describes text to search for, validate, extract or replace within strings.
- A regex is a pattern that describes the shape of text to match.
- Character classes, quantifiers, anchors and groups are its main building blocks.
- It is used for searching, validating, extracting and replacing text.
- 50Scope
- Scope is the region of a program where a name, such as a variable or function, is visible and can be used, which decides what each line of code can reach.
- Scope decides where in the code a variable or function name can be used.
- Most languages use lexical scope, which is based on where code is written.
- Inner scopes can see outer variables, but outer code cannot see inside.
- 51SDKSoftware Development Kit
- An SDK (software development kit) is a package of tools, libraries, documentation and examples for building software for a particular platform or service.
- An SDK bundles libraries, tools, docs and examples for one platform or service.
- Platform SDKs, like Android's, include build tools and emulators.
- Service SDKs wrap an API in native functions, with auth and retries built in.
- 52Stack Trace
- A stack trace is the list of function calls in progress when an error happened, from the line that failed back to where the program started.
- A stack trace lists the function calls in progress when an error happened.
- Each line, or frame, names a function, a file and a line number.
- Most languages put the failing line first; Python puts it last.
- 53Static Typing
- Static typing means the types of variables and expressions are checked before the program runs, usually by the compiler, so many type errors are caught early.
- Types are checked before the program runs, usually at compile time.
- Java, C#, Go, Rust, Kotlin and TypeScript are statically typed.
- Type inference means many types don't have to be written by hand.
- 54String
- A string is a data type that represents text as an ordered sequence of characters, such as a name, a sentence, a URL, or the contents of a file.
- A string is an ordered sequence of characters used to represent text.
- String literals are written in quotes, and characters are accessed by an index starting at 0.
- Characters are stored as numbers using Unicode encodings such as UTF-8 and UTF-16.
- 55Type Inference
- Type inference is a compiler feature that works out the type of a variable or expression automatically, so you don't have to write every type annotation.
- Type inference lets the compiler determine types without explicit annotations.
- Inferred code is still statically typed and checked before it runs.
- Types are inferred from initial values, return statements, generic arguments, and context.
- 56Variable
- A variable is a named storage location in a program that holds a value, such as a number or a piece of text, which the code can read and change as it runs.
- A variable is a name that points to a stored value.
- Its value can usually be read and changed while the program runs.
- Type controls what kind of data it holds; scope controls where it is visible.