Computational Thinking and Problem Analysis Notes

Programming as Problem Solving

  • Definition of Programming: Programming is the comprehensive process of creating a specific set of instructions to dictate how a computer performs a task, solves a problem, or runs an application. It encompasses several distinct layers:

    • Logic Design: Structuring the underlying reasoning and flow.

    • Coding: Writing instructions using specialized, human-readable programming languages.

    • Translation: Converting abstract human ideas into commands that a machine's hardware can execute.

  • The Mechanics of Programming:

    • Problem Solving: This is the initial stage where a large, complex task is broken down into small, sequential, and logical steps.

    • Writing Code: This involves using high-level languages such as Python, JavaScript, or C# to script instructions.

    • Translation Process: The human-readable code must be converted into binary or machine code so the computer's processor can interpret and run it.

  • The Purpose of Programming: Programming is utilized to eliminate the need for humans to perform difficult, boring, or overly complicated work manually.

    • System Creation: Building systems to assist business operations, such as an inventory management system that automates item tracking.

    • Industrial Automation: Factory machines operate and build items independently because they have been programmed to do so.

    • Repetitive Task Offloading: Programming allows a system to take over manual, repetitive steps, resolving complex problems with high efficiency.

Understanding Problem Requirements

  • Core Concept: Understanding requirements involves identifying exactly what needs to be solved, who the intended users are, and what constraints exist before a solution is developed.

  • Key Steps to Requirement Analysis:

    • Define the Core Issue: The true root cause of a problem must be identified by carefully separating objective facts from subjective opinions.

    • Focus on the Goal: Analysis should prioritize outcomes and specific user needs rather than getting stuck on fixed tools or specific User Interface (UI) designs.

    • Identify Limits: Every project has boundaries that must be documented, including available time, budget (money), and technological limitations.

Input-Process-Output (IPO) Model

  • Foundational Structure: The IPO model is a basic framework used in programming to decompose complex code into three distinct, manageable stages. It maps the flow of data as it enters, is transformed by, and exits a system.

  • The Three Stages:

    • Input: This consists of raw data entering the system. Sources include users, files, databases, Application Programming Interfaces (APIs), or sensors.

    • Process: This stage involves the computational logic, specific algorithms, mathematical calculations, and manipulations performed upon the input data.

    • Output: This is the final result returned to the user. It can be displayed on a screen, saved into a file, or transmitted to another system.

  • Practical Example of the IPO Model (The Coding Process):

    • Input (Writing the Code): The programmer types instructions into the screen. These raw texts and symbols serve as the input for the computer.

    • Process (Machine Translation): The computer translates the code into machine language (11 and 00), also known as binary. During this stage, the machine checks the logic, rules, and grammar of the code regardless of whether the code is ultimately functional or broken.

    • Output (The Result): The machine provides a final response based on the process.

      • If the input is correct: The output is a working program.

      • If the input contains a mistake: The output is a red error message indicating the nature of the failure.

      • The computer will always provide an output of some kind.

Problem Decomposition

  • Definition: Problem decomposition is the practice of taking a single complex problem and breaking it down into smaller, independent, and more manageable components.

  • Key Benefits:

    • Implementation becomes simpler.

    • Debugging is made easier.

    • Team collaboration is improved.

  • Hierarchy Example (Clock Decomposition):

    • Level 1: Clock

    • Level 2: The clock is split into three main categories: Digital Clock, Date, and Counter/Stop Clock.

    • Level 3 (Sub-components):

      • Digital Clock: Divided into Hour, Minute, and Second.

      • Date: Divided into Month and Day.

      • Counter/Stop Clock: Divided into Seconds and ms (milliseconds).

Identifying Constraints

  • Definition: Identifying constraints involves discovering the specific rules, limits, and conditions that a system or program must adhere to.

  • Implementation: This requires setting boundaries for logic outcomes, resource usage, and data types before the actual coding begins.

  • The Importance of Constraints:

    • Performance: Identifying constraints improves the overall performance of the code.

    • Efficiency: It prevents the need to rewrite code later in the development cycle.

    • Scope Control: It helps in maintaining and controlling the project scope.

Programming is the process of creating instructions for a computer to perform tasks, involving several layers:

  • Logic Design: Structuring reasoning and flow.

  • Coding: Writing instructions in programming languages.

  • Translation: Converting human ideas into machine-executable commands.

The Mechanics of Programming:

  • Problem Solving: Breaking down tasks into logical steps.

  • Writing Code: Using languages like Python or JavaScript.

  • Translation: Converting code into machine language for execution.

Purpose of Programming: To automate complex, tedious tasks.

  • System Creation: Building systems to assist operations.

  • Industrial Automation: Machines operating independently.

  • Repetitive Task Offloading: Systems taking over manual tasks.

Understanding Problem Requirements:

  • Core Concept: Identifying what needs to be solved.

    • Key Steps to Requirement Analysis:

    • Define Core Issue: Identify the root cause.

    • Focus on Goal: Prioritize outcomes and user needs.

    • Identify Limits: Document boundaries such as time and budget.

Input-Process-Output (IPO) Model:

  • Foundational Structure: Decomposing code into three stages.

    • Input: Raw data entering the system.

    • Process: Logical operations on the data.

    • Output: Final results for the user.

Problem Decomposition:

  • Definition: Breaking down complex problems into manageable parts.

  • Key Benefits: Simplified implementation and improved debugging.

  • Hierarchy Example (Clock Decomposition):

    • Level 1: Clock

    • Level 2: Types of Clock

    • Level 3: Sub-components like Hour and Minute.

Identifying Constraints:

  • Definition: Discovering rules and limits a system must follow.

  • Importance of Constraints: Enhances performance, efficiency, and scope control.