HCI 1. Introduction
Uploaded by adrianwang2003 · 28 May 2024
Preview
Text from the first pagesHwa Chong Institution H2 Computing 1 1 Introduction Learning Outcome Programming is a creative experience to apply computational thi nking to design the solution, and implement it in a programming language that the computer ca n understand. With the development of hardware, computers can help to solve numerous problems in an efficient way. Computational thinking is a high level problem solving skills a nd it comprises four key techniques: Decomposition: breaking down a complex problem or system into s maller, more manageable parts Pattern Recognition: looking for similarities among and within problems Abstraction: focusing on the important information only, ignoring irrelevant details Algorithms: developing a step-by- step solution to the problem, or the rules to follow to solve the problem Furthermore, we also need to learn communication skills to understand the problem and explain the solution clearly. Let’s start with a simple example as an i llustration of the complete procedure to solve a real-life problem. We will follow the six steps below to solve the problem: 1. Define the problem 2. Analyze the problem 3. Design the solution 4. Implement the solution 5. Test the solution 6. Document the solution Algorithmic Representation Use appropriate techniques or tools such as pseudo-code and flowchart to show program flow Use standard flowchart symbols Use a combination of various control structures Use decision tables to explore the actions for combinations of different input conditions Use modular design to decompose a problem into smaller problems Data Validation and Program Testing Explain the difference between data validation and data verification Understand data validation techniques such as range check, format check, length check, presence check, check digit Identify, explain and correct syntax, logic and runtime errors Design appropriate test cases using normal, abnormal and extrem e data for testing and debugging programs
Hwa Chong Institution H2 Computing 2 Example 1 Write a program to indicate the grade of any given integer mark based on the following grading scheme: Mark Range Grade 0 – 44 Fail 45 – 100 Pass 1.1 The First Step: Define the Problem Here, we write a statement of the objectives to be accomplished – the problem we are trying to solve. If necessary, we also specify the users of our program. 1.2 The Second Step: Analyze the Problem Here, we identify the following: (a) values that must be supplied from outside the program (input data) (b) values that are given on the problem (constant data) (c) values that must be produced as a result of solving the problem (output) Effectively, the first two steps focus on what the program must achieve. For Example 1, we have input data of a positive integer Mark, constant data of 0, 44, 45, 100, and the output data is ‘Fail’ or ‘Pass’. 1.3 The Third Step: Design the Solution Here, we are concerned with the question of how to solve the problem in a systematic manner. We write an algorithm to take the given input data and constants and produce the desired output values. Algorithm – A step-by-step process or se quence of instructions that can be used to solve a problem in a finite amount of time. All steps will specify action taken (a verb) and the data that action has taken on. Generally, we can use either flowchart or pseudocode to describe an algorithm. 1.3.1 Algorithms in Flowcharts A flowchart is a formalized graph ic representation of a logic s equence, work process, organization chart or similar structure. The purpose of a flow chart is to provide people with a common language or reference point when dealing with a project or process.
Hwa Chong Institution H2 Computing 3 Common Flowchart symbols Symbol Symbol Name (alias) Symbol Description Process / Operation Symbols Process Show a Process or action step. This is the most common symbol in both process flowcharts and business process maps. Branching and Control of Flow Symbols Flow Line (Arrow, Connector) Flow line connectors show the direction that the process flows. Terminator (Terminal Point, Oval) Terminators show the start and stop points in a process. When used as a Start symbol, terminators depict a trigger action that sets the process flow into motion. Decision Indicates a question or branch in the process flow. Typically, a Decision flowchart shape is used when there are 2 options (Yes/No etc.) Input and Output Symbols Data (I/O) The Data flowchart shape indicates inputs to and outputs from a process. As such, the shape is more often referred to as an I/O shape than a Data shape. Display Indicates a process step where information is displayed to a person (e.g., PC user, machine operator). Example 1 Startt Read Mark Cutoff = 45 Mark < Cutoff ? Print ‘Fail’ Yes No End Print ‘Pass’
Hwa Chong Institution H2 Computing 4 1.3.2 Algorithms in Pseudocode Pseudocode – essentially English with some defined rules of str ucture and some keywords similar to program code. Main advantage – allows us to focus on the logical details of o ur program solution, without getting bogged down with the syntax rules of the programming languages. Primary disadvantage – has no single form. Its format varies d epending on the author. In this view, we shall standardize a format for pseudocode. Pseudocode Guidelines We shall use the following keywords: For Start: Begin For Finish: End For Input: Read For Output: Print For Selection: If , then, else, end-if For multi-way selection: Case-where, otherwise, end-case For pre-test repetition: While, end-while For post-test repetition: Repeat Until Note the following guidelines as well: 1. Structural elements come in pairs e.g. Begin-End, If-Endif 2. Indenting is used to show structure in the algorithm. Example 1 Pseudocode: BEGIN Read Mark Cutoff = 45 if Mark < Cutoff PRINT ‘Fail’ else PRINT ‘Pass’ endIf END
Hwa Chong Institution H2 Computing 5 Principles of a Good Algorithm A good algorithm is one that satisfies the following: (a) It is easily unders tood by another person. (b) It solves the problem efficiently and cleanly. Some guidelines for writing a good algorithm include: (a) Ask yourself: “Can it be implemented by someone else?” This means that in your algorithm, you should Use unambiguous expressions and be concise and precise. State all necessary information, including assumptions. (b) Use only the three basic flow of execution constructs (we will learn in subsequent chapters): Sequential Selection Repetition (c) Sub-divide the problem solution into modular (self-contained and logical), easy-to- manage chunks, through step-wise refinements. (d) Have only one start and one termination point. (e) Use indentation to show structure and improve readability. 1.4 The Fourth Step: Imp lement the Solution Here, we write (code) the program using an appropriate programming language, and following its rules (syntax) exactly. Computers are built to understand machine language only, which are long strings of ones and zeros. Human languages are error-p rone for computers. As a trad eoff for both sides, we use high level languages to communicate with computer and give instructions. Programming languages are well developed and still developing t o suit our needs for various problems in the real world. In our syllabus, we will use Python as the programming language.
Hwa Chong Institution H2 Computing 6 1.5 The Fifth Step: Test the Solution Here, we check that the program does as required by running test plans with known solution
Content continues in the PDF. Download PDF
Related notes
- NYJC 2026 Prelim P2Exam Papers · 2026
- NYJC 2026 Prelim P1Exam Papers · 2026
- DHS 2026 Y6 H2 Computing Prelim Paper 2_finalExam Papers · 2026
- ACJC 2026 JC2 Computing Prelim Paper 2 (Practical)Exam Papers · 2026
- 2026_NJC Prelim_Computing_P2.pdfExam Papers · 2026
- 2026_JPJC_Computing_Prelim_P2_finalExam Papers · 2026
- 2026_JPJC_Computing_Prelim_P1_markschemeExam Papers · 2026
- 2026_JPJC_Computing_Prelim_P1_finalExam Papers · 2026
- 2026 ACJC Prelim Computing Paper 2Exam Papers · 2026
- 2024 ACJC Computing PromoExam Papers · 2024
- 2023 ACJC Promo QPExam Papers · 2023
- 2022 ACJC Computing Promo Paper 2Exam Papers · 2022
- See all H2 Computing notes

