Jump to content

Fundamentals of Programming

From IdeaWazaWiki

Fundamentals of programming are the small set of ideas that sit underneath every programming language: how values are stored, how instructions are ordered, how decisions and repetition are expressed, and how a large problem is broken into pieces a machine can carry out. This page serves self-taught beginners, instructors, and AI agents that need a compact map of the subject. The ideas carry over between languages, whether the first one is Python, JavaScript, or a spreadsheet macro language such as VBA.

About This Course

This course is designed to provide a fundamental understanding of programming to the students and involves basic hands-on work with macro programming in VBA for Excel. For those students without Excel please contact the instructor for alternate coursework.

Credits: 3.0

The Instructor

The primary instructor for this course is: Ryan, however anyone is free to edit the associated course pages and contribute as they feel so inclined. If you wish to be the instructor for your own class feel free to do so, a tutorial on how to do so is coming soon.

Core concepts

  • Values and types: numbers, text, and true or false, each with its own operations.
  • Variables: names for stored values that a program can update.
  • Expressions: combinations of values and operators that produce a new value, such as price * quantity.
  • Control flow: the order statements run in, shaped by conditionals and loops.
  • Functions: named, reusable blocks of code that take inputs and return results.
  • Data structures: lists, dictionaries, sets, and records for organizing many values at once.
  • Input and output: reading from keyboard, files, or network, and writing results.
  • Errors and debugging: reading error messages, forming a guess about the cause, and testing it.
  • Decomposition: splitting a task into smaller tasks until each one is easy to write.
  • Abstraction: hiding detail behind a clear interface so the rest of the program can ignore it.
  • Testing: checks that confirm code does what it claims, rerun after every change.
  • Version control: recording each change with Git so mistakes can be undone.

How to learn programming

Programming is learned by doing. A good rhythm is to read a short explanation, type the example by hand, run it, then change one thing and predict the result before running it again. When the prediction is wrong, that gap is where learning happens.

Reading and modifying existing code matters as much as writing new code. Practice opening a small open source project, finding where a particular behavior lives, and changing it on purpose.

Debugging is a skill in its own right: reproduce the problem, shrink it to the smallest failing input, inspect values at each step, and change one thing at a time.

Small finished projects teach more than large abandoned ones. Related lessons on this wiki include Introduction to and setup of Python, Truth and flow control in Python, and the archived book chapters at Archive:Think Python.

Why fundamentals matter more with AI coding assistants

AI coding assistants can produce working code from a plain language request, so why learn the basics? Because the human role shifts from typing code to directing and checking it, and both depend on fundamentals.

A request to an assistant is a specification. One that names the inputs, expected outputs, edge cases, and error behavior tends to produce something usable, and writing it is the same skill as designing a function.

Generated code is often plausible but wrong. It may fail on an empty list, confuse inclusive and exclusive ranges, silently swallow an error, or call a library function that does not exist. Catching this takes fluent code reading and tests that would expose the failure. Verification, not generation, becomes the bottleneck. Anyone who lets an agent run code also needs to see what a script will delete, send, or install before it runs; see Sovereign AI agents and prompt injection.

Programming for everyday living

Programming lets one person automate the repetitive parts of ordinary life. A short script can total household spending from a bank export, back up photos, log garden watering, or turn a messy spreadsheet into a clean report. Each saves a little time every week and puts the person in control of their own tools and data, themes explored in Local-first software and data ownership, Open-source software that should exist, and Community-run AI.

Example

This Python program uses variables, a list, a loop, a conditional, a function, and a test. It totals expenses and flags any above a limit.

def summarize(expenses, limit):
    # Return the total and a list of items that cost more than the limit.
    total = 0
    large = []
    for name, amount in expenses:
        total = total + amount
        if amount > limit:
            large.append(name)
    return total, large

items = [("rent", 1200), ("food", 340), ("bus pass", 60)]
print(summarize(items, 300))

# A simple test: an empty list should give a total of zero.
assert summarize([], 100) == (0, [])

Suggested practice projects

  • A number guessing game that uses a loop and gives higher or lower hints.
  • A to-do list stored in a text file, with commands to add, list, and remove items.
  • A script that renames every photo in a folder by the date it was taken.
  • A budget summarizer that reads a CSV export and totals spending by category.
  • A unit converter with tests for each conversion.
  • A spreadsheet macro that cleans a weekly report.

Discussion questions

  • Which concept here was hardest to grasp, and what made it click?
  • Why might two programs with the same output differ greatly in quality?

Essay ideas

  • Programming as literacy: what changes when ordinary people automate their own tasks.
  • Specification, testing, and review as core skills in an era of generated code.

AI prompt ideas

  • "Give me five Python loop exercises of rising difficulty, without solutions, then review my answers."
  • "Here is my function. Do not rewrite it; ask questions that help me find the bug."
  • "Explain lists versus dictionaries using a household budget example."

Readings

See also