C plus data structures
Download
1 / 32

C++ Plus Data Structures - PowerPoint PPT Presentation


  • 112 Views
  • Uploaded on

C++ Plus Data Structures. Nell Dale Chapter 1 Software Engineering Principles Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore County - Essex Campus. Software Design Process. Programming Life Cycle Activities. Problem analysis understand the problem

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' C++ Plus Data Structures' - kelsie-ball


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
C plus data structures

C++ Plus Data Structures

Nell Dale

Chapter 1

Software Engineering Principles

Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore County - Essex Campus



Programming life cycle activities
Programming Life Cycle Activities

  • Problem analysisunderstand the problem

  • Requirements definitionspecify what program will do

  • High- and low-level designhow it meets requirements

  • Implementation of designcode it

  • Testing and verificationdetect errors, show correct

  • Deliveryturn over to customer

  • Operation use the program

  • Maintenancechange the program


Software engineering
Software Engineering

  • A disciplined approach to the design, production, and maintenance of computer programs

  • that are developed on time and within cost estimates,

  • using tools that help to manage the size and complexity of the resulting software products.


Toolboxes
Toolboxes:

  • Hardware.

  • Software

  • Ideaware (focus of the course!): the shared body of knowledge that programmers have collected over time, including algorithms, data structures, programming methodologies, tools…


An algorithm is
An Algorithm Is . . .

  • A logical sequence of discrete steps that describes a complete solution to a given problem computable in a finite amount of time.


Goals of quality software
Goals of Quality Software

  • It works.

  • It can be read and understood.

  • It can be modified.

  • It is completed on time and within budget.


Specification understanding the problem
Specification: Understanding the Problem

Detailed Program Specification

  • Tells what the program must do, but not how it does it.

  • Is written documentation about the program.


Writing detailed specifications
Writing Detailed Specifications

Detailed Program Specification Includes:

  • Inputs

  • Outputs

  • Processing requirements

  • Assumptions



Abstraction
Abstraction

  • A model of a complex system that includes only the details essential to the perspective of the viewer of the system.


Information hiding
Information Hiding

  • Hiding the details of a function or data structure with the goal of controlling access to the details of a module or structure.

    PURPOSE: To prevent high-level designs from depending on low-level design details that may be changed.


Two approaches to building manageable modules

Identifies various

objects composed of

data and operations,

that can be used

together to solve

the problem.

Divides theproblem

intomore easily handled

subtasks,until the

functional modules

(subproblems) can

be coded.

Two Approaches to Building Manageable Modules

FUNCTIONALDECOMPOSITION

OBJECT-ORIENTED DESIGN

FOCUS ON: processes FOCUS ON: data objects


Functional design modules

Find

Weighted

Average

Print

Weighted

Average

Functional Design Modules

Main

Get Data

Prepare

File for

Reading

Print Data

Print Heading


Object oriented design
Object-Oriented Design

A technique for developing a program in which the solution is expressed in terms of objects -- self- contained entities composed of data and operations on that data.

cin

cout

<<

>>

setf

get

Private data

Private data

.

.

.

.

.

.

ignore


More about ood
More about OOD

  • Languages supporting OOD include: C++, Java, Smalltalk, Eiffel, and Object-Pascal, C, …

  • Aclass is a programmer-defined data type and objects are variables of that type.

  • In C++, cin is an object of a data type (class) named istream, and cout is an object of a class ostream. Header files iostream.h and fstream.h contain definitions of stream classes.


Procedural vs object oriented code
Procedural vs. Object-Oriented Code

“Read the specification of the software you want to build. Underline the verbs if you are after procedural code, the nouns if you aim for an object-oriented program.”

Brady Gooch, “What is and Isn’t Object Oriented Design,” 1989.


Verification of software correctness
Verification of Software Correctness

  • Testing

  • Debugging

  • Program verification


Program Verification

  • Program Verification is the process of determining the degree to which a software product fulfills its specifications.

SPECIFICATIONS

Inputs

Outputs

Processing

Requirements

Assumptions

PROGRAM


Program testing

DATA SET 1

DATA SET 2

DATA SET 3

Program Testing

  • Testing is the process of executing a program with various data sets designed to discover errors.

DATA SET 4

. . .


Origin of bugs
Origin of Bugs

Various Types of Errors:

  • Design errors occur when specifications are wrong

  • Compile errors occur when syntax is wrong

  • Run-time errors result from incorrect assumptions, incomplete understanding of the programming language, or unanticipated user errors.



Robustness
Robustness

  • Robustness is the ability of a program to recover following an error; the ability of a program to continue to operate within its environment.


An assertion
An Assertion

  • Is a logical proposition that is either true or false (not necessarily in C++ code).

    EXAMPLES

    studentCount is greater than 0

    sum is assigned && count > 0

    response has value ‘y’ or ‘n’

    partNumber == 5467


Preconditions and postconditions
Preconditions and Postconditions

  • The precondition is an assertion describing what a function requires to be true before beginning execution.

  • The postcondition describes what must be true at the moment the function finishes execution.

  • The caller is responsible for ensuring the precondition, and the function code must ensure the postcondition.

FOR EXAMPLE . . .


Design review activities
Design Review Activities

  • Deskchecking: tracing an execution of a design or program on paper (checklist Fig1.4, pg31).

  • Walk-through: a verification method in which a team performs a manual simulation of the program or design.

  • Inspection: a verification method in which one member of a team reads the program or design line by line an the others point out errors.


Program testing1
Program Testing

  • Unit Testing: testing a module or function by itself

  • Data Coverage: testing all possible input values (Black Box Testing)

  • Code Coverage: testing program paths (Clear/White Box Testing)

  • Test Plans

  • Planning for Debugging

  • Integration Testing


Tasks within each test case
Tasks within each test case:

  • determine inputs that demonstrate the goal.

  • determine the expected behavior for the input.

  • run the program and observe results.

  • compare expected behavior and actual behavior. If they differ, we begin debugging.


Integration testing
Integration Testing

  • Is performed to integrate program modules that have already been independently unit tested.

Main

Get Data

Prepare

File for

Reading

Find

Weighted

Average

Print

Weighted

Average

Print Data

Print Heading


Integration testing approaches
Integration Testing Approaches

TOP-DOWN

BOTTOM-UP

Ensures individual modules

work together correctly,

beginning with the

lowest level.

Ensures correct overall

design logic.

USES: placeholder USES: a test driver to call

module “stubs” to test the functions being tested.

the order of calls.



Life cycle verification activities
Life-Cycle Verification Activities:

  • Analysis

  • Design

  • Code

  • Test

  • Delivery

  • Maintenance


ad