Chapter 4 Requirements Engineering Chapter 4 Requirements engineering1.
9/19/2015CS135601 Introduction to Information Engineering1 Software Engineering 9/19/2015 Che-Rung...
-
Upload
drusilla-caldwell -
Category
Documents
-
view
225 -
download
0
Transcript of 9/19/2015CS135601 Introduction to Information Engineering1 Software Engineering 9/19/2015 Che-Rung...
04/19/23 CS135601 Introduction to Information Engineering 1
Software Engineering
04/19/23
Che-Rung Lee
04/19/23 CS135601 Introduction to Information Engineering 2
What makes software development hard?
Traditional Engineering
Software Engineering
“ Off the shelf” components available
Required performance
Quality metrics
Scientific basis
Often Rarely
Within tolerances Perfect
Mean time to failure
Physics
Unclear
Unclear
04/19/23 CS135601 Introduction to Information Engineering 3
Size makes differences
Small program Working system
Code size (lines)
Complexity
Repeated updates
Developer(s)
Reliability requirement
Tens to hundreds 104~107
Low High
No
Usually one person
Yes
Usually many people
Low High
04/19/23 CS135601 Introduction to Information Engineering 4
The software life cycle
Repair, maintenance to fix bugs, or adapt new demands
OR, discard old software and redevelop the new one from scratch!?
Design
Develop-mentMainte-nance
60-100x
1x
1.5-6x
Cost to change
More efforts put on the early development will win tremendous payoff later
04/19/23 CS135601 Introduction to Information Engineering 5
Outline
• Software engineering methodologies
1.Analysis phase: requirement specification– The human-machine interface
2.Design phase: modularization & methods
3.Implementation phase: style and tools
4.Testing phase: quality assurance and documentation
• Software ownership and liability
04/19/23 CS135601 Introduction to Information Engineering 6
Software Engineering Methodologies
04/19/23 CS135601 Introduction to Information Engineering 7
Waterfall model
• Analysis (requirement specification)– Identify the needs of the users, and compiles them to
requirements, further to technical specifications• Design
– Focus on how to accomplish these specifications– Applies modular decomposition to breakdown the
entire complexity• Implementation
– Actual coding, creating data files & DB• Testing
– Tightly coupled with implementation, bottom-up from each module
04/19/23 CS135601 Introduction to Information Engineering 8
Incremental model
• Constructs the software system in increments
• Prototyping: Incomplete versions of the system (prototypes) built to be evaluated– Evolutionary prototyping:– Throwaway prototyping:– Ex: storyboard for
animation making
04/19/23 CS135601 Introduction to Information Engineering 9
Iterative model
• Similar to the incremental model, but rebuilding each version rather than extending
• Rational unified process (RUP)
04/19/23 CS135601 Introduction to Information Engineering 10
Other models
• Open source development– The source code is available for
everyone to update and modify
• Extreme programming– Developers work in a communal work space
where they are freely to share ideas and assist each other in the development project
• The amoeba organization
04/19/23 CS135601 Introduction to Information Engineering 11
CASE tools
• Computer-Aided Software Engineering– Project planning tools (cost estimation, project
scheduling, personnel allocation, …etc.)– Project management tools, documentation
tools, prototyping/simulation tools– Interface design tools (for GUI)– Programming/debugging tools– Some automatic code generators
04/19/23 CS135601 Introduction to Information Engineering 12
Analysis Phase: Requirement Specification
& the Human-Machine Interface
04/19/23 CS135601 Introduction to Information Engineering 13
Requirement acquiring
• Stakeholder: future users– From an entity, such as a company or agency– From free markets, such as the Internet
• Software requirements specification– wants, needs, costs, and feasibility– Hardware, software, data, human factors– Economic considerations and technical
considerations
Human vs. computer
• Abilities may include speed, memory, …
• Which one do you prefer?
04/19/23 CS135601 Introduction to Information Engineering 14
Abilities
1950 1990 2030
human
computer
Apple’s one button laptop,No keyboard !?
Human machine interface
• Ergonomics (人類工程學 )– Ex: the layout of keyboard
• Cognetics(cognitive engineering)– Mental abilities of humans, like habit– Ex: file deletion message – Ex: “Cap Lock” light– Ex: the “seven details” rule
• George A. Miller 1956
04/19/23 CS135601 Introduction to Information Engineering 15
The GOMS model
• A metric to measure the effectiveness of an interface design– Goals: ex: delete a word – Operators: ex: click a mouse bottom– Methods: ex: how to delete a file– Selection rules: ex: choose different methods
to accomplish the same goal
04/19/23 CS135601 Introduction to Information Engineering 16
04/19/23 CS135601 Introduction to Information Engineering 17
Design Phase: Modularization and Methods
Modularity
• The division of software into manageable units, call modules– Ex: the procedures or objects– Allows the future changes only confined to
several modules– Reduce the possibility of introducing bugs– Keep focused on the modifications
• Goal: Minimize coupling & maximize cohesion
04/19/23 CS135601 Introduction to Information Engineering 18
Coupling
• The independence between modules– Control coupling: a module passes control to
another module• EX: module A calls module B
– Data coupling: sharing data between modules• Explicit coupling: the same data is passed to
module A and then passed to module B• Implicit coupling: global variables (BAD)
– Action performed by a procedure is unknown to its caller
04/19/23 CS135601 Introduction to Information Engineering 19
Cohesion
• Internal binding within a module– Logical cohesion: logical similarity between
actions and components (not very good)– Functional cohesion: components are focused
around performance of a single activity (better)• Stronger than logical cohesion
• Cohesion in object oriented systems– Entire object will naturally be logically cohesive– Each method should be functionally cohesive
04/19/23 CS135601 Introduction to Information Engineering 20
Methods
• Dataflow diagram• Object-oriented approach
– Unified modeling language
• Design patterns• Component architecture
– Multi-object components that can be assembled into complete programs
• Open-source development– Public evolutionary prototyping
04/19/23 CS135601 Introduction to Information Engineering 21
Dataflow diagram
• Displays how data moves through a system– Rectangle: data sources and stores– Ovals: data manipulation– Arrow: data path
• EX: hospital’s patient billing system
04/19/23 CS135601 Introduction to Information Engineering 22
Object-oriented approach
• Use-case diagram– Stick figure (actors): users– Ovals (use cases): interactions
between the system and users
• Class diagram – Represents the structure of
classes and their relations
– Generalization (details)04/19/23 CS135601 Introduction to Information Engineering 23
Association multiplicities
04/19/23 CS135601 Introduction to Information Engineering 24
Interaction diagrams
• The communications between individuals that are involved in performing a task
04/19/23 CS135601 Introduction to Information Engineering 25
Design pattern
• A predeveloped model for solving a recurring problem
• Ex: adaptor
04/19/23 CS135601 Introduction to Information Engineering 26
Plug adaptor
class rectangle{ int x, y, width, height; …..}
void drawRec(int x1, int y1, int x2, int y2) // display a rectangle (x1,y1,x2,y2)}
class rectangleAdaptor { void draw(){ drawRec(x,y,x+width,y+height); }}
Implementation Phase: Style and Tools
Comments, indentation, IDE, Make file,
(Concurrent) version control
04/19/23 CS135601 Introduction to Information Engineering 27
A terrible example
• Do you know what this code does?
• It can be compiled and executed, but
• unless you want to show how bad a programming style can be
04/19/23 CS135601 Introduction to Information Engineering 28
int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hello, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
DON’T DO
THAT
Programming style
• A set of rules or guidelines that help programmers to read and understand source code and to avoid introducing errors– Indentations, space, layout, comments – Use meaningful/clear names (I0 and lO)– Consistent naming conventions– Clear statements and type definitions
• EX1: char* dest, src; //what’s src’s type?• EX2: *p++; // which value is increased, p or *p?
– …04/19/23 CS135601 Introduction to Information Engineering 29
What should be in comments?
• For a file/module– Description of functionality, a revision date
(version), author (copyright,history,references)
• For a function– Purpose, algorithm, input/output arguments,
pre-conditions and post-conditions
• For variables and statements– Purpose, usage, properties
04/19/23 CS135601 Introduction to Information Engineering 30
Preconditions/postconditions
• Pre-conditions: what must be true before invoking a method– EX: int binarySearch(int d[], int x)– precondition: Array d is sorted(in which order)
• Post-conditions: what is guaranteed to be true after invoking a method– postcondition:
•returnValue>=0 and d[returnValue]==x • or returnValue==-1 and x does not occur in d
04/19/23 CS135601 Introduction to Information Engineering 31
IDE
• Integrated Development Environment– May include a source code editor, a compiler
and/or an interpreter, a debugger, …
• Multiple-language IDEs:– such as Eclipse, Microsoft Visual Studio…
04/19/23 CS135601 Introduction to Information Engineering 32
Make/Makefile
• Make is a utility for building executable programs/libraries from source code.
• Makefile: define building rules for Make– Compiler, dependency, path, …– EX:
04/19/23 CS135601 Introduction to Information Engineering 33
# Comments use the hash symbol target: dependencies command 1 command 2 . . . command n
Revision control
• The management of changes to documents, programs, and other information stored as computer files.– Usually provide the function that allows a
team of developer to access the code.– Can access the snapshot of each reversion– Allow different branches of developments– EX: CVS, RCS, SVN
04/19/23 CS135601 Introduction to Information Engineering 34
04/19/23 CS135601 Introduction to Information Engineering 35
Testing Phase: Quality Assurance and
Documentation
Testing
• Program runs on a small subset of inputs– Testing is not debugging– Many situations hard to test
• Multithreaded code• Hard-to-reach states
– Testing cannot prove absence of bugs• EX: a problem in security
• Glass-box testing & Black-box testing
Glass-box testing
• Tester is aware of the inner structure of the software and use the knowledge when designing the test.– Pareto principle: identify a small number of
modules that might be most problematic– Basis path testing: find a set of test data so
that each instruction is executed at least once• EX: int binarySearch(int d[], int x)
– Test data = {x is in d, x is not in d}
Black-box testing
• Tester does not rely on the knowledge of software interior composition– Boundary value analysis:
• EX: int binarySearch(int d[], int x)– Test case where d is empty
– Beta testing: let potential users to use the software with real-life input (test data)
• Alpha test is the test performed by developers
Documentation
• User Documentation– Printed book for all customers– On-line help modules
• System Documentation– Source code: structure, naming, and comments– Design documents: specification, design,…
• Technical Documentation– For installing, customizing, updating, etc.
04/19/23 CS135601 Introduction to Information Engineering 40
Software Ownership & Liability
04/19/23 CS135601 Introduction to Information Engineering 41
Intellectual property
• Copyright: © protect creation/creator
• Patents: protect invention/inventor
• Trademark: ® protect products or services
• Trade secrets: protect company
• Software liability: protect users
• Free software
• Open source, freeware and shareware
04/19/23 CS135601 Introduction to Information Engineering 42
112/04/19 42
Copyright laws
• The owner of a property has the exclusive right to print, distribute, and copy the work, and permission must be obtained by anyone else to reuse the work in these ways– Extended to cover software ownership– Filtration criteria: what is not copyrightable
• Features covered by standards• Characteristics dictated by software purpose • Components in the public domain
04/19/23 CS135601 Introduction to Information Engineering 43
112/04/19 43
Patents
• Allows an inventor to benefit commercially from an invention, in exchange for a public disclosure of the invention for a time period– A natural phenomenon, like laws of physics,
mathematical formulae, cannot be patented.– Recent exceptions for some algorithms
• RSA, one of the public key encryption method (We have seen this term in lesson 1, and we shall talk this later.)
04/19/23 CS135601 Introduction to Information Engineering 44
Trade secrets
• Any confidential business information which provides an enterprise a competitive edge may be considered a trade secret.
• Trade secret laws restrict the distribution of ideas
– Non-disclosure agreements are legally enforceable
Software liability
• Limited software liability, usually stated in the software license – EX: To protect against liability, software
developers use disclaimers –“In no event will company X be liable for any damages arising out of the use of this software.”
04/19/23 CS135601 Introduction to Information Engineering 45
04/19/23 CS135601 Introduction to Information Engineering 46
Free software
• Free software is software that user has the rights (freedom) to access/modify software.– The free software foundation was
founded by Richard Stallman in 1985.
– Copyleft: in which anyone can freely reuse a work as long as they in turn do not try to restrict others from using their reuse.
– Free is for “freedom”, not for “zero charge”.
Open source, freeware, and shareware
• Open source: source code is available to the general public– Free software is one of the open source, but
other open source may be with intellectual property law to protect producers.
• Freeware: software with zero charge.
• Shareware: software that is provided to users without payment on a trial basis.
04/19/23 CS135601 Introduction to Information Engineering 47
04/19/23 CS135601 Introduction to Information Engineering 48
Related courses
• 軟體實驗,軟體工程,系統整合實作• Every programming assignment for each
course is a precious chance to practice your programming and debugging skills
• Textbook chap 7• http://en.wikipedia.org/wiki
References