41
Chapter 1 Chapter 1 Software Engineering Software Engineering

Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

  • View
    216

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Chapter 1 Chapter 1

Software EngineeringSoftware Engineering

Page 2: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

HomeworkHomework

►Read Section 2.2 (pages 79-98)Read Section 2.2 (pages 79-98)►Answer questions:Answer questions:►7, 8, 11, 12, & 13 on page 134.7, 8, 11, 12, & 13 on page 134.►Answer on paper, hand in on Wed. Answer on paper, hand in on Wed.

(before lab).(before lab).

Page 3: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Software EngineeringSoftware Engineering

► The discipline devoted to the The discipline devoted to the design, design, production, and production, and maintenance of maintenance of

► computer programs that are developed computer programs that are developed on time and on time and within cost estimates, within cost estimates,

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

Page 4: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

The Software Life CycleThe Software Life Cycle

►Problem analysisProblem analysis►Requirements elicitationRequirements elicitation►Software specificationSoftware specification►High- and low-level designHigh- and low-level design► ImplementationImplementation

Page 5: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

The Software Life Cycle The Software Life Cycle (Cont’d)(Cont’d)

►Testing and VerificationTesting and Verification►DeliveryDelivery►Operation Operation ►MaintenanceMaintenance

Page 6: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Programmer ToolboxesProgrammer Toolboxes

►Hardware—the computers and their Hardware—the computers and their peripheral devicesperipheral devices

►Software—operating systems, editors, Software—operating systems, editors, compilers, interpreters, debugging compilers, interpreters, debugging systems, test-data generators, and so systems, test-data generators, and so onon

Page 7: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Programmer Toolboxes Programmer Toolboxes (Con’td)(Con’td)

► IdeawareIdeaware AlgorithmsAlgorithms Data structuresData structures Programming methodologiesProgramming methodologies

►Design aidsDesign aids CRC cardsCRC cards Unified Modeling LanguageUnified Modeling Language ScenariosScenarios

Page 8: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Programmer Toolboxes Programmer Toolboxes (Con’td)(Con’td)

►Software ConceptsSoftware Concepts Information hidingInformation hiding Data encapsulatingData encapsulating AbstractionAbstraction

Page 9: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Goals of Quality Software Goals of Quality Software

► It works.It works.► It can be modified without excessive It can be modified without excessive

time and effort.time and effort.► It is reusable.It is reusable.► It is completed on time and within It is completed on time and within

budget. budget.

Page 10: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Recommended Program Recommended Program SpecificationSpecification

►Processing requirementsProcessing requirements►Sample inputs with expected outputsSample inputs with expected outputs►AssumptionsAssumptions►Definition of termsDefinition of terms►A test planA test plan

Page 11: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Detailed Program SpecificationDetailed Program Specification

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

► Is written documentation about the Is written documentation about the program.program.

Page 12: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

AbstractionAbstraction

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

►Programs are abstractions.Programs are abstractions.

Page 13: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Abstraction Abstraction (cont’d)(cont’d)

Page 14: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Information HidingInformation Hiding

►The practice of hiding the details of a The practice of hiding the details of a module with the goal of controlling module with the goal of controlling access to the details from the rest of access to the details from the rest of the system.the system.

► A programmer can concentrate on A programmer can concentrate on one module at a time.one module at a time.

►Each module should have a single Each module should have a single purpose or identity.purpose or identity.

Page 15: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Stepwise RefinementStepwise Refinement

► A problem is approached in stages. Similar A problem is approached in stages. Similar steps are followed during each stage, with steps are followed during each stage, with the only difference being the level of detail the only difference being the level of detail involved. Some variations:involved. Some variations: Top-downTop-down Bottom-upBottom-up Functional decompositionFunctional decomposition Round-trip gestalt designRound-trip gestalt design

Page 16: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Visual Aids—CRC cardsVisual Aids—CRC cards

Page 17: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Day 2Day 2

AgendaAgenda

1.1. Finish up Chapter 1Finish up Chapter 1

2.2. Concentrate on ADTConcentrate on ADT

3.3. Do a little ADT experimentDo a little ADT experiment

4.4. Prepare for Lab 1Prepare for Lab 1

Page 18: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

RemindersReminders

►Homework is due on Wed.Homework is due on Wed.►On paperOn paper►Hand in before labHand in before lab►Also, Read pages 1-11 of Lab 1Also, Read pages 1-11 of Lab 1►You don’t have to do the pre-lab You don’t have to do the pre-lab

exercise unless you want to, but you exercise unless you want to, but you should read up so you’re not clueless should read up so you’re not clueless about the lab.about the lab.

Page 19: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

A Short Review of Object-A Short Review of Object-Oriented ProgrammingOriented Programming

►Three inter-related constructs: Three inter-related constructs: classes, objects, and inheritanceclasses, objects, and inheritance

►Objects are the basic run-time Objects are the basic run-time entities in an object-oriented entities in an object-oriented system.system.

►A class defines the structure of its A class defines the structure of its objects.objects.

►Classes are organized in an “is-a” Classes are organized in an “is-a” hierarchy defined by inheritance.hierarchy defined by inheritance.

Page 20: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

UML class diagram for the UML class diagram for the DateDate class class

Page 21: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Extended UML class diagram Extended UML class diagram showing showing DateDate objects objects

► Date myDate = new Date (6, 24, 1951);Date myDate = new Date (6, 24, 1951);► Date yourDate = new Date (10, 11, 1953);Date yourDate = new Date (10, 11, 1953);► Date ourDate = new Date (6, 15, 1985);Date ourDate = new Date (6, 15, 1985);

Page 22: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

InheritanceInheritance

1.1. Allows programmers to create a new Allows programmers to create a new class that is a specialization of an class that is a specialization of an existing class.existing class.

2.2. The new class is called a subclass of The new class is called a subclass of the existing class; the existing class the existing class; the existing class is the superclass of the new class.is the superclass of the new class.

Page 23: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Code to Create Code to Create IncDateIncDate in in JavaJava

Page 24: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Program Segment Using Program Segment Using Date Date and and IncDateIncDate

Page 25: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Extended UML Class Diagram Extended UML Class Diagram Showing InheritanceShowing Inheritance

Page 26: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Object-Oriented DesignObject-Oriented Design

► Identify classesIdentify classes►Organize classes in an inheritance Organize classes in an inheritance

hierarchyhierarchy►Find prewritten classesFind prewritten classes

Page 27: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Identifying ClassesIdentifying Classes

1.1. Start brainstorming ideas.Start brainstorming ideas.

2.2. Identify objects in the problem.Identify objects in the problem.

3.3. Objects are usually nouns and operations Objects are usually nouns and operations are usually verbs.are usually verbs.

4.4. Filter the classes.Filter the classes.

5.5. Consider some scenarios in which the Consider some scenarios in which the objects interact to accomplish a task.objects interact to accomplish a task.

6.6. CRC cards help us enact such scenarios.CRC cards help us enact such scenarios.

Page 28: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Summary: Approaches to Summary: Approaches to Identifying ClassesIdentifying Classes

1.1. Start with the major classes and Start with the major classes and refine the design.refine the design.

2.2. Hide important design decisions Hide important design decisions and requirements likely to and requirements likely to change within a class.change within a class.

3.3. Brainstorm with a group of Brainstorm with a group of programmers.programmers.

4.4. Make sure each class has one Make sure each class has one main responsibility.main responsibility.

Page 29: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Summary ContinuedSummary Continued

5.5. Use CRC cards to organize classes Use CRC cards to organize classes and identify holes in the design.and identify holes in the design.

6.6. Walk through user scenarios.Walk through user scenarios.

7.7. Look for nouns and verbs in the Look for nouns and verbs in the problem description.problem description.

Page 30: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand
Page 31: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Verification vs. ValidationVerification vs. Validation

Program verification asks,Program verification asks,

““Are we doing the job right?”Are we doing the job right?”

Program validation asks,Program validation asks,

““Are we doing the right job?”Are we doing the right job?”

B.W. Boehm, Software Engineering B.W. Boehm, Software Engineering Economics, 1981.Economics, 1981.

Page 32: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Types of ErrorsTypes of Errors

►SpecificationSpecification►DesignDesign►Coding Coding ► InputInput

Page 33: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Cost of a Specification Error Cost of a Specification Error Based on When It Is Based on When It Is

DiscoveredDiscovered

Page 34: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Controlling ErrorsControlling Errors

Robustness Robustness The ability of a program to The ability of a program to recover following an error; the ability of a recover following an error; the ability of a program to continue to operate within its program to continue to operate within its environmentenvironment

Preconditions Preconditions Assumptions that must be Assumptions that must be true on entry into an operation or method true on entry into an operation or method for the postconditions to be guaranteed.for the postconditions to be guaranteed.

Postconditions Postconditions Statements that describe Statements that describe what results are to be expected at the exit what results are to be expected at the exit of an operation or method, assuming that of an operation or method, assuming that the preconditions are true.the preconditions are true.

Page 35: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Design Review ActivitiesDesign Review Activities

Deskchecking Deskchecking Tracing an execution of a Tracing an execution of a design or program on paperdesign or program on paper

Walk-through Walk-through A verification method in which A verification method in which a a teamteam performs a manual simulation of the performs a manual simulation of the program or designprogram or design

InspectionInspection A verification method in which A verification method in which one member of a team reads the program or one member of a team reads the program or design line by line and others point out design line by line and others point out errorserrors

Page 36: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand
Page 37: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

For Each Test CaseFor Each Test Case

►Determine inputs.Determine inputs.►Determine the expected behavior of Determine the expected behavior of

the program.the program.►Run the program and observe the Run the program and observe the

resulting behavior.resulting behavior.►Compare the expected behavior and Compare the expected behavior and

the actual behavior.the actual behavior.

Page 38: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Types of TestingTypes of Testing

Unit testing Unit testing Testing a class or method by Testing a class or method by itselfitself

Black-box testing Black-box testing Testing a program or Testing a program or method based on the possible input values, method based on the possible input values, treating the code as a “black box”treating the code as a “black box”

Clear (white) box testing Clear (white) box testing Testing a Testing a program or method based on covering all of program or method based on covering all of the branches or paths of the codethe branches or paths of the code

Page 39: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Test PlansTest Plans

►Document showing the test cases Document showing the test cases planned for a program or module, their planned for a program or module, their purposes, inputs, expected outputs, purposes, inputs, expected outputs, and criteria for successand criteria for success

►For program testing to be effective, For program testing to be effective, it it must be plannedmust be planned..

►Start planning for testing before Start planning for testing before writing a single line of code.writing a single line of code.

Page 40: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand
Page 41: Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand

Testing Java Data StructuresTesting Java Data Structures