Paradigm Families
A comparative map of how programming styles differ — in state, control, evaluation and composition — and which problems each one fits. Interviewers ask so you justify a style, not a favourite.
on this pageshowhide
explore
- Imperative Programming5 questions
- Declarative Programming4 questions
- Logic Programming5 questions
- Multi-Paradigm Trade-offs5 questions
- Procedural Style5 questions
- Classification Axes5 questions
- Constraint Solving5 questions
- Dataflow and Array Styles5 questions
- Styles Under Concurrency5 questions
questions
page 2 of 2A rota solver returns a legal roster in seconds but takes hours to return the one with fewest weekend shifts - why?
basics
~20 sSatisfaction stops at the first roster that satisfies every rule. Optimisation must also prove nothing cheaper exists, which means refuting the whole remaining space under a bound. The proof, not the discovery, is what takes hours.
A handler running during a recalculation pass edits a cell and starts another pass — what can go wrong?
basics
~20 sThe nested pass sees a graph that is half-updated, so the handler reads values no settled state ever had. It can also re-trigger itself without bound, and its edit is a dependency the engine never recorded.
A dataflow recalculation has many independent cells but barely speeds up on more workers — what explains that?
basics
~20 sIndependence licenses concurrency; it does not create it. Speedup is bounded by the longest dependency chain through the graph, by per-cell work too small to repay scheduling, and by hidden edges that serialise cells the engine believed were independent.
A declarative description is correct, yet the engine keeps choosing a slow or wrongly ordered plan — how do you intervene without giving up the paradigm?
basics
~20 sPrefer stating a fact the engine was missing, such as a dependency or a narrower property, over dictating strategy. A hint is the next resort and pins you to today's engine; a literal step is last, forfeiting derived order and idempotence.
A long-lived order service is half-migrated from mutable records to immutable values, with both styles live - why is that state more expensive than either endpoint?
basics
~20 sBoth bills, neither guarantee. Seams appear wherever the front line runs instead of at one edge, invariants hold in only part of the graph so nobody can rely on them, and every reviewer carries two models.
Two reviewers call opposite styles idiomatic for the same module in a language that supports both - how do you settle it?
basics
~20 sCost settles it, not taste. Once a language supports several styles, idiomatic means what this codebase decided plus what the surrounding module already does, so the fix is a written rule naming which regions use which style.
Two payroll routines both write a module-level running-total ledger — what does that shared state cost you when a third routine joins?
basics
~20 sModule-level state acts as an argument no signature declares. A third writer couples silently to the other two, turns call order into an unwritten contract, and forces every test, retry and concurrent run to reset the ledger first.
How do you decide whether converting a long-lived service's mutable core to immutable values is worth its cost to the teams that own it?
basics
~20 sName a defect class you can count, check it concentrates in that core, price the boundary plus the review tax, scope to a region closeable in one planning cycle, weigh cheaper partial moves, and set a stop rule.
On the evaluation axis, what can you no longer conclude from where an expression appears in the text?
basics
~20 sWhen - or whether - the work happens. Under deferred evaluation, writing an expression only records how to produce a value; the work runs at the point some other code demands it, which may be far away or never.
In a stack-based concatenative pipeline, what makes writing two words next to each other compose them?
basics
~10 sA single shared operand stack. Each word takes its inputs off the top and leaves its outputs there, so the next word written finds exactly what the previous one left: juxtaposition is composition.
When does evaluating a pure transform over partitioned chat history in parallel actually pay?
basics
~20 sIt pays when partitions are independent, each large enough to dwarf the cost of splitting and merging, reasonably even in size, and combined by an associative merge. Skew and the sequential fraction, not worker count, set the floor on wall-clock time.
Two constraint models of the same support rota differ only in encoding, yet one solves in seconds and the other thrashes for hours - what makes the difference?
basics
~20 sSolve time is a property of the encoding, not only of the problem. A rule stated as one group constraint prunes far more than the equivalent pairwise pile, interchangeable people multiply identical rosters, and a poor variable order makes the search rediscover one conflict everywhere.
What does the von Neumann bottleneck critique claim is wrong with programming in the imperative style?
basics
~20 sThe critique says a narrow word-at-a-time channel between store and processing unit shaped the languages built on it, so programs became statement-at-a-time recipes with no useful algebra for combining them and a meaning that depends on a large implicit state.
Two recursive containment rules have identical logical readings, but one fails to terminate - how can clause and goal order decide that?
basics
~20 sOrder changes nothing about what the rules mean and everything about how the engine looks for it. Under a fixed depth-first, top-to-bottom strategy, a recursive goal placed before the goal that would narrow it descends forever.
showing 31–44 of 44