Keep a copy of your work. Responses save only in this browser on this device. They are not submitted or synced. Export before changing devices or clearing browser data. Private browsing may not retain your work.
Your work stays in this browser.
An introduction to computing and software
Examine how a precisely stated problem becomes a system whose behaviour can be tested.
What does computing study?
Computing investigates how information can be represented and processed, which problems can be solved by algorithms, and what resources a solution requires. It includes programming, but also mathematical reasoning, data structures, computer systems, networks, security and the interaction between people and technology.
Computer science
You investigate methods and their properties. Can a procedure solve the problem? Does it terminate? How does its cost change as the input grows? What can its results establish?
Software engineering
You turn requirements into dependable software. The work includes clarifying a brief, implementing and reviewing code, testing unusual cases, documenting decisions and maintaining a system as needs change.
How the subject is studied
Expect to move between explanation and construction: read a specification, reason through an algorithm, write a programme, observe a failure and revise your understanding. A programme that runs can still produce the wrong result. Testing requires a reasoned account of what should happen before you inspect what actually happens.
Harvard’s CS50 course outline illustrates the breadth of introductory study, including algorithms, data structures, memory, databases and web programming. This Lab samples a narrower task: investigating and repairing business logic.
Your investigation
A fictional community centre uses a small programme to reserve workshop seats. Its prototype violates the booking rules. You will define expected behaviour, diagnose three logic defects, locate and repair the faulty logic, build tests, then adapt the system to cancellations before writing a handover note.
Your output: a student-designed test pack, three evidence-backed diagnoses, a tested repair, a cancellation extension and an engineering handover. No installation or prior coding experience is required. The workbook teaches the notation and includes a bounded test runner. Allow approximately 3–5 hours; this is an unvalidated planning estimate.
The fixed questions and test outcomes have definite answers. Your written explanations can use different wording if they accurately connect a rule, the faulty behaviour and the correction. This is not a timed coding contest or a career-fit assessment.
Understand the system before changing it
The specification determines correct behaviour. The prototype may disagree.
Workshop Desk: the booking rules
Start each scenario with its stated remaining capacity and no accepted IDs. Process requests in order. State persists within the scenario; start fresh for the next scenario.
IDs are case-sensitive. Supplied IDs are valid. Counts are whole numbers. Decimal counts, missing IDs, networks and simultaneous requests are outside this exercise.
First, counts below 1 or above 3 return INVALID.
Otherwise, an already accepted ID returns DUPLICATE.
Otherwise, a request exceeding remaining capacity returns FULL. Exact fits must be accepted.
Otherwise, deduct the requested seat count, record the ID and return ACCEPTED.
Rejection changes neither capacity nor recorded IDs. An ID used only in a rejected request can be tried again.
Read the notation
A variable holds a value; remaining = remaining - seats subtracts the requested count. IF tests a condition. RETURN ends the current request immediately. Indented returns occur only when their IF condition is true.
AND requires both statements to be true; OR requires at least one. > excludes equality; >= includes it. IN checks membership of a set; ADD records an ID. A set remembers membership, not a quantity attached to each ID.
Different worked example: a shop has 7 notebooks. A valid purchase of 2 leaves 5. A later request for 6 is rejected and leaves 5. A trace records input, result and retained state after every request, including rejections.
The prototype
01 FUNCTION reserve(id, seats)
02 IF seats < 1 AND seats > 3
03 RETURN INVALID
04 IF id IN accepted_ids
05 RETURN DUPLICATE
06 IF seats >= remaining
07 RETURN FULL
08 remaining = remaining - 1
09 ADD id TO accepted_ids
10 RETURN ACCEPTED
There are three deliberate logic defects. Line numbers are references, not hints about which lines are wrong. Your repair must retain all other required behaviour.
Form a diagnosis and design evidence
Predict from the rules, then use tests to challenge the implementation.
Consult the specification and original code
Start each scenario with its stated remaining capacity and no accepted IDs. Process requests in order. State persists within the scenario; start fresh for the next scenario.
IDs are case-sensitive. Supplied IDs are valid. Counts are whole numbers. Decimal counts, missing IDs, networks and simultaneous requests are outside this exercise.
First, counts below 1 or above 3 return INVALID.
Otherwise, an already accepted ID returns DUPLICATE.
Otherwise, a request exceeding remaining capacity returns FULL. Exact fits must be accepted.
Otherwise, deduct the requested seat count, record the ID and return ACCEPTED.
Rejection changes neither capacity nor recorded IDs. An ID used only in a rejected request can be tried again.
01 FUNCTION reserve(id, seats)
02 IF seats < 1 AND seats > 3
03 RETURN INVALID
04 IF id IN accepted_ids
05 RETURN DUPLICATE
06 IF seats >= remaining
07 RETURN FULL
08 remaining = remaining - 1
09 ADD id TO accepted_ids
10 RETURN ACCEPTED
Your initial diagnosis
Read the code and write your three initial diagnoses before running checks or opening hints. Each needs a line, the violated rule, a concrete starting state/input, predicted wrong behaviour and a proposed correction. Save your initial reasoning below; you can revise it later.
Distinguish a wrong result from a wrong state update. Give enough detail for someone else to reproduce it.
Distinguish a wrong result from a wrong state update. Give enough detail for someone else to reproduce it.
Distinguish a wrong result from a wrong state update. Give enough detail for someone else to reproduce it.
Optional help after your first attempt
Consider whether an out-of-range count reaches INVALID, whether an exact fit is accepted, and whether a successful booking deducts the correct count. A condition can be valid notation yet express an impossible combination.
Construct four small test scenarios
Between your four tests, expose all three defects and include at least one scenario that the original prototype already handles correctly. This last test checks for regression: a repair must preserve correct behaviour. You may use different inputs from another student.
For each test, enter starting capacity and 1–4 requests. One request per line, written ID, seats. Use an uppercase ID of 1–8 letters/digits beginning with a letter. Starting capacity is 0–20; request counts may be −5 to 25. Those editor limits keep the experiment small; the valid booking rule remains 1–3 seats.
Before running, predict the correct specification result and remaining seats after every request, in the same order, one per line: RESULT, remaining. Result names are ACCEPTED, INVALID, DUPLICATE or FULL. For example, with 7 starting seats, request Z, 1 correctly gives ACCEPTED, 6. Choose your own tests for the actual investigation.
Test 1
Test 2
Test 3
Test 4
No test pack checked yet.
Checks distinguish an incorrect prediction from a defect in the prototype. A useful pack must expose each defect independently; several tests of the same failure do not provide equivalent coverage.
Locate and express the repair
Choose which lines to change, then construct their replacements from the notation you have learned.
Consult the specification and original code
Start each scenario with its stated remaining capacity and no accepted IDs. Process requests in order. State persists within the scenario; start fresh for the next scenario.
IDs are case-sensitive. Supplied IDs are valid. Counts are whole numbers. Decimal counts, missing IDs, networks and simultaneous requests are outside this exercise.
First, counts below 1 or above 3 return INVALID.
Otherwise, an already accepted ID returns DUPLICATE.
Otherwise, a request exceeding remaining capacity returns FULL. Exact fits must be accepted.
Otherwise, deduct the requested seat count, record the ID and return ACCEPTED.
Rejection changes neither capacity nor recorded IDs. An ID used only in a rejected request can be tried again.
01 FUNCTION reserve(id, seats)
02 IF seats < 1 AND seats > 3
03 RETURN INVALID
04 IF id IN accepted_ids
05 RETURN DUPLICATE
06 IF seats >= remaining
07 RETURN FULL
08 remaining = remaining - 1
09 ADD id TO accepted_ids
10 RETURN ACCEPTED
Controlled pseudocode editor
Make exactly three distinct line edits. Select a line and an expression for each. IF lines accept conditions; line 08 accepts a subtraction expression; line 09 accepts a record action. The editor offers unchanged and changed expressions, including choices that do not repair the programme.
For IF lines, the chosen expression follows IF. For line 08, it follows remaining =. For line 09, ADD records the current ID; DO NOT ADD leaves the set unchanged. Other lines, return values and execution order remain fixed. No installation or arbitrary code execution is required.
Edit 1
Edit 2
Edit 3
Choose the three edits to preview your programme.
No repaired run yet.
Verification uses your four tests and eight supplied scenarios covering ordinary requests, exact fits, invalid counts, insufficient capacity, duplicates, retries and rule order. Every returned result, remaining count and accepted-ID set is compared with the specification. Passing tests support this bounded repair; they do not establish production readiness.
The requirements change: support cancellations
Reconsider the information the programme stores, not just the expressions it evaluates.
The new brief
Keep all booking rules. Now allow CANCEL id. If the ID has no active booking, return NOT_FOUND and change nothing. Otherwise restore exactly the seats in that booking, remove the active booking and return CANCELLED. Cancelling the same booking twice must not restore seats twice. Once cancelled, the ID may be booked again. There are no payments or refunds in this case.
Starting scenario: 8 seats. Process BOOK A for 2, BOOK B for 3, CANCEL A, CANCEL A. Predict what happens before running the extension.
Learning note: store a value with each ID
A set can tell you that an ID exists. A mapping stores a value alongside it. In an unrelated stationery example, orders["Z"] = 4 records four notebooks for order Z; reading orders["Z"] retrieves 4. Removing the record means it is no longer an active order.
The cancellation skeleton first checks for an active record. If none exists, it returns NOT_FOUND immediately. Otherwise it reads the saved value, restores a quantity, optionally removes the record and returns CANCELLED. Reading happens before removal. You choose what the booking record holds, what to restore and whether to remove it. BOOK uses your verified repair.
Explain what the original set can and cannot tell you, what the new record must retain, and why the order of lookup, restoration and removal matters.
Build and test the extension
No cancellation run yet.
Five sequences check cancellation, repeated and unknown IDs, reuse after cancellation, different quantities and cancellation after a rejected booking. State and stored quantities are checked after every operation. The original booking tests must still pass.
Write an engineering handover
Explain the evidence for the original repair and the consequences of the changed requirement.
Your handover
Explain the three repairs and give one reproducing test. Identify a previously correct behaviour you preserved. Explain the data change for cancellation, the test outcomes and one important limitation. Name a further requirement to clarify before real use, without claiming that all possible inputs or simultaneous requests were tested.
Review before exporting
Your diagnoses cite reproducible evidence, not just a final correct expression.
Your test predictions follow the rules, and your pack covers three distinct defects plus preserved behaviour.
The current repair and cancellation configuration have current passing results.
Your data explanation accounts for exact restoration and repeated cancellation.
Your handover distinguishes test evidence from proof of production readiness.
Executable requirements receive checks. Writing quality uses these criteria; entering text does not automatically establish its quality. Reflections are unscored. Individual feedback and certificates are not included.
Reflect and read further
Consider diagnosis, test design, state, data structures or communicating a repair.
Use one observation from your first attempt, your own test pack or the cancellation update.
Python dictionaries: compare the mapping example with storing booked quantities. MDN debugging: distinguish syntax errors from the logic defects here. Harvard CS50: identify a topic beyond this small sequential model. These readings are optional; Edussentials is not affiliated with these providers.