1 Miscellaneous Vocabulary Object-Oriented Stuff Algorithms Software Design Testing and Types of Errors.

Slides:



Advertisements
Similar presentations
MATH 224 – Discrete Mathematics
Advertisements

Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Programming Types of Testing.
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Syllabus Case Histories WW III Almost Medical Killing Machine
Software Engineering Disasters
Introduction to Analysis of Algorithms
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
If You Missed Last Week Go to Click on Syllabus, review lecture 01 notes, course schedule Contact your TA ( on website) Schedule.
Computer Science 1620 Programming & Problem Solving.
Java Review 2 – Errors, Exceptions, Debugging Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 1 Program Design
Analysis of Algorithms COMP171 Fall Analysis of Algorithms / Slide 2 Introduction * What is Algorithm? n a clearly specified set of simple instructions.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
Computer Science 101 Introduction to Programming.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Introduction 01_intro.ppt
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Structured COBOL Programming, Stern & Stern, 9th edition
Introduction to CSCI-230: Software Development. Introduction Purchasing/developing software has become the largest single expenditure for companies Why.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
หลักการโปรแกรม เพื่อแก้ปัญหาโดยใช้คอมพิวเตอร์
Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.
1 Problem Solving with C++ The Object of Programming Walter Savitch Chapter 1 Introduction to Computers and C++ Programming Slides by David B. Teague,
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
©Silberschatz, Korth and Sudarshan1.1 Chapter 1: Introduction to Computers and Java Objects Background information  hardware  software  computer languages.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
1 Program Planning and Design Important stages before actual program is written.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.
Programming and Languages Dept. of Computer and Information Science IUPUI.
PROGRAM ESSENTIALS. TOKENS  SMALLEST UNITS OF A PROGRAM LANGUAGE  Special Symbols  Mathematical Operators  Punctuation  Word Symbols  Key Words.
©Silberschatz, Korth and Sudarshan1.1 Chapter 1: Introduction to Computers and Java Objects Background information  hardware  software  computer languages.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
The Hashemite University Computer Engineering Department
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Algorithms and Pseudocode
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 2 C++ Basics.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Lecture#1 Introduction
Software Engineering Algorithms, Compilers, & Lifecycle.
Harvard Mark I Howard Aiken was a pioneer in computing and a creator of conceptual design for IBM in the 1940s. He envisioned an electro-mechanical computing.
©Silberschatz, Korth and Sudarshan1.1 Chapter 1: Introduction to Computers and Java Objects Background information  hardware  software  computer languages.
Testing and Debugging.
Algorithm Analysis CSE 2011 Winter September 2018.
ECE 103 Engineering Programming Chapter 2 SW Disasters
Problem Solving Techniques
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Programming.
Programming Fundamentals (750113) Ch1. Problem Solving
Software Development Process
ICT Gaming Lesson 2.
Programming Fundamentals (750113) Ch1. Problem Solving
Software Engineering Disasters
CHAPTER 6 Testing and Debugging.
Presentation transcript:

1 Miscellaneous Vocabulary Object-Oriented Stuff Algorithms Software Design Testing and Types of Errors

2 The Object-Oriented (OO) Paradigm Some terminology:  Object-oriented programming  Object-oriented (programming) language  Object-oriented design  Object-oriented database, etc. What does the term “object-oriented” mean?  Based on the idea that all aspects of software – its design, implementation, internal structure – should be based on the real-world objects the software is associated with.  This is in contrast to structured design, which focuses on how data flows through a system, and what processes are applied to it.  The OO paradigm is a philosophy that has had, and continues to have, an impact on all aspects of software design and implementation.  Software can be designed an implemented in a variety of ways, and the OO paradigm is one.

3 Object-Oriented Programming: OOP Example - An OO software system for air traffic control would contain internal data items that correspond directly to:  aircraft  airports  passengers  runways, etc. You will learn more about the OO paradigm in other classes.

4 Algorithms An algorithm is a set of instructions (steps) for solving a problem:  each step must be clear and precise  each step must require finite resources  inputs and outputs must be specified precisely  the algorithm must be complete  unnecessary details are left out  must be finite in size Analogous to a recipe. An algorithm may be specified in a number of different formats:  natural language (such as English)  a diagram, such as a “flow chart”  a specific programming language  *pseudocode – a mix of natural and programming languages

5 Example of an Algorithm Algorithm for sorting a list of integers: Input: A list of integers. Output: The same list of integers, sorted from smallest to greatest. 1) Scan the list to find the smallest value. 2) Move that value to the first position. 3) Among the remaining values, find the next smallest value. 4) Move that value to the second position. : Continue the above process until the list is sorted. The above contains several ambiguities, e.g., what happens to the value already in the first position?

6 Example of an Algorithm Algorithm for sorting a list of integers : Input: A list of n integers, where n>=1. Output: The same list of integers, sorted from smallest to greatest. 1) i = 1 2) Repeat the following n-1 times: a. Scan the list to find the smallest value in positions i through n. b. Let j be the position where the smallest element is found. c. Swap the integer in position i with the integer in position j. d. i = i + 1 Informally, the above could be referred to as “pseudo-code”

7 Software Design Developers have learned that software must be carefully designed PRIOR to coding, and then inspected and tested for errors. A simple design process: 1. Define the problem clearly, precisely; understand the inputs and outputs 2. Describe the algorithms for solving the problem, usually in pseudo-code 3. Design objects, methods and classes your program needs 4. Re-evaluate your solution, and iteratively improve it, eliminating errors and inefficiencies whenever they are identified. Coding: 1. Write the code 2. Compile the code 3. Read the code (“structured walkthrough”) 4. Test the code 5. Fix any errors, and repeat

8 Testing and Debugging Even with careful programming, most programs will contain errors and must be thoroughly tested. Bug - a mistake in a program. Debugging - fixing mistakes in a program. Debugger – a software tool that helps with debugging.

9 Types of Errors Generally, there are three types of programming errors:  syntax  run-time  logic

10 Syntax The syntax of a programming language is the set of grammatical rules for that programming language. A syntax error is a grammatical mistake in a program.  misspelling a command, e.g., “pablic” instead of “public”  missing variable declaration  missing punctuation  using things inappropriately, e.g., assigning a string value to an int variable Syntax errors:  are caught by compiler, hence the phrase “compiler-time error”  relatively easy to fix  prevent the program from executing  frequently result in misleading error messages

11 Run-Time Errors An error that is detected when you program run (or executed) is called a run-time error*.  dividing a number by 0  accessing memory that was de-allocated  indexing out of bounds in an array  reading input from a file that is not open Run-time errors:  terminate a programs normal execution  occasionally detected by the compiler  occur intermittently  frequently result in misleading, incomplete or non-intelligible messages  frequently difficult to find and fix *Note: what is a run-time error in one language might be a logic-error in another

12 Logic Errors Just because a program compiles and runs without producing an error message does not mean the program is correct! Errors that cause programs to produce incorrect results are logic errors.  circleArea = radius * radius; // pi * radius * radius  sum = a - b; // should be sum = a + b; Logic errors:  not detected by the compiler  produce no run-time error messages  cause the program to take incorrect action, or produce incorrect results/output during program execution  occur intermittently  frequently difficult to find and fix

13 Run-time and Logic Errors Run-time errors and logic-errors can be INCREDIBLY damaging due to their intermittent and after-the-fact nature. For that reason, it is imperative that software engineers:  test extensively, on a variety of different test-cases  perform structured walk-throughs Testing and walk-thoughs can take a lot of time and money.

14 Run-Time and Logic Errors 1. Mariner Bugs Out (1962) Cost: $18.5 million Disaster: The Mariner 1 rocket with a space probe headed for Venus diverted from its intended flight path shortly after launch. Mission Control destroyed the rocket 293 seconds after liftoff. Cause: A programmer incorrectly transcribed a handwritten formula into computer code, missing a single superscript bar. Without the smoothing function indicated by the bar, the software treated normal variations of velocity as if they were serious, causing faulty corrections that sent the rocket off course.

15 Run-Time and Logic Errors 2. CIA Gives the Soviets Gas (1982) Cost: Millions of dollars, significant damage to Soviet economy Disaster: Control software went haywire and produced intense pressure in the Trans-Siberian gas pipeline, resulting in the largest man-made, non-nuclear explosion in Earth's history. Cause: CIA operatives allegedly planted a bug in a Canadian computer system purchased by the Soviets to control their gas pipelines. The purchase was part of a strategic Soviet plan to steal or covertly obtain sensitive U.S. technology. When the CIA discovered the purchase, they sabotaged the software so that it would pass Soviet inspection but fail in operation.

16 Run-Time and Logic Errors 3. World War III… Almost (1983) Cost: Nearly all of humanity Disaster: The Soviet early warning system falsely indicated the United States had launched five ballistic missiles. Fortunately the Soviet duty officer had a "funny feeling in my gut" and reasoned if the U.S. was really attacking they would launch more than five missiles, so he reported the apparent attack as a false alarm. Cause: A bug in the Soviet software failed to filter out false missile detections caused by sunlight reflecting off cloud-tops. See for one historical account of this incident.

17 Run-time and Logic Errors 4. Medical Machine Kills (1985) Cost: Three people dead, three people critically injured Disaster: Canada's Therac-25 radiation therapy machine malfunctioned and delivered lethal radiation doses to patients. Cause: Because of a subtle bug called a “race condition,” a technician could accidentally configure Therac-25 so the electron beam would fire in high-power mode without the proper patient shielding.