Software Engineering 9252021 CheRung Lee 9252021 CS 135601

  • Slides: 48
Download presentation
Software Engineering 9/25/2021 Che-Rung Lee 9/25/2021 CS 135601 Introduction to Information Engineering 1

Software Engineering 9/25/2021 Che-Rung Lee 9/25/2021 CS 135601 Introduction to Information Engineering 1

What makes software development hard? Traditional Engineering Software Engineering “Off the shelf” components available

What makes software development hard? Traditional Engineering Software Engineering “Off the shelf” components available Often Rarely Required performance Within tolerances Perfect Quality metrics Mean time to failure Unclear Scientific basis Physics Unclear 9/25/2021 CS 135601 Introduction to Information Engineering 2

Size makes differences Code size (lines) Complexity Repeated updates Developer(s) Working system Tens to

Size makes differences Code size (lines) Complexity Repeated updates Developer(s) Working system Tens to hundreds 104~107 Low High No Yes Usually one person Reliability requirement 9/25/2021 Small program Usually many people Low CS 135601 Introduction to Information Engineering High 3

The software life cycle Design Develop -ment Mainte -nance 1 x 1. 5 -6

The software life cycle Design Develop -ment Mainte -nance 1 x 1. 5 -6 x 60 -100 x Cost to change More efforts put on the early development will win tremendous payoff later 9/25/2021 Repair, maintenance to fix bugs, or adapt new demands OR, discard old software and redevelop the new one from scratch!? CS 135601 Introduction to Information Engineering 4

Outline • Software engineering methodologies 1. Analysis phase: requirement specification – The human-machine interface

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 9/25/2021 CS 135601 Introduction to Information Engineering 5

Software Engineering Methodologies 9/25/2021 CS 135601 Introduction to Information Engineering 6

Software Engineering Methodologies 9/25/2021 CS 135601 Introduction to Information Engineering 6

Waterfall model • Analysis (requirement specification) – Identify the needs of the users, and

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 9/25/2021 CS 135601 Introduction to Information Engineering 7

Incremental model • Constructs the software system in increments • Prototyping: Incomplete versions of

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 9/25/2021 CS 135601 Introduction to Information Engineering 8

Iterative model • Similar to the incremental model, but rebuilding each version rather than

Iterative model • Similar to the incremental model, but rebuilding each version rather than extending • Rational unified process (RUP) 9/25/2021 CS 135601 Introduction to Information Engineering 9

Other models • Open source development – The source code is available for everyone

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 9/25/2021 CS 135601 Introduction to Information Engineering 10

CASE tools • Computer-Aided Software Engineering – Project planning tools (cost estimation, project scheduling,

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 9/25/2021 CS 135601 Introduction to Information Engineering 11

Analysis Phase: Requirement Specification & the Human-Machine Interface 9/25/2021 CS 135601 Introduction to Information

Analysis Phase: Requirement Specification & the Human-Machine Interface 9/25/2021 CS 135601 Introduction to Information Engineering 12

Requirement acquiring • Stakeholder: future users – From an entity, such as a company

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 9/25/2021 CS 135601 Introduction to Information Engineering 13

Human vs. computer Abilities computer human 1950 1990 2030 • Abilities may include speed,

Human vs. computer Abilities computer human 1950 1990 2030 • Abilities may include speed, memory, … • Which one do you prefer? Apple’s one button laptop, No keyboard !? 9/25/2021 CS 135601 Introduction to Information Engineering 14

Human machine interface • Ergonomics (人類 程學) – Ex: the layout of 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 9/25/2021 CS 135601 Introduction to Information Engineering 15

The GOMS model • A metric to measure the effectiveness of an interface design

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 9/25/2021 CS 135601 Introduction to Information Engineering 16

Design Phase: Modularization and Methods 9/25/2021 CS 135601 Introduction to Information Engineering 17

Design Phase: Modularization and Methods 9/25/2021 CS 135601 Introduction to Information Engineering 17

Modularity • The division of software into manageable units, call modules – Ex: the

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 9/25/2021 CS 135601 Introduction to Information Engineering 18

Coupling • The independence between modules – Control coupling: a module passes control to

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 9/25/2021 CS 135601 Introduction to Information Engineering 19

Cohesion • Internal binding within a module – Logical cohesion: logical similarity between actions

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 9/25/2021 CS 135601 Introduction to Information Engineering 20

Methods • Dataflow diagram • Object-oriented approach – Unified modeling language • Design patterns

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 9/25/2021 CS 135601 Introduction to Information Engineering 21

Dataflow diagram • Displays how data moves through a system – Rectangle: data sources

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 9/25/2021 CS 135601 Introduction to Information Engineering 22

Object-oriented approach • Use-case diagram – Stick figure (actors): users – Ovals (use cases):

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) 9/25/2021 CS 135601 Introduction to Information Engineering 23

Association multiplicities 9/25/2021 CS 135601 Introduction to Information Engineering 24

Association multiplicities 9/25/2021 CS 135601 Introduction to Information Engineering 24

Interaction diagrams • The communications between individuals that are involved in performing a task

Interaction diagrams • The communications between individuals that are involved in performing a task 9/25/2021 CS 135601 Introduction to Information Engineering 25

Design pattern • A predeveloped model for solving a recurring problem class rectangle{ int

Design pattern • A predeveloped model for solving a recurring problem class rectangle{ int x, y, width, height; • Ex: adaptor …. . } Plug adaptor class rectangle. Adaptor { void draw(){ draw. Rec(x, y, x+width, y+height); } } void draw. Rec(int x 1, int y 1, int x 2, int y 2) // display a rectangle (x 1, y 1, x 2, y 2) } 9/25/2021 CS 135601 Introduction to Information Engineering 26

Implementation Phase: Style and Tools Comments, indentation, IDE, Make file, (Concurrent) version control 9/25/2021

Implementation Phase: Style and Tools Comments, indentation, IDE, Make file, (Concurrent) version control 9/25/2021 CS 135601 Introduction to Information Engineering 27

A terrible example • Do you know what this code does? int i; main(){for(;

A terrible example • Do you know what this code does? int i; main(){for(; i["]<i; ++i){--i; }"]; read('-'-'AT H T O ', i+++"hello, world!n", '/'/'/')); }read(j, i, p){write(j/p+p, i D T ’ N O D ---j, i/i); } • It can be compiled and executed, but • unless you want to show bad a programming style can be 9/25/2021 CS 135601 Introduction to Information Engineering 28

Programming style • A set of rules or guidelines that help programmers to read

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 (I 0 and l. O) – Consistent naming conventions – Clear statements and type definitions • EX 1: char* dest, src; //what’s src’s type? • EX 2: *p++; // which value is increased, p or *p? –… 9/25/2021 CS 135601 Introduction to Information Engineering 29

What should be in comments? • For a file/module – Description of functionality, a

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 9/25/2021 CS 135601 Introduction to Information Engineering 30

Preconditions/postconditions • Pre-conditions: what must be true before invoking a method – EX: int

Preconditions/postconditions • Pre-conditions: what must be true before invoking a method – EX: int binary. Search(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: 9/25/2021 • return. Value>=0 and d[return. Value]==x • or return. Value==-1 and x does not occur in d 31 CS 135601 Introduction to Information Engineering

IDE • Integrated Development Environment – May include a source code editor, a compiler

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… 9/25/2021 CS 135601 Introduction to Information Engineering 32

Make/Makefile • Make is a utility for building executable programs/libraries from source code. •

Make/Makefile • Make is a utility for building executable programs/libraries from source code. • Makefile: define building rules for Make – Compiler, dependency, path, … – EX: # Comments use the hash symbol target: dependencies command 1 command 2. . . command n 9/25/2021 CS 135601 Introduction to Information Engineering 33

Revision control • The management of changes to documents, programs, and other information stored

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 9/25/2021 CS 135601 Introduction to Information Engineering 34

Testing Phase: Quality Assurance and Documentation 9/25/2021 CS 135601 Introduction to Information Engineering 35

Testing Phase: Quality Assurance and Documentation 9/25/2021 CS 135601 Introduction to Information Engineering 35

Testing • Program runs on a small subset of inputs – Testing is not

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

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 binary. Search(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

Black-box testing • Tester does not rely on the knowledge of software interior composition – Boundary value analysis: • EX: int binary. Search(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

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.

Software Ownership & Liability 9/25/2021 CS 135601 Introduction to Information Engineering 40

Software Ownership & Liability 9/25/2021 CS 135601 Introduction to Information Engineering 40

Intellectual property • • Copyright: © protect creation/creator Patents: protect invention/inventor Trademark: ® protect

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 9/25/2021 CS 135601 Introduction to Information Engineering 41

Copyright laws • The owner of a property has the exclusive right to print,

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 9/25/2021/9/25 CS 135601 Introduction to Information Engineering 42 42

Patents • Allows an inventor to benefit commercially from an invention, in exchange for

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. ) 9/25/2021/9/25 CS 135601 Introduction to Information Engineering 43 43

Trade secrets • Any confidential business information which provides an enterprise a competitive edge

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 9/25/2021 CS 135601 Introduction to Information Engineering 44

Software liability • Limited software liability, usually stated in the software license – EX:

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. ” 9/25/2021 CS 135601 Introduction to Information Engineering 45

Free software • Free software is software that user has the rights (freedom) to

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”. 9/25/2021 CS 135601 Introduction to Information Engineering 46

Open source, freeware, and shareware • Open source: source code is available to the

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. 9/25/2021 CS 135601 Introduction to Information Engineering 47

Related courses • 軟體實驗,軟體 程,系統整合實作 • Every programming assignment for each course is a

Related courses • 軟體實驗,軟體 程,系統整合實作 • Every programming assignment for each course is a precious chance to practice your programming and debugging skills References • Textbook chap 7 • http: //en. wikipedia. org/wiki 9/25/2021 CS 135601 Introduction to Information Engineering 48