Unit 1: Creative Development AP Computer Science Principles TD Contents 01 Introduction 02 Collaboration 03 Program Function and Purpose 04 Program Design and Development 05 Identifying and Correcting Errors TESTDAILY 1.1 T ES T DAI LY 1.1 Introduction Introduction 1.1.1 Computer Science 1.1.2 Prerequisites 1.1.3 What Will You Learn About 1.1.4 Exam Overview TESTDAILY T ES T DAI LY 1.1 Introduction 1.1.1 Computer Science 1.1.1 Learning Objectives T E S T D A I LY Computer Science • AP Computer Science Principles introduces students to the breadth of the field of computer science. • Computer Science – Computer science is the study of computers and computing as well as their theoretical and practical applications. – Computer science applies the principles of mathematics, engineering, and logic to a plethora of functions, including algorithm formulation, software and hardware development, and artificial intelligence. 1.1.1 T ES T DAI LY 1.1 Introduction 1.1.2 Prerequisites 1.1.2 Learning Objectives T E S T D A I LY Prerequisites • Mathematical ! Mathematical ! Mathematical ! • It is important to understand that any significant computer science course builds upon a foundation of mathematical reasoning that should be acquired before attempting such a course. • It is recommended that students in the AP Computer Science Principles course have successfully completed a first-year high school algebra course with a strong foundation of basic linear functions, composition of functions, and problem-solving strategies that require multiple approaches and collaborative efforts. • 1.1.2 Prior computer science experience is not required to take this course. T ES T DAI LY 1.1 Introduction 1.1.3 What You Will Learn About 1.1.3 Learning Objectives T E S T D A I LY What You Will Learn About • In this course, you will : – learn to design and evaluate solutions and to apply computer science to solve problems through the development of algorithms and programs (Big Idea 3). – incorporate abstraction into programs and use data to discover new knowledge. (Big Idea 2) – explain how computing innovations and computing systems, including the Internet (Big Idea 4), work, explore their potential impacts, and contribute to a computing culture that is collaborative and ethical (Big Idea 5). 1.1.3 Learning Objectives T E S T D A I LY • It is important to note that the AP Computer Science Principles course does not have a designated programming language. • 1.1.3 It use a language called “Pseudocode”. T ES T DAI LY 1.1 Introduction 1.1.4 Exam Overview 1.1.3 Overview Exam Overview • T E S T D A I LY The exam consists of an end-of-course AP Exam and the Create performance task. – The end-of-course exam is 2 hours long and includes 70 multiple-choice questions. The multiple-choice section will include three different types of questions (in the following order on the exam): single-select questions, single-select questions with a reading passage about a computing innovation, and multi-select questions. – The Create performance task requires at least 12 hours of dedicated class time for students to complete. 1.1.4 Overview T E S T D A I LY • The AP Exam assesses each of the five big ideas of the course with the following weighting on the multiple-choice section: • Questions in Big Ideas 1, 2, and 3 can be represented as algorithms (with no program code) or as program code using the Exam Reference Sheet. 1.1.4 Overview T E S T D A I LY • 1.1.4 2021 Score Distributions: Math & Computer Science Overview T E S T D A I LY • 1.1.4 AP备考计划教材介绍 1.2 T ES T DAI LY 1.2 Collaboration Concept T E S T D A I LY • A computing innovation includes a program as an integral part of its function. • A computing innovation can be – physical (e.g., self-driving car), – nonphysical computing software (e.g., picture editing software), – a nonphysical computing concept (e.g., e-commerce). 1.2 Property T E S T D A I LY • Consultation and communication with users are important aspects of the development of computing innovations. • Collaboration that includes diverse perspectives helps avoid bias in the development of computing innovations. 1.2 Property T E S T D A I LY • Effective collaborative teams practice interpersonal skills, including but not limited to: – Communication – Consensus building – Conflict resolution – Negotiation 1.2 1.3 T ES T DAI LY 1.3 Program Function and Purpose Concept T E S T D A I LY • A program is a collection of program statements that performs a specific task when run by a computer. – The behavior of a program is how a program functions during execution and is often described by how a user interacts with it. – A program can be described broadly by what it does, or in more detail by both what the program does and how the program statements accomplish this function. 1.3 Concept T E S T D A I LY • A program is often referred to as software. • A code segment is a collection of program statements that is part of a program. • A program needs to work for a variety of inputs and situations. 1.3 Concept T E S T D A I LY • Input – Program inputs are data sent to a computer for processing by a program. Input can come in a variety of forms, such as tactile, audio, visual, or text. – An event is associated with an action and supplies input data to a program. – Events can be generated when a key is pressed, a mouse is clicked, a program is started, or any other defined action occurs that affects the flow of execution. – Inputs usually affect the output produced by a program. – Input can come from a user or other programs. 1.3 Concept T E S T D A I LY • Output – Program outputs are any data sent from a program to a device. Program output can come in a variety of forms, such as tactile, audio, visual, or text. – Program output is usually based on a program’s input or prior state (e.g., internal values). 1.3 1.4 T ES T DAI LY 1.4 Program Design and Development Concept • Software Development Process—Iteration Rules • Initiate: T E S T D A I LY Kick off the project and identify team members • Plan / Reflecting: Define the problem the project needs to solve Understanding the problem and identifying the root cause of it and any risks or uncertainties involved with it • Design: Designing, creating, and testing smaller programming modules that can be reused and combined can help create a successful programming solution Users must be a part of this process to ensure all features needed are identified and a solution designed. • Create / Programming / Prototyping : Creating/programming the solution from the Design phase • Test: Determine if the programs work and if they provide the functionality as intended • Document / Documentation: Ideally, documentation will be created as the program is being developed This is so useful when you either return later to modify the code or a team member has to pick up your code and understand what it is doing to successfully make modifications. 1.4 Property T E S T D A I LY • A development process that is iterative requires refinement and revision based on feedback, testing, or reflection throughout the process. • A development process that is incremental is one that breaks the problem into smaller pieces and makes sure each piece works before adding it to the whole. 1.4 Concept T E S T D A I LY • Documentation • Program documentation is a written description of the function of a code segment, event, procedure, or program and how it was developed. • Comments are a form of program documentation written into the program to be read by people and do not affect how a program runs. • It is important to acknowledge any code segments that were developed collaboratively or by another source. • Acknowledgement of a code segment(s) written by someone else and used in a program can be in the program documentation. • The acknowledgement should include the origin or original author’s name. 1.4 Exercises T E S T D A I LY 2016_MCQ_Q2 1.4 Exercises T E S T D A I LY 5StepToA5_2018e_p290_Q65 The programmer tests an app she wrote using one set of test cases. Since the app was developed for her personal use, does it need to undergo further testing? (A) Yes, all software should be tested with a variety of test cases to ensure the code works as expected. (B) No, since the app is for personal use, less stringent testing is acceptable. (C) Additional testing is required only when there are more than 25 lines of code. (D) Additional testing is needed when procedures are used. 1.4 Exercises T E S T D A I LY 2020_MCQ_Q10 1.4 1.5 T ES T DAI LY 1.5 Identifying and Correcting Errors Identifying and Correcting Errors 1.5.1 Classification of Errors 1.5.2 Find and Correct Errors TESTDAILY T ES T DAI LY 1.5 Identifying and Correcting Errors 1.5.1 Classification of Errors 1.5.1 Definition T E S T D A I LY • Syntax error – A syntax error is a mistake in the program where the rules of the programming language are not followed. – Can not compile and run. • Run-time error – A run-time error is a mistake in the program that occurs during the execution of a program. – Can compile and run, but crash. • Logic error – A logic error is a mistake in the algorithm or program that causes it to behave incorrectly or unexpectedly. – Can compile and run, don’t crash, but the result is not expected. 1.5.1 T ES T DAI LY 1.5 Identifying and Correcting Errors 1.5.2 Find and Correct Errors 1.5.2 Property T E S T D A I LY • Syntax error • The rules of the programming language. • manual inspection • Use IDE tools • IDE : Integrated Development Environment • A software application that allows the creation of a program. • Consists of a source code editor, build automation tools, a debugger. • Different program language may use different IDEs. • One IDE may support different program language. 1.5.2 Property T E S T D A I LY • Run-time error • During the execution of a program, crash. • Situation : Divided by 0 Out of boundary • Find crash point, then figure out why. • Debug • Trace table • Single stepping (through IDE) • Breakpoints (through IDE) • Variable dumps 1.5.2 Use null pointer …. Property T E S T D A I LY • Logic error • Result is not expected. • Test • In the development process, testing uses defined inputs to ensure that an algorithm or program is producing the expected outcomes. • Programmers use the results from testing to revise their algorithms or programs. • Black box testing Use test data for which results already calculated & compare result from program with expected results. • White box testing 1.5.2 Examine each line of code for correct logic and accuracy. Exercises T E S T D A I LY 5StepToA5_2018e_p60_Q74 What is a benefit of collaboration when writing code? (A) Collaboration allows the work to be divided among independent programmers to create. (B) Collaboration makes it easier to document another person’s code. (C) Collaboration makes it easier to find errors. (D) Collaboration produces an increase in user requirements that can be met with more team members. 1.5.2 Summary T E S T D A I LY 1.1 Introduction 1.2 Collaboration 1.3 Program Function and Purpose 1.4 Program Design and Development 1.5 Identifying and Correcting Errors 1 Solution T E S T D A I LY 1 Section Question Answer 1.4 2016_MCQ_Q2 D 1.4 5StepToA5_2018e_p290_Q65 B 1.4 2020_MCQ_Q10 D 1.5.2 5StepToA5_2018e_p60_Q74 C T E S T D A I LY 1 T E S T D A I LY 1