CSCI 3428: Software Engineering Tami Meredith Chapter 7 Writing the Programs.

Slides:



Advertisements
Similar presentations
Chapter 11 Introduction to Programming in C
Advertisements

The Therac-25: A Software Fatal Failure
An Investigation of the Therac-25 Accidents Nancy G. Leveson Clark S. Turner IEEE, 1993 Presented by Jack Kustanowitz April 26, 2005 University of Maryland.
+ THE THERAC-25 - A SOFTWARE FATAL FAILURE Kpea, Aagbara Saturday SYSM 6309 Spring ’12 UT-Dallas.
Tailoring Needs Chapter 3. Contents This presentation covers the following: – Design considerations for tailored data-entry screens – Design considerations.
Software Engineering and Design Principles Chapter 1.
Chapter3: Language Translation issues
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
Pseudocode and Algorithms
Chapter 2: Input, Processing, and Output
CSE1301 Computer Programming: Lecture 13 Documentation.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
Lecturer: Dr. AJ Bieszczad Chapter 76-1 Software engineering standards Standards for you Standards for others Matching design with implementation.
CH07: Writing the Programs Does not teach you how to program, but point out some software engineering practices that you should should keep in mind as.
DJ Wattam, Han Junyi, C Mongin1 COMP60611 Directed Reading 1: Therac-25 Background – Therac-25 was a new design dual mode machine developed from previous.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
CHAPTER:14 Programming Methodology Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Therac 25 Nancy Leveson: Medical Devices: The Therac-25 (updated version of IEEE Computer article)
chap13 Chapter 13 Programming in the Large.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
1 The Software Development Process  Systems analysis  Systems design  Implementation  Testing  Documentation  Evaluation  Maintenance.
07 Coding Conventions. 2 Demonstrate Developing Local Variables Describe Separating Public and Private Members during Declaration Explore Using System.exit.
Chapter 4: Control Structures I (Selection). Objectives In this chapter, you will: – Learn about control structures – Examine relational and logical operators.
PROGRAMMING METHODOLOGY STYLISTIC GUI DELINES Meaningful Names for Identifiers. Guidelines followed while dealing with identifiers. 1. Assign meaningful.
Programming Concepts Chapter 3.
School of Computer Science & Information Technology G6DICP - Lecture 9 Software Development Techniques.
Chapter 02 (Part III) Introduction to C++ Programming.
SE: CHAPTER 7 Writing The Program
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Chapter 5: Control Structures II (Repetition). Objectives In this chapter, you will: – Learn about repetition (looping) control structures – Learn how.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
CMSC 345 Programming. Organization of Coding Process Select “core” to implement first, following an incremental development model Reconsider architectural.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 3, Lecture 1.
Therac-25 CS4001 Kristin Marsicano. Therac-25 Overview  What was the Therac-25?  How did it relate to previous models? In what ways was it similar/different?
The Software Development Process
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
PROGRAMMING GUIDELINES. SYLISTIC GUIDELINES  Meaningful names for identifiers Identifiers identify different parts of C++ programs. Identifiers should.
Computer Programming CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming.
Embedded Programming B. Furman 09MAY2011. Learning Objectives Distinguish between procedural programming and embedded programming Explain the Events and.
The Hashemite University Computer Engineering Department
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
A disciplined approach to analyzing malfunctions –Provides feedback into the redesign process 1.Play protocol, searching for malfunctions 2.Answer four.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Directed Reading 1 Girish Ramesh – Andres Martin-Lopez – Bamdad Dashtban –
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Component 1.6.
Working with Java.
Chapter 2: Input, Processing, and Output
DDC 1023 – Programming Technique
Revision Lecture
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Some Simple Definitions for Testing
PROGRAMMING METHODOLOGY
Chapter 2- Visual Basic Schneider
Chapter 2- Visual Basic Schneider
CMSC 345 Programming.
Chapter 2: Input, Processing, and Output
Presentation transcript:

CSCI 3428: Software Engineering Tami Meredith Chapter 7 Writing the Programs

Standards A prescribed set of rules for esthetic, syntactic, and semantic choices in order to create uniformity Examples: Location of parentheses Variable naming convention i++; vs. i += 1; Blank lines, comments, etc. When to use Macros vs. Functions vs. Inlining Generally specific to a company/culture E.g.:

Why? Help others understand your code Improves readability Reduces time/costs Assists in error detection during reviews Assist in automatic translations Improves portability Reduce decision making when coding Can help organise your thinking Esthetics easily managed using a pretty printer such as gnu indent (low overhead!)

Programming Guidelines Control Structures Aim for linearity Algorithms Execution time vs. {cost, time, understandability, testing, maintainability,...} Data Structures Simplicity, sufficiency, extendability

Good Practice Localisation of input and output Localisation of variable definitions Including pseudocode Revise and rewrite – NOT patching Maximise reuse Write once, debug once Reduce code size and reduce bug count Reasonable subtype depth Avoid over-commenting Unnecessary "efficiency" – clarity should come first

Documentation: Internal Header comment block Comments are "value added" Meaningful variable, function, and label names Formatting to improve understanding Symbolic constants Data maps to describe data structures Stuff to make reading/understanding the code easier

Bad Comments Obscure readability Are out of date or wrong screen space and make blocks harder to see Hide or obscure code int /* function */ main (argc, argv) /* mainline for application requires */ int argc; /* count of arguments as number */ char **argv; /* array of arguments as ints and returns an integer that is the exit value */

Function Header Blocks Name, Author, Date Revision History Purpose Notes on operation Expected I/O Logic, flow, error-handling Testing notes Expected extensions or revisions

Documentation: External Specifications, Requirements Programming Rationales Problem Assumptions, Constraints, Limitations Algorithms Data Structures Links to Specifications QUIRKS! Stuff people won't know from reading the code!

Things that can help... Identifying related problems Restating (explaining) the problem Decomposing the problem Exploring assumptions "Thinking out of the box" Programming the "wrong" thing

Fry Me! Famous Moments in Software Engineering AECL Therac 25 (1985) AECL did not have the software code independently reviewed. AECL did not consider the design of the software during its assessment of how the machine might produce the desired results and what failure modes existed. The system noticed that something was wrong and halted the X-ray beam, but merely displayed the word "MALFUNCTION" followed by a number from 1 to 64. The user manual did not explain or even address the error codes, so the operator pressed the P key to override the warning and proceed anyway. AECL personnel, as well as machine operators, initially did not believe complaints. This was likely due to overconfidence. AECL had never tested the Therac-25 with the combination of software and hardware until it was assembled at the hospital.

The failure only occurred when a particular nonstandard sequence of keystrokes was entered on the VT-100 terminal which controlled the PDP-11 computer: an "X" to (erroneously) select 25MV photon mode followed by "cursor up", "E" to (correctly) select 25 MeV Electron mode, then "Enter", all within 8 seconds.This sequence of keystrokes was improbable, and so the problem did not occur very often and went unnoticed for a long time. The design did not have any hardware interlocks to prevent the electron-beam from operating in its high-energy mode without the target in place. The engineer had reused software from older models. These models had hardware interlocks that masked their software defects. Those hardware safeties had no way of reporting that they had been triggered, so there was no indication of the existence of faulty software commands. The hardware provided no way for the software to verify that sensors were working correctly (i.e., an open-loop controller). The table-position system was the first implicated in Therac-25's failures; the manufacturer revised it with redundant switches to cross-check their operation. The equipment control task did not properly synchronize with the operator interface task, so that race conditions occurred if the operator changed the setup too quickly. This was missed during testing, since it took some practice before operators were able to work quickly enough to trigger this failure mode. The software set a flag variable by incrementing it. Occasionally an arithmetic overflow occurred, causing the software to bypass safety checks