Principles of Programming and Software Engineering

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

CHAPTER 1 SOFTWARE DEVELOPMENT. 2 Goals of software development Aspects of software quality Development life cycle models Basic concepts of algorithm.
Object Oriented Design An object combines data and operations on that data (object is an instance of class) data: class variables operations: methods Three.
Software Engineering and Design Principles Chapter 1.
Introduction To System Analysis and Design
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
Overview. Why data structures is a key course Main points from syllabus Survey Warmup program And now to get started...
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Data Abstraction & Problem Solving with C++ Fifth Edition by Frank.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Lecture 5 Introduction to Software Engineering Overview  What is Software Engineering  Software Engineering Issues  Waterfall Model  Waterfall Model.
Chapter 1 Principles of Programming and Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Software Engineering Principles and C++ Classes
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
Data Abstraction: The Walls
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Data Structures and Programming.  John Edgar2.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Software.
Introduction To System Analysis and design
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Software Life Cycle Requirements and problem analysis. –What exactly is this system supposed to do? Design –How will the system solve the problem? Coding.
1 C++ Plus Data Structures Nell Dale Chapter 1 Software Engineering Principles Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore.
SE: CHAPTER 7 Writing The Program
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
1 Systems Analysis and Design in a Changing World, Thursday, January 18, 2007.
1 Life Cycle of Software Specification Design –Risk Analysis –Verification Coding Testing –Refining –Production Maintenance.
Software Development. Software Developers Refresher A person or organization that designs software and writes the programs. Software development is the.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Data Structures Using C++1 Chapter 1 -Software Engineering Principles -ADT and Classes.
1 Software Development Software Engineering is the study of the techniques and theory that support the development of high-quality software The focus is.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Designing Classes Prelude © 2015 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures and Abstractions with Java, 4e Frank.
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
1-1 Software Development Objectives: Discuss the goals of software development Identify various aspects of software quality Examine two development life.
Data Structures Using C++ 2E
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation.
Chapter 2 Principles of Programming and Software Engineering.
Principles of Programming. Achieving an Object-Oriented Design  Abstraction and Information Hiding  Object-Oriented Design  Functional Decomposition.
Principles of Programming & Software Engineering
Chapter 2 Object-Oriented Paradigm Overview
CSE 219 Final exam review.
Data Abstraction: The Walls
C++ Plus Data Structures
Chapter 11 Object-Oriented Design
DATA ABSTRACTION AND PROBLEM SOLVING WITH C++
Data Abstraction: The Walls
Chapter 1 Data Abstraction: The Walls
About the Presentations
Figure 1.1 The life cycle of software as a water wheel that can rotate from one phase to any of phase.
Figure 1.1 The life cycle of software as a water wheel that can rotate from one phase to any of phase.
Designing and Debugging Batch and Interactive COBOL Programs
Chapter 1 Software Engineering.
Unit# 9: Computer Program Development
Component-Level Design
Slides by Steve Armstrong LeTourneau University Longview, TX
Need for the subject.
Chapter 2. Problem Solving and Software Engineering
Software Development Chapter 1.
Presentation transcript:

Principles of Programming and Software Engineering Chapter 1 Principles of Programming and Software Engineering

Problem Solving and Software Engineering Coding without a solution design increases debugging time A team of programmers for a large software development project involves An overall plan Organization Communication Software engineering Provides techniques to facilitate the development of computer programs © 2005 Pearson Addison-Wesley. All rights reserved

What is Problem Solving? The process of taking the statement of a problem and developing a computer program that solves that problem A solution consists of: Algorithms Algorithm: a step-by-step specification of a function to solve a problem within a finite amount of time Ways to store data © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Figure 1.1 The life cycle of software as a waterwheel that can rotate from one phase to any other phase © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 1: Specification Aspects of the problem which must be specified: What is the input data? What data is valid and what data is invalid? Who will use the software, and what user interface should be used? What error detection and error messages are desirable? What assumptions are possible? Are there special cases? What is the form of the output? What documentation is necessary? What enhancements to the program are likely in the future? © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 1: Specification (Continued) Prototype program A program that simulates the behavior of portions of the desired software product Phase 2: Design Includes: Dividing the program into modules Specifying the purpose of each module Specifying the data flow among modules © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 2: Design (Continued) Modules Self-contained units of code Should be designed to be: Loosely coupled Highly cohesive Interfaces Communication mechanisms among modules © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 2: Design (Continued) Specifications of a function A contract between the function and the module that calls it Should not commit the function to a particular way of performing its task Include the function’s preconditions and postconditions Phase 3: Risk Analysis Building software entails risks Techniques exist to identify, assess, and manage the risks of creating a software product © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 4: Verification Formal methods can be used to prove that an algorithm is correct Assertion A statement about a particular condition at a certain point in an algorithm Invariant A condition that is always true at a particular point in an algorithm © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 4: Verification (Continued) Loop invariant A condition that is true before and after each execution of an algorithm’s loop Can be used to detect errors before coding is started The invariant for a correct loop is true: Initially, after any initialization steps, but before the loop begins execution Before every iteration of the loop After every iteration of the loop After the loop terminates © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 5: Coding (Continued) Involves: Translating the design into a particular programming language Removing syntax errors Phase 6: Testing Removing the logical errors © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 6: Testing (Continued) Test data should include: Valid data that leads to a known result Invalid data Random data Actual data Phase 7: Refining the Solution More sophisticated input and output routines Additional features More error checks © 2005 Pearson Addison-Wesley. All rights reserved

The Life Cycle of Software Phase 8: Production Involves: Distribution to the intended users Use by the users Phase 9: Maintenance Involves Correcting user-detected errors Adding more features Modifying existing portions to suit the users better © 2005 Pearson Addison-Wesley. All rights reserved

What is a Good Solution? A solution is good if: The total cost it incurs over all phases of its life cycle is minimal © 2005 Pearson Addison-Wesley. All rights reserved

What is a Good Solution? The cost of a solution includes: Computer resources that the program consumes Difficulties encountered by users Consequences of a program that does not behave correctly Programs must be well structured and documented Efficiency is one aspect of a solution’s cost © 2005 Pearson Addison-Wesley. All rights reserved

Achieving a Modular Design: Abstraction Separates the purpose of a module from its implementation Specifications for each module are written before implementation Functional abstraction Separates the purpose of a function from its implementation © 2005 Pearson Addison-Wesley. All rights reserved

Achieving a Modular Design Data abstraction Focuses of the operations of data, not on the implementation of the operations Abstract data type (ADT) A collection of data and operations on the data An ADT’s operations can be used without knowing how the operations are implemented, if the operations’ specifications are known © 2005 Pearson Addison-Wesley. All rights reserved

Achieving a Modular Design Data structure A construct that can be defined within a programming language to store a collection of data © 2005 Pearson Addison-Wesley. All rights reserved

Achieving a Modular Design Information hiding Hide details within a module Ensure that no other module can tamper with these hidden details Public view of a module Described by its specifications Private view of a module Consists of details which should not be described by the specifications © 2005 Pearson Addison-Wesley. All rights reserved

Object-Oriented Design Principles of object-oriented programming (OOP) Encapsulation Objects combine data and operations Inheritance Classes can inherit properties from other classes Polymorphism Objects can determine appropriate operations at execution time © 2005 Pearson Addison-Wesley. All rights reserved

Object-Oriented Design Advantages of an object-oriented approach Existing classes can be reused Program maintenance and verification are easier © 2005 Pearson Addison-Wesley. All rights reserved

Top-Down Design Object-oriented design (OOD) Produces modular solutions for problems that primarily involve data Identifies objects by focusing on the nouns in the problem statement © 2005 Pearson Addison-Wesley. All rights reserved

Top-Down Design Top-down design (TDD) Produces modular solutions for problems in which the emphasis is on the algorithms Identifies actions by focusing on the verbs in the problem statement A task is addressed at successively lower levels of detail © 2005 Pearson Addison-Wesley. All rights reserved

Top-Down Design Figure 1.4 A structure chart showing the hierarchy of modules © 2005 Pearson Addison-Wesley. All rights reserved

General Design Guidelines Use OOD and TDD together Use OOD for problems that primarily involve data Use TDD to design algorithms for an object’s operations © 2005 Pearson Addison-Wesley. All rights reserved

General Design Guidelines Consider TDD to design solutions to problems that emphasize algorithms over data Focus on what, not how, when designing both ADTs and algorithms Consider incorporating previously written software components into your design © 2005 Pearson Addison-Wesley. All rights reserved

Modeling Object-Oriented Design Using UML The Unified Modeling Language (UML) is a modeling language used to express object-oriented designs Class diagrams specify the name of the class, the data members of the class, and the operations © 2005 Pearson Addison-Wesley. All rights reserved

Modeling Object-Oriented Design Using UML UML (Continued) Relationships between classes can be shown by connecting classes with lines Inheritance is shown with a line and an open triangle to the parent class Containment is shown with an arrow to the containing class UML provides notation to specify visibility, type, parameter, and default value information © 2005 Pearson Addison-Wesley. All rights reserved

UML Diagrams Figure 1.6 UML diagram for a banking system © 2005 Pearson Addison-Wesley. All rights reserved

A Summary of Key Issues in Programming Modularity has a favorable impact on Constructing programs Debugging programs Reading programs Modifying programs Eliminating redundant code © 2005 Pearson Addison-Wesley. All rights reserved

A Summary of Key Issues in Programming Modifiability is possible through the use of Function Named constants The typedef statement © 2005 Pearson Addison-Wesley. All rights reserved

A Summary of Key Issues in Programming Ease of use In an interactive environment, the program should prompt the user for input in a clear manner A program should always echo its input The output should be well labeled and easy to read © 2005 Pearson Addison-Wesley. All rights reserved

A Summary of Key Issues in Programming Fail-Safe Programming Fail-safe programs will perform reasonably no matter how anyone uses it Test for invalid input data and program logic errors Handle errors through exception handling © 2005 Pearson Addison-Wesley. All rights reserved

A Summary of Key Issues in Programming Eight issues of personal style in programming Extensive use of functions Use of private data fields Avoidance of global variables in functions Proper use of reference arguments © 2005 Pearson Addison-Wesley. All rights reserved

A Summary of Key Issues in Programming Eight issues of personal style in programming (Continued) Proper use of functions Error handling Readability Documentation © 2005 Pearson Addison-Wesley. All rights reserved

A Summary of Key Issues in Programming Debugging Programmer must systematically check a program’s logic to determine where an error occurs Tools to use while debugging: Watches Breakpoints cout statements Dump functions © 2005 Pearson Addison-Wesley. All rights reserved

Summary Software engineering: techniques to facilitate development of programs Software life cycle consists of nine phases Loop invariant: property that is true before and after each iteration of a loop Evaluating the quality of a solution must consideration a variety of factors © 2005 Pearson Addison-Wesley. All rights reserved

Summary A combination of object-oriented and top-down design techniques leads to a modular solution The final solution should be as easy to modify as possible A function should be as independent as possible and perform one well-defined task © 2005 Pearson Addison-Wesley. All rights reserved

Summary Functions should include a comment: purpose, precondition, and postcondition A program should be as fail-safe as possible Effective use of available diagnostic aids is one of the keys to debugging Use “dump functions” to help to examine and debug the contents of data structures © 2005 Pearson Addison-Wesley. All rights reserved