COMPUTER SCIENCE CAFÉ
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY

COMPUTATIONAL THINKING | THINKING LOGICALLY

ON THIS PAGE
SECTION 1 | IDENTIFY WHEN DECISION-MAKING IS REQUIRED IN A SPECIFIED SITUATION 
SECTION 2 | IDENTIFY THE DECISIONS REQUIRED FOR THE SOLUTION TO A SPECIFIED PROBLEM 
SECTION 3 | IDENTIFY THE CONDITION ASSOCIATED WITH A GIVEN DECISION IN A SPECIFIED PROBLEM 
SECTION 4 | EXPLAIN THE RELATIONSHIP BETWEEN THE DECISIONS AND CONDITIONS OF A SYSTEM 
SECTION 5 | DEDUCE LOGICAL RULES FOR REAL-WORLD SITUATIONS 
ALSO IN THIS TOPIC
THINKING PROCEDURALLY
YOUR ARE HERE | THINKING LOGICALLY
THINKING AHEAD
 THINKING CONCURRENTLY​ 

THINKING ABSTRACTLY

 FLOWCHARTS
MORE COMING SOON

Picture
SECTION 1 | IDENTIFY WHEN DECISION-MAKING IS REQUIRED IN A SPECIFIED SITUATION ​
Decision-making is a pivotal aspect of computer science and, more broadly, problem-solving in various domains. It entails determining when and where choices must be made based on certain conditions or data. This ability to identify moments of decision-making is foundational for both algorithm design and practical application.

In computing, decision-making often relates to determining a course of action based on specific conditions. This is typically executed using conditional statements, such as "if", "else", and "switch", which allow the program to take different paths based on certain criteria.

  • Login Systems: When a user tries to log in, a decision is made based on whether the provided password matches the stored one.
  • Temperature Control: In a smart thermostat system, decisions on turning the heater or cooler on/off are made based on the current room temperature and the desired set temperature.
  • Online Shopping: When checking out, a decision might be made on whether to apply a discount based on the user's membership status or promo codes

IDENTIFYING A DECISION MAKING SITUATION
  • Check for Conditional Words: Look for words or phrases like "if", "when", "unless", "based on", "depending on", etc., which often signal the need for a decision.
  • Variable Outcomes: If there are multiple potential outcomes or actions based on varying inputs, a decision-making point is likely present.
  • User Interactions: User-driven events, such as clicks, inputs, or selections, often require decisions on how the system should respond
SECTION 2 | IDENTIFY THE DECISIONS REQUIRED FOR THE SOLUTION TO A SPECIFIED PROBLEM 
Every problem, especially in the realm of computer science and programming, contains key decision points that dictate its solution's pathway. To effectively solve a problem, one must first identify these decisions. In this module, we'll explore how to discern the necessary decisions within a given problem.

In the context of problem-solving, identifying decisions means pinpointing moments or steps where choices must be made based on data, conditions, or requirements. These choices influence the direction or outcome of the solution

The following steps could be used to identify required decisions:
  1. Understand the Problem: Thoroughly read and analyse the problem statement to comprehend its goals and requirements.
  2. List Potential Actions: Think about all possible actions, pathways, or outcomes that might arise while solving the problem.
  3. Determine Conditional Points: For each action or pathway, determine the conditions under which they would be executed. These conditions represent decision points

EXAMPLE PROBLEM
Design a digital traffic light system that controls a pedestrian crossing.


Required Decisions:
  1. When should the light turn red for vehicles? - This decision could be based on a timer, a manual button press by pedestrians, or sensors detecting pedestrians near the crossing.
  2. How long should the light stay red for vehicles? - Depends on factors like average crossing time for pedestrians, specific needs for elderly or differently-abled individuals, or current traffic conditions.
  3. When should the light return to green for vehicles if no pedestrians are detected? - Might involve sensors to detect pedestrian movement and decide on the duration.
  4. How to handle malfunctions or emergencies? - Decisions on fallback mechanisms, alerts, or manual overrides.
SECTION 3 | IDENTIFY THE CONDITION ASSOCIATED WITH A GIVEN DECISION IN A SPECIFIED PROBLEM 
In the context of problem-solving, particularly in computer science, decisions are not made in a vacuum. They are often contingent upon certain conditions being met. Recognizing these conditions is essential to crafting efficient and accurate solutions.

A condition is a criterion or set of criteria that must be met for a specific decision or action to be taken. In programming, conditions are typically used with decision-making structures like "if", "else", and "switch" statements.

IDENTIFYING A CONDITION 
  • Analyse the decision point: Determine what exactly is being decided at this juncture of the problem.
  • Ask "Why?" and "When?": To understand the condition, question why and when that decision is being made. This will help you to unravel the criteria behind the decision.
  • Look for conditional keywords: Words such as "if", "when", "unless", and "given" can signal conditions in problem statement

Imagine a system for automatic doors at a supermarket. If the decision is to "Open the Door", identify the associated condition. The associated condition for the decision "Open the Door" could be "if a person is detected within a certain distance of the door" or "if a motion sensor is activated near the door entrance".
SECTION 4 | EXPLAIN THE RELATIONSHIP BETWEEN THE DECISIONS AND CONDITIONS OF A SYSTEM 
In computer programming and system design, understanding the relationship between decisions, conditions, and the use of structures like If-Then-Else is fundamental. These structures provide a way for systems to make choices based on specified conditions.

Decision: It's a point in the system or program where a choice needs to be made. Decisions dictate the flow of the program.
Condition: It's a test or evaluation that returns a true or false result. Decisions are often made based on the result of a condition.

THE IF THEN ELSE STRUCTURE
The If-Then-Else structure in programming offers a mechanism to make decisions based on conditions:
  • If: This represents the condition we're testing. If the condition is true, then a particular set of actions is executed.
  • Then: This represents the actions that should be taken if the condition specified in the "If" part is met (i.e., if it's true).
  • Else: This provides an alternative set of actions that should be taken if the condition in the "If" part is not met (i.e., if it's false)

SCENARIO
Imagine you're a software engineer responsible for programming the Mars Rover's landing sequence. This is a critical moment for the mission; the rover has to respond rapidly to various environmental factors to ensure a safe landing.

Several conditions can be checked during descent:
  1. If the altitude is above 10,000 meters, the parachute deploys.
  2. If the altitude is between 1,000 meters and 10,000 meters, the retro-rockets fire to slow the descent.
  3. If the altitude is below 1,000 meters, landing legs deploy, and navigation systems are initialized.
  4. If the altitude is below 100 meters, the rover prepares for ground contact, and all systems are on high alert.

Sequential If Statements (Speed Importance)
Imagine these conditions were placed sequentially in the rover's software:
If altitude is below 100 meters
    Prepare for ground contact
If altitude is below 1,000 meters
    Deploy landing legs and initialize navigation
If altitude is between 1,000 and 10,000 meters
    Fire retro-rockets
If altitude is above 10,000 meters
    Deploy parachute

Potential Problem
As the rover descends from high altitudes, it would first check the condition for the lowest altitude. In the beginning stages of descent, these checks are redundant and waste precious processing time. If there were many more conditions, or if data processing took longer, this inefficiency could lead to dangerous lag in system responses

Optimized Conditional Statements (Prioritizing Likely Scenarios)
To optimize, we rearrange based on the sequence of events
If altitude is above 10,000 meters
    Deploy parachute
Else If altitude is between 1,000 and 10,000 meters
    Fire retro-rockets
Else If altitude is below 1,000 meters
    Deploy landing legs and initialize navigation
Else If altitude is below 100 meters
    Prepare for ground contact


Advantages
  • Efficient Processing: By structuring the conditions from most likely to least likely (or in the sequence they're expected to occur), the rover's system can rapidly address the current situation without unnecessary checks.
  • Rapid Response: In a scenario like a Mars landing where milliseconds can make a difference, ensuring that the software can process conditions as quickly as possible is crucial for the safety of the rover.
  • Power Conservation: On missions where power resources are limited, efficient processing can help conserve energy.
SECTION 5 | DEDUCE LOGICAL RULES FOR REAL-WORLD SITUATIONS 
Applying logical principles to real-world scenarios involves more than just raw logic; it requires an understanding of the essence of the situation and breaking it down into manageable parts. By introducing concepts like abstraction and decomposition, we can deduce logical rules more effectively.

Example steps to deduce logical rules with Abstraction and Decomposition
  • Abstraction: Before diving into the details, abstract the situation to understand its essence. This means focusing on the core elements and ignoring specific intricacies that might not be crucial for deducing logical rules.
  • Decomposition: Break the situation down into its fundamental components or smaller parts. This simplifies the problem and makes it easier to manage and analyze.
  • Analyze the Situation: With a clearer view from the abstraction and decomposition steps, analyze these smaller parts or key components and understand how they interact.
  • Identify Key Variables: Now, pinpoint what elements or variables play pivotal roles in the situation. Understand their nature and how they influence the scenario.
  • Draw Inferences: Using your breakdown and the key variables identified, infer potential relationships or causality between variables.
  • Test Hypotheses: Once you've hypothesized potential rules or relationships, test them against various scenarios to ensure they hold true.
  • Iterate and Refine: As new information is acquired or if situations change, revisit and refine your logical rules, ensuring they remain valid.

Example: Public Library System
  1. Abstraction: Focus on the core functionality of the library: lending books to members.
  2. Decomposition: Break down the lending process: book selection, member verification, book issuance, return date allocation, and book return.

Logical Rules
  • A member must have a valid library card to borrow a book.
  • Books must be returned by the allocated return date.
  • If a book isn't returned on time, a late fee is applied
Picture
1: Consider the problem of designing a system for an online bookstore. Identify decisions required for this solution.
2: Imagine a system for automatic doors at a supermarket. If the decision is to "Open the Door", identify the associated condition.
3: Think of a home heating system that heats the home if the temperature drops below 20°C and stops heating when the temperature is above 22°C. Can you frame this using the If-Then-Else structure?
4: ​ Think about the rules that govern the operation of an elevator in a multi-story building. Can you deduce some logical rules?
Picture
NAVIGATION
COMING SOON
Picture
SUGGESTIONS
We would love to hear from you
SUBSCRIBE 
To enjoy more benefits
We hope you find this site useful. If you notice any errors or would like to contribute material then please contact us.