Skip to content

2.1.4 Thinking logically

Paper 2 · Algorithms & Programming · Section 2.1 · 12 flashcards · 8 questions

Identifying decision points, determining logical conditions, understanding decision impact on program flow

2.1.4 Thinking Logically

2.1.4(a) Identifying Decision Points in a Solution

Definition
Decision-making is a critical component of problem-solving and programming. A decision is the result of considering different options and choosing the most appropriate one. Decisions are required at multiple stages, from the overall approach to implementation details.

Key Considerations in Decision-Making

Key Point
Decision areaTypical options/questions
Programming paradigmOOP, functional, procedural, event-driven
Programming languageSuitability, team familiarity, learning time
Input/output devicesRequired hardware, sensors/actuators, interaction model
Worked Example
Worked Example: Smart Light System

Scenario: program switches on a light when a button is pressed.
Decision pointOptionsTypical trade-off
ParadigmEvent-driven vs procedural pollingResponsiveness vs implementation simplicity
LanguagePython, C++, JavaScriptEase of development vs low-level hardware control
Input deviceButton, touch sensor, motion sensor, mobile appCost, reliability, user convenience
Output deviceLED, smart bulb, relayPower control complexity and safety
Interaction methodWired, Bluetooth/Wi-Fi, cloudLatency, reliability, setup complexity

2.1.4(b) Determining Logical Conditions Affecting Decisions

Definition
Decisions are influenced by logical conditions that determine the most suitable outcome. These conditions help evaluate and prioritise different options.

Factors Influencing Decisions

Key Point
FactorCore question
EffectivenessDoes this option fully solve the required problem?
ConvenienceHow easy is it to build, use, and maintain?
FeasibilityCan it be delivered with current time, budget, and skills?
PrioritisationWhich factor matters most for this specific context?
Worked Example
Worked Example: Choosing a Database System

Scenario: selecting a database for a new application.
OptionEffectivenessConvenienceFeasibility
Relational DB (SQL)High (ACID, strong query model)Medium (known tech, good docs)High (team already skilled)
NoSQL DBMedium (strong for unstructured/scaled data)Low-medium (new patterns to learn)Medium (training and migration effort)
Decision by priority:
• Banking/integrity-critical system → SQL
• Fast MVP with existing SQL skills → SQL
• Massive unstructured/high-scale workload → consider NoSQL
Key Point
ScenarioSuggested priority orderReason
Real-time processing systemEffectiveness > ConvenienceMust meet strict performance/correctness targets
Consumer-facing mobile appConvenience > EffectivenessUX and usability strongly affect adoption
Startup MVPFeasibility > EffectivenessShip quickly, validate, iterate later

2.1.4(c) Understanding How Decisions Affect Program Flow

Definition
The decisions made during design and development have a direct impact on program flow. Each decision shapes how the program operates, leading to different paths and outcomes.
Worked Example
Worked Example: Game Design Decisions

Scenario: designing a runner game.
Design choiceOptionProgram-flow impact
Game typeEndless runnerSingle continuous loop; no level-save transitions
Game typeLevel-basedLevel loading, progress tracking, save/load logic
text
procedure gameLoop():
    displayOptions(["Run", "Jump", "Slide"])
    choice = getUserInput()

    if choice == "Run" then
        moveCharacterForward()
    elseif choice == "Jump" then
        jumpOverObstacle()
    elseif choice == "Slide" then
        slideUnderBarrier()
    end if
end procedure
Each user choice sends control flow down a different branch.
Key Point
Planning pointGood practice
Unexpected user inputInclude explicit else/validation branches
Multiple valid choicesHandle each branch deliberately
Error preventionProvide clear fallback/error path
text
// Better planning for yes/no input
if userInput == "yes" then
    processOrder()
elseif userInput == "no" then
    cancelOrder()
else
    displayError("Please enter yes or no")
end if
Exam Tip
Exam Tips for Thinking Logically:
• Identify decision points in given scenarios
• Evaluate options using effectiveness, convenience, feasibility
• Understand how decisions affect program flow
• Plan for multiple user decision paths
• Consider the impact of programming paradigm/language choices
• Think about what happens at each branch point in code