Lecture Chapter 2 Software Development

Similar documents
Chapter 1: Principles of Programming and Software Engineering

Chapter 1: Programming Principles

CSI33 Data Structures

Component-Level Design. Slides copyright 1996, 2001, 2005, 2009 by Roger S. Pressman. For non-profit educational use only

Object Oriented Programming

09. Component-Level Design

Overview of the lecture. Some key issues in programming Java programming. CMPT Data and Program Abstraction. Some of the key programming issues

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS SOFTWARE ENGINEERING

Design and Information Hiding

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Assertions. Assertions - Example

Lecture 7: Data Abstractions

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Software Design. Levels in Design Process. Design Methodologies. Levels..

What is an algorithm?

Chapter 1: Key Concepts of Programming and Software Engineering

(3-1) Functions II H&K Chapter 3. Instructor - Andrew S. O Fallon CptS 121 (September 5, 2018) Washington State University

Elementary Concepts of Object Class

Data Structures and Algorithms for Engineers

CS SOFTWARE ENGINEERING QUESTION BANK SIXTEEN MARKS

Introduction to Data Structures & Algorithm

Lethbridge/Laganière 2005 Chapter 9: Architecting and designing software 6

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

ECE 122. Engineering Problem Solving with Java

Topic : Object Oriented Design Principles

Chapter 4 Objectives

Information System Design (IT60105)

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED

Unit-3 Software Design (Lecture Notes)

Programmazione. Prof. Marco Bertini

Textbook. Topic 6: Functions. Motivation. What is a Function? What s a function? How can we use functions to write better software?

THE OBJECT-ORIENTED DESIGN PROCESS AND DESIGN AXIOMS (CH -9)

Gradational conception in Cleanroom Software Development


Systems Analysis and Design in a Changing World, Fourth Edition

Software Architecture

The software lifecycle and its documents

CHAPTER 9 DESIGN ENGINEERING. Overview

PC204. Lecture 5 Programming Methodologies. Copyright 2000 by Conrad Huang and the Regents of the University of California. All rights reserved.

CS112 Lecture: Defining Instantiable Classes

Agile Model-Driven Development with UML 2.0 SCOTT W. AM BLER. Foreword by Randy Miller UNIFIED 1420 MODELING LANGUAGE. gile 1.

CS560: Formal Modelling and Implementation of Systems (Term II)

Lecture 20: Implementation () / 33

CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

VETRI VINAYAHA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Object-Oriented Design

Object-Oriented Design

Abstract Data Types (ADT) and C++ Classes

Chapter 1. Introduction

Chapter 8: Class and Method Design

LECTURE 3: SOFTWARE DESIGN. Software Engineering Mike Wooldridge

What is an algorithm?

Software Design Heuristics

EINDHOVEN UNIVERSITY OF TECHNOLOGY

STUDENT LESSON A5 Designing and Using Classes

CPS122 Lecture: Detailed Design and Implementation

An Introduction to Software Architecture. David Garlan & Mary Shaw 94

Defining Classes and Methods

Objects First with Java

Dot and Scope Resolution Operator

There are three basic elements in object oriented programming: encapsulation, inheritance and polymorphism.

10조 이호진 이지 호

UNIT II Requirements Analysis and Specification & Software Design

Presenter: Dong hyun Park

Object-Oriented Design. Module UFC016QM. and Programming. Objects and Classes. O-O Design Unit 2: Faculty of Computing, Engineering

CSCI 253. Outline. Background. George Blankenship 1

ACRONYMS AND GLOSSARY

Component-Based Software Engineering TIP

References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 10/14/2004 1

Object-Oriented Modeling Using UML. CS151 Chris Pollett Aug. 29, 2005.

Object-Oriented Design

Key Features. Defect Rates. Traditional Unit testing: 25 faults / KLOC System testing: 25 / KLOC Inspections: / KLOC

Topic 3 Encapsulation - Implementing Classes

Verification and Validation. Verification and validation

Anatomy of a Class Encapsulation Anatomy of a Method

Classes, interfaces, & documentation. Review of basic building blocks

Lesson 10B Class Design. By John B. Owen All rights reserved 2011, revised 2014

CSC 330 Object Oriented Software Design. Software Design Phase

Introduction to Software Engineering p. 1 The Scope of Software Engineering p. 3 Historical Aspects p. 4 Economic Aspects p. 7 Maintenance Aspects p.

ABSTRACT DATA TYPES (ADTS) COMP1927 Computing 2 16x1 Sedgewick Chapter 4

Correctness of specifications. Correctness. Correctness of specifications (2) Example of a Correctness Proof. Testing versus Correctness Proofs

CHAPTER 5 GENERAL OOP CONCEPTS

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

IMACS: AP Computer Science A

Foundations of object orientation

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

CS 307: Software Engineering. Lecture 10: Software Design and Architecture

Object Oriented Programming

Program Correctness and Efficiency. Chapter 2

Absolute C++ Walter Savitch

This tutorial also elaborates on other related methodologies like Agile, RAD and Prototyping.

CSC Advanced Object Oriented Programming, Spring Specification

Chapter 4 Defining Classes I

Software Verification and Validation (VIMMD052) Introduction. Istvan Majzik Budapest University of Technology and Economics

SHRI ANGALAMMAN COLLEGE OF ENGINEERING & TECHNOLOGY (An ISO 9001:2008 Certified Institution) SIRUGANOOR,TRICHY

Software Reuse and Component-Based Software Engineering

CSC 330 Object-Oriented Software Design REUSABILITY

Software Design Fundamentals. CSCE Lecture 11-09/27/2016

Minsoo Ryu. College of Information and Communications Hanyang University.

Transcription:

Lecture Chapter 2 Software Development Large Software Projects Software Design o Team of programmers o Cost effective development Organization Communication Problem Solving Analysis of the problem Multiple solutions Selection of the best solution o Software solution Algorithms Step by step specification of the method Data collection & storage Organize the data in a manner that facilitates use o Personnel solution Implementation of the solution Acceptance of the solution Software Life Cycle Specification Design Risk Analysis Verification Coding Testing Refining Production Maintenance Incremental &/or Iterative development Life Cycle

Specification Specify all aspects of the problem Communicate with non-programmers Clarify unclear aspects of the specifications Determine valid input data appropriate error messages user base appropriate interface output required output format appropriate documentation Specify potential future enhancements Create a prototype program for user approval Design Identify and design modules objects Classes should be designed so that the objects are loosely coupled highly cohesive Tightly coupled objects High flow of information between objects Loosely coupled objects Changes in one object will have minimal effect on the other objects Highly cohesive objects perform only one well-designed task Interactions between objects Messages method calls data flows -- information flow Specify, in detail, the assumptions, input, and output for each method What data within the object is utilized by the method What does the method assume What actions are performed by the method How is the data changed by the method Specifications serve as a contract between method & the outside Contract serves to systematically decompose the program into smaller tasks delineate responsibilities among programmers &/or modules Precondition o the conditions that must exist at the beginning of a method Postcondition o the conditions that will exist at the end of the method Sufficient time spent in design less time required in implementation Reuse of Software Components Java Application Interface

Risk Analysis all projects specific projects known risks unknown risks affects o timetable o costs o life o health techniques to identify, assess, and manage some risks Verification formal methods for proving algorithms correct are incomplete Useful Aspects Of The Verification Process assertion statement regarding a condition at a specified point in an algorithm o Java assertion statements check the Jgrasp assertion feature invariant condition that is always true a a specified point in a program o loop invariant always true before & after each loop execution proving an algorithm is correct o proving each step of the algorithm is correct, i.e., for all appropriate assertions, an assertion before the step remains the same after the step is executed o errors encountered during the process should be corrected and the specifications modified if appropriate The result is less errors encountered during the programming Coding Translating the design into a particular programming language Not a major portion of the life cycle for most projects Testing Bottom Up Testing Range Limits Idiot Proof Refining the Original Solution Retesting The phases of the Life Cycle are not completely isolated from one another and not linear

Installation Acceptance Testing Production Black Box Cutover Parallel Testing Maintenance Users detect errors Request o enhancements, i.e., require more features o modifications to the existing software to better serve the users Fredrick Brooks Mythical Man-Month Ten Pounds in a Five Pound Bag First Solution -- Second Solution First solution is based on some simplifying assumptions Refined solution provides a sophisticated program that meets the original program specifications Good Solution Computer Program performs specified task real tangible cost o total cost over all phases of the life cycle + the burial costs o efficiency choice of a solutions components algorithms choice of data structure & storage o code reusability code libraries & open source repositories components developed within a project reused multiple times in the same projects reused unchanged in other projects embedded in other components

Abstraction Procedural Abstraction o embed procedure in a Black Box, i.e., a module, a class, an object o users of the procedure know it s pre and post conditions, but not how it performs its tasks o separates the purpose of a method from its implementation o helps to segment the design into loosely coupled and highly cohesive modules o Java API, e.g., Math.abs(), Math.tan(), etc. Data Abstraction o collection of data o set of operations on that data, with a focus on what the operations will do to the data without any consideration of how to implement them Abstract Data Type (ADT) o collection of data o specification of the set of operations that can manipulate that data o implemented by defining data structures and creating methods in a selected computer language Problem Solving o Develop ADT s and algorithms at the same time o Global Algorithm support algorithms and ADT s (top-down design) o Collection of feasible ADT s and related algorithms Set of Potential Global Algorithms (bottom-up design) o Algorithms clever data structure solution o Data Structure clever algorithm solution Information Hiding o Abstraction write a specification that describes the outside, i.e., public view of a module identify details that should remain private, i.e., should be hidden from the public view User of a Module do not worry about the implementation details. Implementer of a Module do not worry about the use of the module.

Object Oriented Design Object encapsulates o data o actions identification o nouns objects o verbs actions o objects of the same type class inheritance classes can inherit properties from other classes polymorphism o objects can determine appropriate operations at execution time o the outcome of a particular operation depends upon the objects being acted upon functional decomposition (top-down design) o break a task into smaller subtasks o structure chart (Prichard 3 rd ed pg 101) General Design Guidelines 1. Use Object-Oriented Design (OOD), i.e., objects & ADTs, and Functional Decomposition (FD), i.e., algorithmic structure charts, to produce modular solutions 2. Use OOD for problems that primarily involve data 3. Use FD to design algorithms for an objects operations 4. As a first approach, use FD to design solutions to problems that emphasize algorithms over data. During the design process, keep watch for signs that the OOD approach would yield better results. 5. Keep the focus on WHAT when designing ADTs & algorithms 6. Incorporate reusable software components into the design where possible

Unified Modeling Language (UML) Class Name Data Items Operations (Methods) data members visibility name: type = defaultvalue --, + hour: integer = 1 operations visibility name(parameter-list); return-type {property-string} -, + parameter-list direction name: type = defaultvalue in, out gethour: integer = 1 + settime(in hr: integer, in min: integer, in sec: integer): void

Bank -name: string - routingnum: integer -createaccount() Containment 1 Cardinality one to many Account -accountnum: integer - balance: float +getbalance( ) {query} +withdraw( ) +deposit( ) 1 Customer -custname: string - address: string Checking -chargepercheck: float - numcheck: integer -minbalance: float -createaccount() Savings -interestrate: float +getbalance( ) {query}

Object-Oriented Programming time expended on design will increase solution will be more general than is absolutely necessary implementation time will be reduced improved program maintenance and verification stages o change in ancestor class change in all descendant classes o add descendant classes that do not affect the ancestor class o add descendant classes modifies the ancestor s original behavior Design Procedure specification of each class including data and operations implementation of each class identify families of related classes o identify the ancestor class o implement the descendant classes test each class o write test program to exercise each operation wrt specifications o write test programs to exercise sets of classes working together to solve a larger programs (expands up to the set which encompasses the entire project) Key Programming Issues Modularity o Programming tasks become more difficult as the size and complexity of a program grows; modularity reduces the rate at which the difficulty grows o Permits team programming, i.e., permits the continuation of current programming efforts o Isolates errors; debugging a modular program is reduced to debugging many small programs o Facilitates reading the program o Isolates modifications; modifying modular program is reduced to a small set of relatively simple modifications to isolated parts of the program o Eliminates redundant code Strive for modularity in all phases of the program-solving problem Modifiability Ease of Use

Fail-Safe Programming o Input Errors Prohibited by Code o Logic Errors Eliminated by EXTENSIVE Testing o Hardware Errors Eliminated Hardened Hardware Isolated Power Sources Multiple Systems Voting on Outcomes o Life-Support Systems o Financial Systems Idiot-Proof Programming o Prichard 3 rd ed pgs 112-116 Style o Extensive Use of Methods o Private Data Fields accessor methods mutator methods o Error Handling o Readability good structure & design well-chosen identifiers that describe their purpose readable indentation next-line blocks DO NOT USE end-of-line blocks 2-4 spaces beware of rightward drift blank lines to separate modules, methods, blocks, etc. well-chosen documentation

Program Documentation 1. Program Comment a. Statement of Purpose b. Author & Date c. Description of Input/Output d. Description of how to Use the Program e. Assumptions about the type of data expected f. Statement of Exceptions g. Brief Description of the Major Classes 2. Comment in Each Class a. Statement of Purpose b. Description of the Data contained in the Class 3. Comment at the Beginning of Each Method a. Statement of Purpose b. Preconditions c. Postconditions d. Method Called 4. Comments in the Bodies of Selected Methods that explain important features or subtle logic Write the Documentation While Writing the Code Make sure that you write Comments for Users of the Methods and Comments for Programmers who will revise the Implementations Debugging o Debugger step by step breakpoints o System.out.println( ) statements o Use the invariants established for various parts of the program o Dump selected data structures, e.g., arrays