CISC 323 instructor: Margaret Lamb instructor: Juergen Dingel - - PowerPoint PPT Presentation

cisc 323
SMART_READER_LITE
LIVE PREVIEW

CISC 323 instructor: Margaret Lamb instructor: Juergen Dingel - - PowerPoint PPT Presentation

Administrativa Section A: Section B: CISC 323 instructor: Margaret Lamb instructor: Juergen Dingel Introduction to Software malamb@cs.queensu.ca dingel@cs.queensu.ca DUP 217 DUP 215 Engineering slot 3: Mon 10:30 slot 1: Mon 8:30 Wed


slide-1
SLIDE 1

CISC 323, Winter 2004, Intro 1

CISC 323 Introduction to Software Engineering Winter 2004

CISC 323, Winter 2004, Intro 2

Administrativa

Section A: instructor: Margaret Lamb malamb@cs.queensu.ca DUP 217 slot 3: Mon 10:30 Wed 9:30 Fri 8:30

Course web page: http://www.cs.queensu.ca/home/cisc323 (is up, minor changes may still be made) WebCT area: forum and grades

Section B: instructor: Juergen Dingel dingel@cs.queensu.ca DUP 215 slot 1: Mon 8:30 Tues 10:30 Thurs 9:30

CISC 323, Winter 2004, Intro 3

Assignments, Exams and Marking Scheme

5 assignments: 30% midterm: 20% final exam: 50% Midterm: two-hour evening exam during Week 8, date to be announced soon Final Exam: date and location to be announced Please don't make plans to leave Kingston before end of the exam period!

All are closed book with 1 8.5”x11’’ data sheet

CISC 323, Winter 2004, Intro 4

Tutorials

  • Monday 1:30 - 2:20, WLH205
  • r

Wednesday 12:30 - 1:20, WLH210

  • You may attend either tutorial, regardless of your

lecture section.

  • Purpose of tutorials:

û review/reinforce material from lecture & readings û ask questions û discuss assignments

  • NO TUTORIALS DURING WEEK 1!
slide-2
SLIDE 2

CISC 323, Winter 2004, Intro 5

Assignments

  • There will be 5 assignments during the course.
  • Posted on web site.
  • You may work in pairs.
  • No groups larger than 2.
  • Academic Dishonesty will not be tolerated!
  • No late assignments accepted.

CISC 323, Winter 2004, Intro 6

Text Material

  • Required texts:
  • 1. Ali Bahrami, Object-Oriented Systems

Development, Irwin McGraw Hill, 1999.

  • 2. custom courseware

Both available in bookstore

  • If your Java is rusty:

û texts from old Java courses or any other good Java book û Another option:

Bruce Eckel, Thinking in Java, Prentice Hall, May 2000. may be downloaded for free from http://www.mindview.net/Books/TIJ

CISC 323, Winter 2004, Intro 7

Programming Resources

  • Project implemented in Java.
  • You may use any Java tool which is based on a

Sun Java JDK version 1.2 or later:

û BlueJ û Ready To Program û JBuilder 3+ (some labs have JBuilder 7) û Forte û straight Sun jdk/sdk

  • do not use :

û Visual J++ (based on Java variant) û JBuilder 2 in labs (old version)

CISC 323, Winter 2004, Intro 8

What is Software Engineering?

Any thoughts?

slide-3
SLIDE 3

CISC 323, Winter 2004, Intro 9

Software Engineering: A Definition

engineering: The application of scientific and mathematical principles to practical ends such as the design, manufacture, and

  • peration of efficient and economical structures,

machines, processes, and systems American Heritage Dictionary software engineering: The application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software, that is, the application of engineering to software IEEE Standard 610.12

CISC 323, Winter 2004, Intro 10

What Is Software?

  • The programs, routines, and symbolic languages that

control the functioning of the hardware and direct its

  • peration.

American Heritage Dictionary

  • Crucial to functioning of modern society

û transportation û business and finance û health care û communication û entertainment û education û …

CISC 323, Winter 2004, Intro 11

What Is Software? (Cont’d)

  • Crucial for western economies

û Value of US prepackaged sw

* in 1996: US$109 billion * in 2002 (est): US$222 billion (2.2% of US$9.9 trillion of US GDP)

û Expected growth of global sw market: 6.1% û Average IT spending of US companies as % of gross revenue in 2000: 7.5% û 2.5 10.8 42,927 Oracle 10.3 12.6 N/A IBM 7.3 25.3 47,600 Microsoft Net income

(US$ in 106)

Revenue

(US$ in 106)

#employees Company

Source: The US Software Industry. H. Rubin, M. Johnson,

  • S. Ivertosch. IEEE Software. 2002

CISC 323, Winter 2004, Intro 12

What Is Software? (Cont’d)

  • Not created equal. At least 4 different types:

û shrinkwrap

* e.g., Win xyz * high volume, little service, needs to be very usable, lots of maintenance * multi-platform, multi-OS, multi-human-language, multi-version * developers likely to be geographically dispersed

û customized/internal

* e.g., SAP business software * low-volume, high service, lots of maintenance

û embedded

* e.g., device drivers, control software * medium volume, strong hardware restrictions, requires high performance, high reliability (safety-critical), little maintenance

û games

* lots of fancy graphics, high performance

slide-4
SLIDE 4

CISC 323, Winter 2004, Intro 13

What Is Software? (Cont’d)

  • One of most complex man-made artifacts:

û Windows 95

* > 11 million lines of code * more than 200 programmers & testers

û Windows NT: > 16 million lines of code û Windows XP: 45 million lines of code û Pacemakers: > 100,000 lines of code û “I believe the [spreadsheet product] I’m working on now is far more complex than a 747 (jumbo jet airliner)”

  • - Chris Peters (Microsoft, 1992)

CISC 323, Winter 2004, Intro 14

What Is Software? (Cont’d)

  • Rapidly evolving:

û Changing languages:

* Fortran (1957), Algol (1958), LISP (1959), Cobol (1959), APL (1962), PL/1 (1963), Pascal (1970), Prolog (1972), C (1974), Basic (1975), Smalltalk-80 (1980), Modula-2 (1980), Ada (1983), C++ (1986), VisualBasic (1991), Java (1995), C# (2000), … * Paradigms: imperative, functional, logical, object-oriented

û Changing technologies:

* computer architectures, means of communication (networks, internet, web)

û Changing demands:

* GUIs, Web applications, eCommerce, security

CISC 323, Winter 2004, Intro 15

What Is Software? (Cont’d)

  • Rapidly evolving:

û “It’s different [from other engineering disciplines] in that we take on novel tasks every time. The number

  • f times [civil engineers] make mistakes is very small.

And at first you think, what’s wrong with us? It’s because it’s like we’re building the first skyscraper every time.”

  • - Bill Gates, 1992
  • Hardly ever fully complete:

û about 50% of development effort on a typical software system comes after its initial release Lientz & Swanson, 1980

CISC 323, Winter 2004, Intro 16

What Is Software? (Cont’d)

  • Highly constrained: Must distinguish at least 3

different “stakeholders”:

û Customers:

* Which expectations do customers have of software they buy

  • r use?

û Developers:

* Which expectations do developers have of software they

) write from scratch, ) test, ) maintain?

û Managers:

* Which expectations do managers have of software whose development they oversee?

slide-5
SLIDE 5

CISC 323, Winter 2004, Intro 17

Consequences for Process of Software Development

  • Given all these properties of and constraints on

software, the development process of (large, commercial) software must be

û devided into several phases (e.g., requirements analysis, design, implementation, testing) û able to measure and control the quality of the produced software û predictable û efficient (through, e.g., lots of reuse, use of modern languages, doing things in parallel when possible, minimizing number of developers and testers, facilitating communication between people) û able to adapt to changing requirements

CISC 323, Winter 2004, Intro 18

Software Process

  • A software (development) process is a method for

developing software that organizes the effort in a number of separate steps such that large software can be developed by many people in an organized, manageable and trackable way

  • Numerous software processes (also called models) exist

û Waterfall process û Prototyping process û Evolutionary development process û Sync and Save process (Microsoft) û Object-oriented development process (e.g., Uniform Approach (UA), …) û …

CISC 323, Winter 2004, Intro 19

Consequences for Software Itself

  • Given all these properties of and constraints on

software, the software must

û be modular

* divide the code into appropriate number of appropriate units (classes, modules, components) with * small and well-defined interfaces and dependencies

û use information hiding

* units are only accessible through their interfaces * the internals of a unit are invisible

û be implemented with the user’s requirements in mind û be checked for satisfaction of these requirements û use existing code as much as possible û minimize typos, bugs, security vulnerabilities û be well documented and use good coding style consistently û use efficient data structures and algorithms

CISC 323, Winter 2004, Intro 20

Consequences for Software Itself (Cont’d)

  • Object-oriented languages like Java support

û modularity through

* ?

û information hiding through

* ?

û reuse through

* ?

û correctness through

* ?

û documentation through

* ?

slide-6
SLIDE 6

CISC 323, Winter 2004, Intro 21

Consequences for Software Itself (Cont’d)

  • Object-oriented languages like Java support

û modularity through

* packages, classes, interfaces

û information hiding through

* access modifiers: public, protected, private

û reuse through

* inheritance * rich API

û correctness through

* strong typing (programs are checked for type correctness) * automatic memory management * run-time assertions (JDK1.4)

û documentation through

* documentation facilities like Javadoc * run-time assertions

CISC 323, Winter 2004, Intro 22

Costs of Failed Software Development and Failed Software

  • There are numerous examples of

û failed software development projects (e.g., budget overrun, cancelled). According to Standish Group in US in 2000:

* ¼ of all software projects cancelled at total cost of US$67 billion * total cost of budget overruns: US$21 billion

û buggy software making people lose time, money, their lives

  • Annual cost of errors in software in US in 2001

û US National Institute of Standards and Technology: US$60 billion û Sustainable Computing Consortium: > US$200 billion

  • Watts Humphrey (CMU SEI):

û Professional programmers make 100 to 150 errors per 100 lines of code û Win NT4 (16 million lines of code) written with 2 million errors

  • The Risk Digest collects risks to the public in computers

û moderated by Peter Neumann at SRI û http://catless.ncl.ac.uk/Risks/

CISC 323, Winter 2004, Intro 23

From: Competing on Internet Time. M.A. Cusumano, D.B. Yoffie

Example 1

Browser War between Microsoft and Netscape:

  • From 1995 to 1997 NS concentrated on features at the

expense of good design

  • MS hurried to get IE going, but took time to restructure

IE3.0 (NT built from scratch, shared components in Office)

  • By 1997, NS C4.0 had 130 developers, 3M loc
  • Two months not enough to rearchitect NS C4.0
  • NS decides to start from scratch with C6.0
  • C6.0 never finished, developers reassigned to C4.0
  • C5.0 open source, but nobody wants to work on it
  • MS wins Browser War, AOL buys NS
  • NS C4.0 still contains 1.2M loc

CISC 323, Winter 2004, Intro 24

Mars Climate Orbiter (2000):

  • Some programs worked in English (imperial) units,

some metric units

  • Conversion from English to metric forgotten
  • Instead of 65 miles probe attempted to orbit 65 km (40

miles) above Mars

  • $130M lost

Example 2

slide-7
SLIDE 7

CISC 323, Winter 2004, Intro 25

Example 3

Ariane 5 Explosion:

  • June 4, 1996
  • Controlled destruction 40 seconds after

lift-off

  • due to rounding error, code re-use
  • 15 years of development
  • $7B investment
  • $500M uninsured cargo lost (4 satellites)
  • Failure to meet correctness requirements

Computer Arithmetic Tragedies page of Kees Vuik, URL: http://dutita0.twi.tudelft.nl/users/vuik/wi211/disasters.html http://www.around.com/ariane.html “Europe’s Dream”, Discover, May 1997. CISC 323, Winter 2004, Intro 26

Example 4

Therac 25:

  • The most infamous medical software failure
  • Computer based electron-accelerator radiation therapy

system

  • Accidents from 1985 to 1987 involved massive

radiation exposure

  • Results: 3 deaths, several injuries
  • tests after accidents showed no problems
  • three subtle interacting flaws in system
  • Failure to meet correctness requirements
  • Another example of safety critical system

Neumann, Peter, Computer Related Risks, ACM Press, New York, 1995, p. 68-70 CISC 323, Winter 2004, Intro 27

Example 5

Bank of America MasterNet:

  • Abandoned existing trust accounting and reporting

system for a new computer-based system called MasterNet

  • Initial budget $23M for 5-year development
  • Additional $60M spent trying to get MasterNet working

after 5 years

  • Failure to meet correctness, performance requirements
  • Eventually abandoned MasterNet
  • Lost $Billions in customer business

Neumann, Peter, Computer Related Risks, ACM Press, New York, 1995, p. 216. CISC 323, Winter 2004, Intro 28

Example 6

Blue Cross and Blue Shield (Wisconsin):

  • 1983 hired EDS to build $200M system
  • Delivered on time but did not work correctly:

û System issued $60M in overpayments and duplicate cheques

  • Failure to meet correctness requirements
  • By 1987 company had lost 35,000

policyholders

Neumann, Peter, Computer Related Risks, ACM Press, New York, 1995, p. 217.

slide-8
SLIDE 8

CISC 323, Winter 2004, Intro 29

Example 7 & 8

First Shuttle Launch (1981):

  • launch on hold 2 days
  • timing error kept main computer & backups from

synchronizing Challenger Explosion (1986):

  • main problems: booster rocket design, cold weather
  • better software might have saved the astronauts
  • design decision to save money: remove sensors on

booster rockets

  • sensors & software might have detected booster failure

earlier

  • some speculate detection would have permitted

separation before explosion

Neumann, Peter, Computer Related Risks, ACM Press, New York, 1995, p. 20, 23 CISC 323, Winter 2004, Intro 30

Example 9

Bruce Nuclear Generation Plant:

  • Fuel Handling Software Failure (1990)
  • Brakes on a fueling machine were released while

clamped to a fuel channel fitting

  • Machine dropped 40cm damaging the fitting causing a

leak of radioactive heavy water (1400 kg/h)

  • reactor down for 6 weeks
  • Software error had been introduced 4 years earlier
  • A unique combination of events lead to the problem

“Post-Accident Analysis – Heavy Water Spill”, DLSF Systems, Ottawa, ON, Neumann, Peter, Computer Related Risks, ACM Press, New York, 1995, p. 88

CISC 323, Winter 2004, Intro 31

Topics in This Course

  • 1. Introduction (2 lectures)
  • 2. OO review and UML (4)
  • 3. Debugging (1)
  • 4. GUIs in Java (6)
  • 5. Software processes (2)

û waterfall, incremental, prototyping, evolutionary, sync & save, object-oriented (Uniform Approach)

  • 6. Object-Oriented Analysis (3)

û ways to determine and capture what system is supposed to do

CISC 323, Winter 2004, Intro 32

Topics in This Course (Cont’d)

  • 7. Object-Oriented Design (3)

û determine how system is supposed to be implemented

  • 8. Design Patterns (3)

û high-level way to solving certain coding problems

  • 9. Software Architecture (3)

û high-level ways of structuring code

10.Software Quality (4)

û ways to ensure that system behaves as desired

11.Open Source (1)

slide-9
SLIDE 9

CISC 323, Winter 2004, Intro 33

Top 10 List: Top 10 List: Top 10 List: Top 10 List: Why This Why This Why This Why This Course Course Course Course Is Relevant To Is Relevant To Is Relevant To Is Relevant To You You You You

CISC 323, Winter 2004, Intro 34

Top 10

  • 10. Watch the “growing pains” of an “emerging

discipline”

û Construction and analysis of models crucial for the theory and practise of all engineering disciplines û In SWE this is not true --- yet!

  • 9. Job availability and personal interests change

û Do you really know what you’ll be doing after graduation? û Knowing more has never hurt anybody

  • 8. Some SWE concepts may be useful/applicable

in other contexts

û It’s all about controlling complexity

CISC 323, Winter 2004, Intro 35

Top 10

7 to 1. SW is everywhere

û may have to interact with SW people û may have to manage SW projects û may have to write code “Software is pervasive. EEs that pursue a technical career will at some point likely have to develop, manage, or specify software.”

  • - Geoffrey Chan, ECE UG Chair

July 11, 2003

CISC 323, Winter 2004, Intro 36

Extended Example: Obtaining Marks in Course

  • A common problem in courses is that the

grade is computed from many components

û assignments, labs, quizzes, final exam

  • Students typically see only the final result

û Therefore hard for students to verify their grade has been computed, recorded accurately

slide-10
SLIDE 10

CISC 323, Winter 2004, Intro 37

Solution: Program to Obtain Marks in Course

  • Allow students to run a program to view their

grades for each of their courses

û Student must be logged in to CASLab û CASLab user id used to identify student û Student selects course for which he/she wishes to see grades û Grades displayed on students screen

CISC 323, Winter 2004, Intro 38

Architecture of Marks Program

CISC 323, Winter 2004, Intro 39

Architecture of Marks Program

  • Client-server architecture
  • Server contains

û Marks data for all students, courses û Service allowing marks data to be obtained

  • Client contains

û Program allowing student to query and display his/her marks

  • Communication

û Network-based

This is a UML deployment diagram Central server for marks information Computer that student is using Network link

CISC 323, Winter 2004, Intro 40

Components of Marks Program

This is a UML component diagram

slide-11
SLIDE 11

CISC 323, Winter 2004, Intro 41

Components of Marks Program

User interface allowing students to request and view marks Makes requests for marks, interacts with user interface Serves requests for marks, using CASLab user id and course id as key Contains each student’s set of marks for each course they are taking Network link

CISC 323, Winter 2004, Intro 42

Marks Repository

  • Solution 1: Use a text file
  • Solution 2: Use a database

CISC 323, Winter 2004, Intro 43

Solution 1: Marks Repository as a Text File

  • File contains lines of form

CASLabId CourseNumber Mark1 Mark2 … Markn

  • For example:

cs1234 CISC323 42 55 93 …

  • When students look up grades, they get back

the list of marks

CISC 323, Winter 2004, Intro 44

Marks Repository as a Text File: Consequences

How usable would this solution be?

û Professors must all share this large, complex text file to enter grades û Format is cryptic û Easy to make typos putting data into this format (therefore, marks data may not accurately reflect master list)

slide-12
SLIDE 12

CISC 323, Winter 2004, Intro 45

Marks Repository as a Text File: Consequences (Cont’d)

How scalable would this solution be?

û As number of users becomes large, accessing text file may become too slow

* Files only support sequential access (such as audio tapes), not random access (such as CDs) * Each lookup requires sequential scan of file

CISC 323, Winter 2004, Intro 46

Marks Repository as a Text File: Consequences (Cont’d)

How tolerant to faults would this solution be?

û If text file deleted or marks server machine goes down, system fails û However, text file easy to copy and back up

CISC 323, Winter 2004, Intro 47

Solution 2: Marks Repository as a Database

  • Database contains tables representing marks

information

  • Marks server connects to database via standard

protocol

û E.g., ODBC (Microsoft), JDBC (Sun), …

  • Resolves problems of scalability

û Database access far faster than sequential file access when large number of entries

  • Does not help with fault-tolerance

û Failure of database still renders system inoperative û Database should have built-in support for backups. However, backups may still be difficult/costly

CISC 323, Winter 2004, Intro 48

Marks Repository as a Database: Consequences

Usability

û Entry into a database requires professor to use a special Marks Entry Client

* E.g., forms-based interface

û Easier to use and less error-prone than text editor û More work to develop and maintain

slide-13
SLIDE 13

CISC 323, Winter 2004, Intro 49

Some System Attributes

  • Usability
  • Fault tolerance
  • Scalability
  • Others that we have not considered:

û Security

* Marks data sent over network * If using standard Ethernet, could be “snooped” by third party

û Portability

* What platforms does Marks Client User Interface run on? * What are required?

û Maintainability, reusability, cost, …

CISC 323, Winter 2004, Intro 50

Lessons from this Example

  • There’re typically several different ways of

implementing a system

û Design decisions must be made û Each decision may have different impact on quality attributes of resulting system û Need to which attributes we need to care about û Need to do requirements analysis before we can design (if you’re using an object-oriented software development process, the requirements analysis is called object-oriented analysis)

CISC 323, Winter 2004, Intro 51

Lessons from this Example (Cont’d)

  • Design is typically top-down

û Start by breaking system up into a set of communicating components

* How do we split the system into components? * How do we deploy the components on a set of computers? * How do the components communicate with each other? * How does the architecture influence the quality attributes?

û Then, think about design of components in terms of processes, packages, tools, classes, etc û Ideally: Keep on breaking each problem down until you have an existing solution for it, or it is so simple that you can see how to implement it

soft- ware archi- tecture

CISC 323, Winter 2004, Intro 52

Engineering as Art and Science

"The conception of a design for a new structure can involve as much a leap of the imagination and as much a synthesis of experience and knowledge as any artist is required to bring to his canvas or paper. And once that design is articulated by the engineer as artist, it must be analyzed by the engineer as a scientist in as rigorous an application of the scientific method as any scientist must make."

  • - Henry Petroski

Author of “To Engineer is Human: The Role of Failure in Successful Design”