Transcript

1-1

Software DevelopmentObjectives:• Discuss the goals of software development

• Identify various aspects of software quality

• Examine two development life cycle models

• Explore the notation of the Unified Modeling Language (UML)

• Examine issues related to error handling

• Introduce the concept of algorithm analysis

1-2

Software Development• Software Engineering – make s/w development a

rigorous engineering discipline; study of techniques and theory that support the development of high-quality software

• Focus on controlling the development process to achieve consistently good results

• We want to:– satisfy the client – the person or organization who

sponsors the development

– meet the needs of the users – the people using the software for its intended purpose

1-3

Goals of Software Engineering• Solve the right problem– more difficult than it might seem

– client interaction is key (social?)

• Deliver a solution on time and under budget– there are always trade-offs

• Deliver a high-quality solution– beauty is in the eye of the beholder

– we must consider the needs of various stakeholders

1-4

FIGURE 1.1 Aspects of software quality

1-5

Development Models• A development life cycle defines a process to be

followed during product development• Many software development models have been

introduced• All of them address the following fundamental issues

in one way or another:– problem specification (gather requirements)– design– implementation– evaluation– testing and debugging– maintenance and evolution

1-6

Problem Specification

• We must specify the requirements of the software system

• Must be based on accurate information

• Various techniques:– discussions and negotiations with the client

– modeling the problem structure and data flow

– observation of client activities

– analysis of existing solutions and systems

1-7

Design• We must develop a solution

• You would not consider building a bridge without a design

• Design involves determining:– the overall software structure (architecture)

– the key objects, classes, and their relationships

• Alternatives should be considered

• Mostly program language independent

1-8

Implementation

• We must turn the design into functional software

• Too many people consider this the primary act of software development

• May involve the reuse of existing software components

1-9

Evaluation/Analysis

• We must verify that the system conforms to the requirements

• This includes, but goes way beyond, testing code with test cases

• It is possible to build a system that has no bugs and yet is completely wrong

• Is system responsive enough?

1-10

Maintenance/Evolution

• After a system is initially developed, it must be maintained

• This includes:– fixing errors

– making enhancements to meet the changing needs of users (evolution)

• The better the development effort, the easier the maintenance tasks will be

1-11

The Waterfall Model• One of the earliest development models

• Each stage flows into the next

• Driven by documentation

• Advantages:– Lays out clear milestones and deliverables

– Has high visibility – managers and clients can see the status

• Disadvantages:– late evaluation

– not realistic in many situations

1-12

FIGURE 1.2 The waterfall software development model

Specification

1-13

The Spiral Model• Developed by Barry Boehm in the mid '80s

• Embraces an iterative process, where activities are performed over and over again for different aspects of the system

• Designed to reduce the risks involved

• Continually refines the system

• Each loop through the spiral is a complete phase of development

1-14

FIGURE 1.3 The spiral model of software development

1-15

The Unified Modeling Language

• The Unified Modeling Language (UML) has become a standard notation for software design

• It is unified in the sense that it is the synthesis of three separate notations

• It is language independent

• It includes various types of diagrams which use specific icons and notations

• However, it is flexible – the details you include in a given diagram depend on what you are trying to capture and communicate

1-16

UML Class Diagrams• UML class diagrams may include:– The classes used in the system

– The static relationships among classes

– The attributes and operations of each class

– The constraints on the connections among objects

• An attribute is class level data, including variables and constants

• An operation is essentially equivalent to a method

• May include visibility details

1-17

FIGURE 1.5 LibraryItem class diagram

1-18

FIGURE 1.6 A UML class diagram showing inheritance relationships

1-19

FIGURE 1.7 A UML class diagram showing an association

1-20

FIGURE 1.8 One class shown as an aggregate of other classes

1-21

Error Handling• How problems are handled in a software

system is a key design element

• In Java, an error generally represents an unrecoverable situation

• An exception is an unusual situation that might be handled in various ways

• Design questions include:– how are problems identified?

– where are exceptions thrown and caught?

1-22

Analysis of Algorithms• An aspect of software quality is the efficient

use of resources, including the CPU

• Algorithm analysis is a core computing topic

• It gives us a basis to compare the efficiency of algorithms

• Example: which sorting algorithm is more efficient?

1-23

Growth Functions• Analysis is defined in general terms, based

on:– the problem size (ex: number of items to sort)

– key operation (ex: comparison of two values)

• A growth function shows the relationship between the size of the problem (n) and the time it takes to solve the problem

t(n) = 15n2 + 45 n

1-24

Growth Functions• It's not usually necessary to know the exact

growth function

• The key issue is the asymptotic complexity of the function – how it grows as n increases

• Determined by the dominant term in the growth function

• This is referred to as the order of the algorithm

• We often use Big-Oh notation to specify the order, such as O(n2)

1-25

FIGURE 1.11 Some growth functions and their asymptotic complexity

1-26

FIGURE 1.12 Increase in problem size with a ten-fold increase in processor speed

1-27

FIGURE 1.13 Comparison of typical growth functions

1-28

Analyzing Loop Execution

• A loop executes a certain number of times (say n)

• Thus the complexity of a loop is n times the complexity of the body of the loop

• When loops are nested, the body of the outer loop includes the complexity of the inner loop

1-29

Analyzing Loop Execution

• The following loop is O(n):

for (int i = 0; i < n; ++i)

{

x = x + 1;

}

1-30

Analyzing Loop Execution• The following loop is O(n2) because the loop

executes n times, and the inner loop is O(n):for (int i = 0; i<n; ++i)

{

x = x + 1;

for (int j = 0; j < n; ++j)

{

y = y - 1;

}

}

1-31

SE and Data Structures

• The data structures examined we will examine lay the foundation for developing complex software

• Software Engineering techniques are needed as our software grows more complex

• As we discuss data structures, we will also practice good software engineering

1-32

Testing/Debugging w/assertionsUse assert statement to assist debugging

Can be turned off – don’t use to check preconditions

Point p1 = new Point ();

Point p2 = new Point (3, 4);

double distance = p1.computeDistanceTo (p2);

assert (Math.abs (distance – 5.0) < 0.001 : "Distance incorrect");


Top Related