Skip to main content

Career & Learning

Programming Fundamentals: The Skills Every Developer Should Learn First

The layer beneath every framework: types, control flow, functions, data structures, Big-O, OOP, error handling, debugging, Git, readable code and testing, with runnable JavaScript.

  • By Ahmed Alaydi
  • Published
  • Updated
  • 23 min read
On this page

There is a specific kind of developer who can build a working feature in a familiar framework but stalls the moment something unusual happens. The code runs until it does not, and then there is no way in. Almost always the gap is not framework knowledge — it is the layer underneath: how data is shaped, how logic is structured, what the code is actually costing, and how to investigate when reality disagrees with expectation.

This article covers that layer, one level deeper than the programming roadmap, which lists these topics in learning order. Each section shows the idea in short JavaScript you can paste into Node.js or a browser console, with the output you should expect. JavaScript is only the vehicle: the same ideas hold in Python, PHP, Java or C#, and only the syntax changes. Where something depends on a language or tool version, it is marked; the rest does not expire when the ecosystem shifts.

Thinking in data: values, variables and types

Most programs are, at heart, a transformation: some data comes in, something happens to it, some data goes out. Developers who think this way write clearer code than those who think in terms of steps to perform, because the shape of the data usually tells you what the code should look like.

Before writing a function, it is worth being able to answer three questions precisely: what exactly comes in, what exactly goes out, and what is true before and after. That habit alone eliminates a surprising number of bugs, because most bugs are a mismatch between what a function assumed and what it actually received.

Variables are names, not boxes

A variable is a name bound to a value. In modern JavaScript, declare with const by default and let when the name genuinely has to be reassigned; var is the older, function-scoped form and is best left out of new code. The misconception worth fixing early is that const makes a value immutable. It does not: it stops the name from being pointed at something else, but an object or array behind it can still change. MDN puts it precisely: const creates an immutable binding, not an immutable value.

The second idea is the difference between copying a value and sharing a reference. Primitives — numbers, strings, booleans — are copied when assigned. Objects and arrays are not: assigning one gives you a second name for the same object. A large share of "the data changed by itself" bugs are exactly this.

javascript
const scores = [90, 75];
const sameScores = scores;    // a second name for the SAME array
sameScores.push(60);
console.log(scores);          // [ 90, 75, 60 ] — "scores" changed too

const copied = [...scores];   // a new array with the same items
copied.push(100);
console.log(scores.length);   // 3 — the original is untouched

let total = 10;
let other = total;            // numbers are copied
other += 5;
console.log(total);           // 10

// scores = [];               // TypeError: Assignment to constant variable.
const stopped the reassignment on the last line, but not the push. The spread copy is shallow: nested objects inside it are still shared.

Types are documentation that the machine checks

Whether a language checks types at compile time or at runtime, thinking about types is not optional. A value that might be a number, might be a string, or might be missing entirely is a value nobody can reason about. In dynamically typed languages this discipline has to come from you; in typed languages the compiler enforces part of it. Either way, being precise about what a value can be is what makes code predictable.

JavaScript is dynamically typed and also converts types silently, which is where many beginner bugs come from. Anything read from a form field, a URL or a text file arrives as a string, even when it looks like a number:

javascript
const quantity = "2";                // e.g. the value of an <input>
console.log(quantity + 1);           // 21  — the string "21": + joined two strings
console.log(quantity - 1);           // 1   — - converted the string to a number
console.log(Number(quantity) + 1);   // 3   — convert once, explicitly

console.log(0 == "");                // true  — loose equality converts types
console.log(0 === "");               // false — strict equality does not
console.log(0.1 + 0.2 === 0.3);      // false — binary floating point: 0.30000000000000004
Three rules follow: convert input once, where it enters the program; compare with ===; and keep money in integer minor units (cents, piastres), not floating-point amounts.

Tooling can carry part of this load. TypeScript adds static types to JavaScript and reports mismatches before the code runs. Python's type hints work differently: the Python runtime does not enforce them; they are read by separate type checkers and editors. In both cases the habit comes first and the tool second.

Conditions and loops

Conditions and loops are where a program branches and repeats, and most of what makes them hard to read is structure rather than syntax. Deep nesting is the most common problem. Code that drifts several levels to the right is hard to follow because the reader has to hold every enclosing condition in mind at once. Handling invalid cases first and returning early keeps the main path flat and readable.

javascript
const save = (post) => ({ ...post, published: true }); // stand-in for real persistence

// Nested: the real work is buried three levels deep.
function publishNested(post, user) {
  if (user) {
    if (user.canPublish) {
      if (post.isComplete) {
        return save(post);
      }
    }
  }
  return null;
}

// Guarded: invalid cases leave first, the main path stays flat.
function publishGuarded(post, user) {
  if (!user) return null;
  if (!user.canPublish) return null;
  if (!post.isComplete) return null;

  return save(post);
}

console.log(publishGuarded({ isComplete: true }, { canPublish: true }));
// { isComplete: true, published: true }
Same behaviour, same language. The second version can be read top to bottom.

Truthiness: when 0 is treated as missing

In JavaScript, if (value) does not test whether a value exists; it tests whether it is truthy. false, 0, "", null, undefined and NaN are all falsy. That shortcut is fine until a legitimate value happens to be one of them:

javascript
function stockLabel(stock) {
  if (!stock) return "Unknown";           // bug: 0 is a real answer
  return `${stock} in stock`;
}
console.log(stockLabel(0));               // "Unknown" — wrong

function stockLabelFixed(stock) {
  if (stock === undefined || stock === null) return "Unknown";
  return stock === 0 ? "Out of stock" : `${stock} in stock`;
}
console.log(stockLabelFixed(0));          // "Out of stock"

const shown = 0 ?? "Unknown";             // ?? only replaces null and undefined
console.log(shown);                       // 0
Say what you mean: compare against null/undefined explicitly, or use ?? instead of || for defaults.

Loops: pick the one that states your intent

Use for...of when you want each item, a classic indexed for when you need the index or an unusual step, while when you cannot know the number of iterations in advance, and array methods such as map and filter when you are producing a new collection from an old one. Most loop bugs are boundary bugs — starting or stopping one step off — and the loops that have no index to get wrong avoid them entirely.

javascript
const items = ["a", "b", "c"];

for (let i = 0; i <= items.length; i++) {
  console.log(items[i]);        // a, b, c, then undefined — one step too far (< not <=)
}

for (const item of items) {
  console.log(item);            // a, b, c — no index to get wrong
}

const upper = items.map((item) => item.toUpperCase());
console.log(upper);             // [ 'A', 'B', 'C' ]

const withoutB = items.filter((item) => item !== "b");
console.log(withoutB);          // [ 'a', 'c' ] — safer than splicing inside a loop

Two other classics: a while loop whose condition never changes inside the body, which runs forever, and removing items from an array by index while looping over it, which silently skips the element after each removal. Building a new array with filter avoids the second one by construction.

Functions and scope

A function should do one identifiable thing and be nameable without the word 'and'. If naming it honestly requires a conjunction, it is probably two functions. This is not aesthetic preference: small, single-purpose functions are easier to test, easier to reuse, and dramatically easier to debug, because when something breaks the search space is smaller.

The second distinction is between pure functions and side effects. A pure function computes its result only from its inputs and changes nothing outside itself, so the same input always gives the same output — which makes it trivial to test. Side effects (writing to a database, changing the page, modifying an argument) are necessary, but they should sit at the edges of the program and be obvious from the function's name. The dangerous ones are the side effects you did not know a function had:

javascript
function sortedPrices(prices) {
  return prices.sort();                 // two bugs: string order, and it mutates the input
}
const prices = [10, 9, 1];
console.log(sortedPrices(prices));      // [ 1, 10, 9 ] — "10" sorts before "9" as text
console.log(prices);                    // [ 1, 10, 9 ] — the caller's array changed too

function sortedPricesFixed(prices) {
  return prices.toSorted((a, b) => a - b);  // new array, numeric comparison
}
const fresh = [10, 9, 1];
console.log(sortedPricesFixed(fresh));  // [ 1, 9, 10 ]
console.log(fresh);                     // [ 10, 9, 1 ] — untouched
Without a comparator, sort() compares items as strings, and it sorts in place. toSorted() (ES2023; Node.js 20+ and current browsers) returns a copy; on older runtimes use [...prices].sort((a, b) => a - b).

Scope and closures

Scope answers the question "where does this name exist?". Variables declared with let and const are block-scoped: they exist only inside the { } where they were declared. A function also keeps access to the variables of the scope it was created in, even after that scope has finished running. That is a closure, and it is how JavaScript gives you private state without a class.

javascript
function makeCounter() {
  let count = 0;                 // lives in makeCounter's scope
  return () => {
    count += 1;
    return count;
  };
}

const next = makeCounter();
console.log(next());             // 1
console.log(next());             // 2
console.log(typeof count);       // "undefined" — not visible out here

// var is function-scoped: all three callbacks share ONE i.
for (var i = 0; i < 3; i++) setTimeout(() => console.log("var", i));  // var 3, var 3, var 3
// let creates a new j for each iteration.
for (let j = 0; j < 3; j++) setTimeout(() => console.log("let", j));  // let 0, let 1, let 2
The var loop is a classic interview question for a reason: it is the bug you get when a variable lives in a wider scope than you thought.

The practical rule is to keep every variable in the smallest scope that works. A variable visible to a whole file can be changed by anything in that file, and every extra place that can write to it is an extra suspect when it ends up holding the wrong value.

Data structures and the cost of choices

You will rarely implement a linked list at work. You will constantly decide how to store and look things up, which is the same decision wearing different clothes. The practical question is always: what operation am I doing most often, and is my current structure good at it?

Most frequent operationStructureIn JavaScriptWatch out for
Read by position, iterate in orderArray[], push, items[i]includes and find scan item by item until they hit a match
Look up by a unique keyHash mapMap (or a plain object for a fixed record shape)Object keys are always strings or symbols; Map keys can be any value
Check membership, remove duplicatesSetnew Set(items), set.has(x)Objects are compared by identity: two equal-looking objects are two members
Process in arrival orderQueueArray with push and shiftBackground jobs that must survive a restart need a persistent queue, not an in-memory array
Undo, nesting, backtrackingStackArray with push and popRecursion uses the call stack; very deep recursion throws a RangeError
Parent–child data of any depthTreeNested objects, or rows with a parentIdWalking it means recursion or an explicit stack
Choose by the operation you perform most, not by the data you happen to have.

The classic mistake is a nested loop over two collections that each grow. It is invisible on test data and painful in production, and once you have the habit of noticing it, you catch it while writing rather than after a support ticket. The next section shows exactly what it costs.

Algorithms and Big-O, with a real example

An algorithm is a defined procedure: given this input, these steps produce that output. Day to day you rarely invent new ones; you choose between approaches and lean on built-ins such as sorting, searching and key lookup, whose costs you should know. Big-O is the vocabulary for that cost. It describes how the amount of work grows as the input grows, and it deliberately ignores constant factors. It is a statement about growth, not a stopwatch.

A concrete case: you have a list of orders and a list of customers, and each order needs its customer attached.

javascript
// O(n × m): for each order, scan the customer list.
function attachCustomersSlow(orders, customers) {
  return orders.map((order) => ({
    ...order,
    customer: customers.find((c) => c.id === order.customerId),
  }));
}

// O(n + m): one pass to build an index, then one lookup per order.
function attachCustomersFast(orders, customers) {
  const byId = new Map(customers.map((c) => [c.id, c]));
  return orders.map((order) => ({ ...order, customer: byId.get(order.customerId) }));
}

const customers = [{ id: 1, name: "Sara" }, { id: 2, name: "Omar" }];
const orders = [{ id: 10, customerId: 2 }, { id: 11, customerId: 1 }];
console.log(attachCustomersFast(orders, customers)[0].customer.name);  // "Omar"
Both return the same result. They differ only in how the work grows.

Now count the work. With 10,000 orders and 10,000 customers, the first version calls find once per order, and each find may scan up to all 10,000 customers: up to 100 million comparisons. The second version walks the customers once to build the map (10,000 steps) and then does one lookup per order (another 10,000): roughly 20,000 operations. Double both lists and the first version's worst case quadruples, while the second only doubles. That is what O(n × m) — O(n²) when both sizes are similar — versus O(n + m) means in practice. On ten test records you will never see the difference, which is exactly why this code survives into production.

There is a trade-off, as always. The map costs extra memory and a moment to build. For a single lookup in a short array, find is simpler and perfectly fine. Big-O tells you what will hurt as data grows; it does not tell you which version is faster on small inputs.

A handful of growth classes cover almost everything you will meet:

  • O(1), constant: items[i], map.get(key). The size of the data does not matter.
  • O(log n), logarithmic: binary search over sorted data. Each step halves what is left, so a million sorted items need about 20 steps, because 2²⁰ is just over a million.
  • O(n), linear: one pass, such as includes, filter or a single loop.
  • O(n log n): efficient general-purpose comparison sorting, which is what built-in sort functions use in practice.
  • O(n²), quadratic: a loop inside a loop over the same growing data. Fine for dozens of items, painful for tens of thousands.

In real applications the biggest wins usually are not algorithmic anyway — they come from not doing the work at all. Querying the database once instead of once per row inside a loop (the "N+1 query" problem) is one of the most common performance fixes in web development, and it is a complexity insight wearing an ORM costume.

OOP in practice, not in theory

The four pillars — encapsulation, inheritance, polymorphism, abstraction — are usually taught as definitions to memorize. What matters more is knowing what each one buys you and what it costs.

Encapsulation is the one with the clearest payoff. When internal details are private, you can change them without auditing the whole codebase, because nothing outside was allowed to depend on them. Every public property is a promise you will find hard to take back later. It also gives you one place to enforce rules, so invalid states cannot be created from outside:

javascript
class Account {
  #balance = 0;                       // private: only code inside the class can touch it

  deposit(amount) {
    if (!Number.isInteger(amount) || amount <= 0) {
      throw new RangeError("Deposit must be a positive whole number of cents");
    }
    this.#balance += amount;
  }

  get balance() {
    return this.#balance;             // read-only from outside: there is no setter
  }
}

const account = new Account();
account.deposit(5000);
console.log(account.balance);         // 5000
// account.#balance = 1;              // SyntaxError: private field outside its class
// account.deposit(-10);              // RangeError: Deposit must be a positive whole number of cents
Private # fields are part of the language since ES2022 and work in all current browsers and Node.js.

Inheritance is the one beginners overuse. It creates the tightest coupling available in object-oriented code: a change in a base class reaches every descendant. It fits genuine 'is a' relationships and little else. When you are tempted to inherit in order to reuse a method, composition — holding an instance of something and delegating to it — is usually the better answer.

Polymorphism earns its place when you have several things that must be treated uniformly by calling code. Payment methods, notification channels, export formats, storage backends — in each case the caller should not contain a growing chain of conditionals asking which variant it has.

javascript
class EmailChannel {
  send(user, text) {
    return `Email to ${user.email}: ${text}`;
  }
}

class SmsChannel {
  send(user, text) {
    return `SMS to ${user.phone}: ${text}`;
  }
}

// Composition: a Notifier HAS channels; it does not inherit from them.
class Notifier {
  constructor(channels) {
    this.channels = channels;
  }

  notify(user, text) {
    // Polymorphism: no if/else asking which kind of channel this is.
    return this.channels.map((channel) => channel.send(user, text));
  }
}

const notifier = new Notifier([new EmailChannel(), new SmsChannel()]);
const user = { email: "sara@example.com", phone: "+20 100 000 0000" };
console.log(notifier.notify(user, "Order shipped"));
// [ 'Email to sara@example.com: Order shipped', 'SMS to +20 100 000 0000: Order shipped' ]
Adding a push-notification channel means writing one new class with a send method. Notifier does not change.

When a class is the wrong tool

A class with one method and no state is a function wearing a costume. A class that only holds data is a plain object. A class full of static helpers is a module. And a pipeline that takes data in and returns new data — filtering, grouping, formatting — usually reads better as a chain of small functions than as a set of objects calling each other. Reach for classes when you have state with rules attached, or several interchangeable implementations behind one interface; deep inheritance trees are almost always a sign the model went wrong.

Error handling: failing clearly

In real programs errors are routine: input is malformed, networks drop, files go missing. The goal is not to prevent every error but to make each one fail clearly, in the right place, with enough information to fix it. It helps to separate two kinds. Expected failures — invalid input, a record that does not exist — are part of normal flow and deserve a deliberate response. Bugs — a value that should never be undefined but is — should fail loudly so you find them.

Validate at the boundary and throw early, with a specific error type and a message that includes the offending value:

javascript
function parseQuantity(raw) {
  const value = Number(raw);
  if (!Number.isInteger(value) || value < 1) {
    throw new RangeError(`Invalid quantity: "${raw}"`);
  }
  return value;
}

console.log(parseQuantity("3"));      // 3

try {
  parseQuantity("2.5");
} catch (error) {
  console.error(error.name, error.message);   // RangeError Invalid quantity: "2.5"
}
Number("") is 0 and Number("abc") is NaN; both are rejected by the same check.

Catch an error only where you can do something useful with it: show the user a message, retry, fall back to a default, or add context and rethrow. An empty catch block is the worst option of all — the error disappears and the program carries on in a state nobody planned for.

javascript
// Swallowed: the order silently isn't saved, and nothing tells you why.
try {
  saveOrder(order);
} catch (error) {}

// Handled: add context, keep the original error attached for the logs.
try {
  saveOrder(order);
} catch (error) {
  throw new Error(`Could not save order ${order.id}`, { cause: error });
}
The cause option (ES2022) has been available across browsers since 2021 and is supported in current Node.js.

Asynchronous errors

Two traps catch almost everyone in asynchronous code. First, try/catch only catches a rejected promise that you await inside the try; a promise you start and forget fails somewhere else. Second, `fetch()` does not reject on HTTP error statuses such as 404 or 500 — only when the request itself fails — so you must check response.ok yourself.

javascript
async function loadOrder(id) {
  const response = await fetch(`https://api.example.com/orders/${id}`);
  if (!response.ok) {
    throw new Error(`Loading order ${id} failed: HTTP ${response.status}`);
  }
  return response.json();
}

try {
  const order = await loadOrder(42);
  console.log(order);
} catch (error) {
  console.error(error.message);   // network failures and HTTP errors both land here
}
Top-level await works in ES modules and browser consoles. fetch is built into browsers and Node.js 18+. The URL is a placeholder.

Debugging as a method

Debugging is a skill with a method, not a mood. The method is narrowing: find a case that reliably reproduces the problem, form a specific hypothesis about where reality diverges from expectation, test that one hypothesis, and repeat with the space cut down. Changing several things at once and re-running is not debugging — it removes your ability to learn anything from the result.

Read the error message completely before reacting to it. Stack traces are generous with information: the exception type, the message, the file, the line, and the chain of calls that led there. Beginners often skim to the first familiar word and start guessing. Reading it properly frequently answers the question outright — and it also teaches you that the line where a program fails is not always the line where the mistake is:

javascript
function getDisplayName(user) {
  return user.name.trim();
}

const users = [{ name: " Sara " }];
getDisplayName(users[1]);
// TypeError: Cannot read properties of undefined (reading 'name')
//     at getDisplayName (app.js:2)        <- where it failed
//     at app.js:6                          <- where the mistake is: users[1] does not exist
The wording shown is V8's (Chrome, Node.js), with the trace abbreviated; Firefox and Safari phrase the same TypeError differently. Read it literally: something was undefined while reading name from it — so the problem is user, not name.

Tools beyond console.log

console.log is a fine first tool, especially with labels — console.log({ user, total }) prints names alongside values. But a debugger shows everything at once. Set a breakpoint in the browser's DevTools, or write a debugger; statement in the code, and execution pauses there with every variable in scope visible; you can step line by line and add watch expressions. Chrome's DevTools guide walks through the workflow, and Node.js exposes the same debugger with node --inspect.

  1. Reproduce the bug reliably, with the smallest input that still shows it.
  2. Read the full error and stack trace, top to bottom.
  3. Hypothesise one specific cause, and decide what you would see if it were true.
  4. Test that one hypothesis — a breakpoint, a log line, a changed input — and change nothing else.
  5. Fix the cause, not the symptom, then add a test that would have caught it.

Git: the safety net you use every day

The roadmap lists the Git commands to learn; what makes them click is the model underneath. Git stores your project as a series of snapshots called commits. Between your files and the next commit sits the staging area. As Pro Git puts it, git add means "add precisely this content to the next commit", not "add this file to the project" — which is why a file can have staged and unstaged changes at the same time. git diff shows what you have not staged yet; git diff --staged shows what is about to be committed.

bash
git switch -c fix/quantity-validation   # new branch and switch to it (Git 2.23+; older: git checkout -b)
git status                               # which files changed?
git diff                                 # the exact lines, not yet staged
git add src/cart.js
git diff --staged                        # review what is about to be committed
git commit -m "Reject zero and fractional quantities"
git log --oneline -3                     # the last three commits, one line each
A small, complete change: one branch, one reviewed commit with a message that says what changed.

The habits matter more than the commands. Commit small: one logical change per commit, with a message that says what changed and, when it is not obvious, why. Read git diff --staged before every commit; it is where stray debug logs and accidental files get caught. Work on a branch per change, so main always holds something that works.

Git is also a debugging tool. When something worked last week and does not now, `git bisect` runs a binary search over your history: you mark one commit good and one bad, test the commits it checks out, and it narrows down to the first bad commit. It is the O(log n) idea from earlier, applied to time — and it only works well if your commits are small.

Readable code, minus the dogma

Clean code is code the next person can change safely, and the next person is often you in six months with no memory of your reasoning. A few things carry most of the weight: names that say what something is or does, functions short enough to hold in your head, no duplicated logic that must be changed in several places, no clever tricks that save a line and cost an hour of comprehension, and comments explaining why rather than restating what.

javascript
// Before: correct, and unreadable a week later.
function calc(d) {
  return d.filter((x) => x.a && !x.b).length;
}

// After: the names do the explaining.
function countActiveUnbannedUsers(users) {
  return users.filter((user) => user.isActive && !user.isBanned).length;
}

// A comment earns its place when it explains WHY:
const RETRY_LIMIT = 3; // the payment provider locks the card after 3 failed attempts
Identical logic. The second version needs no comment to tell you what it does. (The retry rule is an illustrative example.)

Let tools settle what tools can settle. A formatter such as Prettier and a linter such as ESLint (or Black and Ruff in Python) end debates about spacing and catch whole classes of mistakes automatically, which leaves code review for the questions only a person can answer.

It is also worth resisting the opposite failure. Abstractions added in advance for flexibility you do not yet need are their own kind of mess — harder to remove than duplication, and they obscure what the code actually does. Write the straightforward version, and let repetition earn the abstraction.

Testing fundamentals

A test is code that runs your code with known input and checks the result. Its real value is not proving the code correct today; it is telling you, in seconds, whether a change you make next month broke something that used to work. That is what lets you refactor without fear. Clicking through the app by hand does not scale past a handful of cases, and nobody repeats it after every change.

javascript
// cart.test.js — run with: node --test
import { test } from "node:test";
import assert from "node:assert/strict";
import { parseQuantity } from "./cart.js";   // the function from the error-handling section

test("accepts whole positive numbers", () => {
  assert.equal(parseQuantity("3"), 3);
});

test("rejects zero, fractions, text and empty input", () => {
  for (const raw of ["0", "2.5", "abc", ""]) {
    assert.throws(() => parseQuantity(raw), RangeError);
  }
});
Node.js's built-in test runner has been stable since Node.js 20. This file uses ES module syntax, so it needs "type": "module" in package.json (or .mjs files), and cart.js must export parseQuantity.

Projects often use Jest or Vitest in JavaScript, and unittest or pytest in Python; the tools differ, the ideas do not. Each test arranges some input, acts by calling the code, and asserts on the result. Name tests after the behaviour they protect, so a failure reads like a sentence.

What to test first

  • Logic, not plumbing. Parsing, calculations, validation and decisions — the pure functions — give the most value per line of test.
  • The edges. Empty input, zero, one item, many items, invalid values, and the exact boundary values (0 and 1 for a minimum of one).
  • Every bug you fix. Write a test that fails because of the bug, then fix the code until it passes. That bug cannot quietly return.
  • Not the framework, and not private details. Testing that the language adds numbers, or how a function works internally, makes tests break on every harmless refactor.

Tests come in levels with a clear trade-off. Unit tests check one function in isolation and run in milliseconds. Integration tests check that pieces work together — your code with a real database, for example — and are slower but closer to reality. End-to-end tests drive the whole application like a user and are the slowest and most brittle. A healthy suite has many fast unit tests and fewer of the expensive kinds. Coverage percentage is a hint, not the goal: a test that runs a line without checking anything meaningful about it adds coverage and no safety.

Misconceptions that cost the most

  • "`const` means the value cannot change." It means the name cannot be reassigned; the object behind it is still mutable.
  • "It is fast on my machine, so it is fast." Your test data is small. Ask how the code grows, not how it feels.
  • "Big-O tells you which code is faster." It tells you how cost grows. On small inputs the "worse" algorithm can be quicker.
  • "Good design means more classes and patterns." Good design means the next change is easy. Sometimes that is a class; often it is a function.
  • "Catching every error makes code robust." Catching errors you cannot handle hides bugs. Robust code fails loudly where it must.
  • "Debugging means trying things until it works." If you do not know why it works now, you do not know when it will break again.
  • "Tests are for later, or for big teams." The best time to add a test is while the behaviour is fresh in your mind — which is now.

How to practice these

These do not come from reading. They come from building something with enough moving parts to punish sloppiness — real data, real users, states you did not plan for — and then maintaining it long enough to meet the consequences of your own decisions. That last part is what most tutorials never provide, and it is where fundamentals stop being vocabulary and become judgment.

A concrete plan: build one small command-line expense tracker in Node.js (or Python), in stages, and keep it in Git from the first day.

  1. Data and types. Read expenses from a JSON or CSV file. Convert amounts to integer cents at the boundary and reject malformed rows with clear error messages.
  2. Functions and control flow. Compute totals per category and per month with small, pure functions, each nameable without "and".
  3. Tests. Before adding features, write node:test tests for parsing and totals, including the edge cases: an empty file, a zero amount, a missing category.
  4. Structures and complexity. Generate a large fake file — say 100,000 rows — and time a nested-loop grouping against a Map-based one with console.time. Write down what you measure on your machine.
  5. OOP where it helps. Add CSV and JSON export behind a shared export method, then honestly compare it with two plain functions. Keep whichever is easier to extend.
  6. Debugging and Git. Have a friend introduce a bug a few commits back, or do it yourself and forget which commit, then find it with git bisect and fix it with a test first.
  7. Maintenance. Two weeks later, add monthly budgets per category. Whatever was hard to change is your most honest code review.

Official resources worth bookmarking

Where to go from here

Pick the one section above that felt least comfortable and write the code for it yourself, without copying — then start the practice project. When the fundamentals hold up under your own project, specialise: choose a track, then follow the frontend, backend or mobile roadmap.

Frameworks will change several times over your career. Knowing what your data looks like, what your code costs, how it fails, and how to prove it still works will not — and that is what lets you pick up each new framework instead of starting over.

Related on this site

Continue reading

All articles
  • A group of people working together around a wooden table with laptops; one, wearing headphones, has code on screen.Career & Learning

    How to Choose Your Programming Track

    Frontend, backend, mobile or full stack? Compare the daily work, test each with a weekend project, and decide with a clear process instead of salary rankings.

    15 min read