Programming Fundamentals — Core Concepts Before Languages
Status: Active | Last Updated: 2026-08-29 Category: Basics — Programming Concepts Prerequisites: None (entry-point concept article) Tags: programming, variables, functions, loops, conditionals, data-structures, debugging, version-control, concepts Estimated Time: 3-4 hours (Self-paced, includes lab time)
Summary
Programming is not syntax — it is problem decomposition: identifying inputs, defining transformations, and specifying outputs. Before learning a specific language, you must understand variables, functions, control flow, data structures, and debugging. These concepts transfer verbatim between TypeScript, Python, Go, Rust, C++, and PHP.
What You'll Learn (Core Competencies)
- Define variables, functions, and data structures in any language
- Write conditional logic (if/else, switch) and iteration (loops, recursion)
- Separate problems into reusable functions with clear inputs/outputs
- Use basic debugging techniques (print/log, step-through, error reading)
- Understand version control concepts (commit, branch, merge)
Table of Contents
- What Programming Is
- Variables, Types, and Assignment
- Functions and Problem Decomposition
- Control Flow — Conditionals and Loops
- Data Structures — Arrays, Maps, and Collections
- Debugging and Reading Errors
1. What Programming Is
Programming translates a human problem into instructions a machine executes. The universal pattern is: input → transformation → output.
Every program, regardless of language, starts with this loop:
- Receive input (user, file, sensor, network)
- Process the input using logic
- Produce output (display, file, network response)
- Handle errors when expected conditions fail
The language (TypeScript, Python, Go) is only the syntax for expressing these steps. The concepts — variables, functions, loops — are identical. Mastering them once lets you learn any language faster.
Key insight: If you can describe a problem in plain English ("get the user's name, check if it's long, return a greeting"), you can translate it to code.
2. Variables, Types, and Assignment
A variable holds data. The fundamental operations are:
- Declare — create the container
- Assign — put a value into it
- Read — use the value later
- Reassign — replace the value
Every value has a type: text (string), number (integer / float), true/false (boolean), or a structured group (object/array). Type errors (using a number where text is expected) are the most common beginner mistake. Learn to read error messages — they almost always tell you which variable is the wrong type.
name = "fogserv" # string
count = 42 # integer
is_active = True # boolean
items = ["a", "b"] # array / list
Assignment is not equality. = puts a value in. == compares. Do not confuse them.
3. Functions and Problem Decomposition
A function is a named block that takes inputs, does work, and returns an output. Functions make code reusable and testable.
The contract of a function is its signature: what it takes and what it returns. Always design the signature first:
def greet(name: str) -> str:
return f"Hello, {name}"
Good function rules:
- One purpose (don't mix "save to DB" and "format output" in the same function)
- Small (10-30 lines; split when longer)
- Named clearly (
calculate_totalnotdo_thing)
4. Control Flow — Conditionals and Loops
Programs branch. Use conditionals (if, else if, else, switch) when choices depend on data. Use loops (for, while) when work repeats.
Common mistake: infinite loops. Always ensure the loop has a condition that eventually becomes false. Common anti-pattern: modifying the loop counter inside the loop body in a non-obvious way.
total = 0
for item in items: # for-each: clean for collections
total += item # accumulate
Conditional example:
if age >= 18:
status = "adult"
elif age >= 13:
status = "teen"
else:
status = "child"
5. Data Structures — Arrays, Maps, and Collections
Data structures organize related values:
- Array / List: ordered sequence, indexed by position
- Map / Dictionary / Object: key-value pairs (name → value)
- Set / HashSet: unordered unique items
Choosing the right structure affects lookup speed. Searching an array of 100 items is slow; a map lookup is instant. Learn the trade-off — not every problem needs a map, not every list needs sorting.
users = [
{"id": 1, "name": "Alice"},
{"id": 2, "name": "Bob"},
]
6. Debugging and Reading Errors
Errors are not failures — they are the computer's way of telling you exactly what went wrong. Read them top to bottom. The first line usually says which file and line; the remaining lines explain the cause (wrong type, missing value, undefined name).
Basic debugging steps:
- Read the error message carefully
- Check line number — is it the line you edited, or a library?
- Print/log the values of variables near the error
- Isolate: comment out half the code, test, uncomment half — find the failing section
- Check prerequisites — is the file saved? Is the environment correct?
Skill, not talent: experienced developers make the same errors. The difference is they read errors faster and fix them systematically.
Next Steps
After understanding these concepts:
- kb/languages/typescript-basics — Apply fundamentals with TypeScript syntax
- kb/basics/command-line-essentials — Use CLI to run and test code
- kb/basics/day1-new-developer — Full onboarding sequence
Change Log
2026-08-29
- Created programming-fundamentals.md as the prerequisite article referenced by language lessons
- Covers variables, functions, control flow, data structures, debugging
- No code-block execution dependency — conceptual only