View
216
Download
1
Tags:
Embed Size (px)
Citation preview
Chapter 1 Chapter 1
Software EngineeringSoftware Engineering
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).
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.
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
The Software Life Cycle The Software Life Cycle (Cont’d)(Cont’d)
►Testing and VerificationTesting and Verification►DeliveryDelivery►Operation Operation ►MaintenanceMaintenance
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
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
Programmer Toolboxes Programmer Toolboxes (Con’td)(Con’td)
►Software ConceptsSoftware Concepts Information hidingInformation hiding Data encapsulatingData encapsulating AbstractionAbstraction
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.
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
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.
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.
Abstraction Abstraction (cont’d)(cont’d)
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.
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
Visual Aids—CRC cardsVisual Aids—CRC cards
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
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.
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.
UML class diagram for the UML class diagram for the DateDate class class
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);
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.
Code to Create Code to Create IncDateIncDate in in JavaJava
Program Segment Using Program Segment Using Date Date and and IncDateIncDate
Extended UML Class Diagram Extended UML Class Diagram Showing InheritanceShowing Inheritance
Object-Oriented DesignObject-Oriented Design
► Identify classesIdentify classes►Organize classes in an inheritance Organize classes in an inheritance
hierarchyhierarchy►Find prewritten classesFind prewritten classes
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.
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.
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.
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.
Types of ErrorsTypes of Errors
►SpecificationSpecification►DesignDesign►Coding Coding ► InputInput
Cost of a Specification Error Cost of a Specification Error Based on When It Is Based on When It Is
DiscoveredDiscovered
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.
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
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.
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
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.
Testing Java Data StructuresTesting Java Data Structures