2.1.4 Thinking Logically
2.1.4(a) Identifying Decision Points in a Solution
Key Considerations in Decision-Making
| Decision area | Typical options/questions |
|---|---|
| Programming paradigm | OOP, functional, procedural, event-driven |
| Programming language | Suitability, team familiarity, learning time |
| Input/output devices | Required hardware, sensors/actuators, interaction model |
Scenario: program switches on a light when a button is pressed.
| Decision point | Options | Typical trade-off |
|---|---|---|
| Paradigm | Event-driven vs procedural polling | Responsiveness vs implementation simplicity |
| Language | Python, C++, JavaScript | Ease of development vs low-level hardware control |
| Input device | Button, touch sensor, motion sensor, mobile app | Cost, reliability, user convenience |
| Output device | LED, smart bulb, relay | Power control complexity and safety |
| Interaction method | Wired, Bluetooth/Wi-Fi, cloud | Latency, reliability, setup complexity |
2.1.4(b) Determining Logical Conditions Affecting Decisions
Factors Influencing Decisions
| Factor | Core question |
|---|---|
| Effectiveness | Does this option fully solve the required problem? |
| Convenience | How easy is it to build, use, and maintain? |
| Feasibility | Can it be delivered with current time, budget, and skills? |
| Prioritisation | Which factor matters most for this specific context? |
Scenario: selecting a database for a new application.
| Option | Effectiveness | Convenience | Feasibility |
|---|---|---|---|
| Relational DB (SQL) | High (ACID, strong query model) | Medium (known tech, good docs) | High (team already skilled) |
| NoSQL DB | Medium (strong for unstructured/scaled data) | Low-medium (new patterns to learn) | Medium (training and migration effort) |
• Banking/integrity-critical system → SQL
• Fast MVP with existing SQL skills → SQL
• Massive unstructured/high-scale workload → consider NoSQL
| Scenario | Suggested priority order | Reason |
|---|---|---|
| Real-time processing system | Effectiveness > Convenience | Must meet strict performance/correctness targets |
| Consumer-facing mobile app | Convenience > Effectiveness | UX and usability strongly affect adoption |
| Startup MVP | Feasibility > Effectiveness | Ship quickly, validate, iterate later |
2.1.4(c) Understanding How Decisions Affect Program Flow
Scenario: designing a runner game.
| Design choice | Option | Program-flow impact |
|---|---|---|
| Game type | Endless runner | Single continuous loop; no level-save transitions |
| Game type | Level-based | Level loading, progress tracking, save/load logic |
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
| Planning point | Good practice |
|---|---|
| Unexpected user input | Include explicit else/validation branches |
| Multiple valid choices | Handle each branch deliberately |
| Error prevention | Provide clear fallback/error path |
// 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
• 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