Software Engineering Principles · Requirement analysis and specification Design and specification...
Transcript of Software Engineering Principles · Requirement analysis and specification Design and specification...
Importance of PrinciplesKey Principles
Case Study
Software Engineering Principles
Miaoqing HuangUniversity of Arkansas
Spring 2010
1 / 19
Importance of PrinciplesKey Principles
Case Study
Outline
1 Importance of Principles
2 Key Principles
3 Case StudyCompiler Construction
2 / 19
Importance of PrinciplesKey Principles
Case Study
Outline
1 Importance of Principles
2 Key Principles
3 Case StudyCompiler Construction
3 / 19
Importance of PrinciplesKey Principles
Case Study
Principles, Methodologies, and Tools
Principles primarily deal with the process of softwareengineering, i.e., the development of software
The right process will help produce the desired software productPrinciples will guide the adoption of methodologies and the tools
Methodologies and tools change more frequently than principles
4 / 19
Importance of PrinciplesKey Principles
Case Study
Principles, Methodologies, and ToolsExample
How can we fly?Principle: fight against the gravity
Hot air is lighter than cold airBuoyancy (lift-up force) >Gravity (drag-down force)
5 / 19
Importance of PrinciplesKey Principles
Case Study
Principles, Methodologies, and ToolsExample
How can we fly?Principle: fight against the gravity
1 Air is diverted down fromwings
2 Air pushes backNewton’s third law
3 The airplane is lifted up intothe sky
6 / 19
Importance of PrinciplesKey Principles
Case Study
Outline
1 Importance of Principles
2 Key Principles
3 Case StudyCompiler Construction
7 / 19
Importance of PrinciplesKey Principles
Case Study
Key Principles
1 Rigor and formality2 Separation of concerns3 Modularity4 Incrementality5 Abstraction6 Generality7 Anticipation of change
8 / 19
Importance of PrinciplesKey Principles
Case Study
Rigor and Formality
Software Engineering must be practiced systematicallyRigor is a necessary complement to creativity that increases ourconfidence in our developments
Computer is not the same as human, i.e., it is not able to handlevague commands
Formality is rigor at the highest degreeSoftware process is driven and evaluated by mathematical laws
Examples:Mathematical (formal) analysis of program correctnessSystematic (rigorous) test data derivationRigorous documentation of development steps helps projectmanagement and assessment of timeliness
9 / 19
Importance of PrinciplesKey Principles
Case Study
Separation of Concerns, Modularity
Separation of ConcernsSeparate the complexities and concentrate on one at a time
“Divide and conquer”Example: keep product requirement separate, i.e., functionality,performance, usability
Support parallelization of efforts and separation ofresponsibilities
Modularity: the cornerstone principleA complex system may be divided into simpler pieces calledmodulesA system that is composed of modules is called modularSupport application of separation of concerns
When dealing with a module we can ignore details of othermodules
10 / 19
Importance of PrinciplesKey Principles
Case Study
ModularityCohesion and Coupling
High coupling Low coupling
Law of DemeterEach unit should only talk to its friends; don’t talk to strangersThe resulting software tends to be more maintainable andadaptable
11 / 19
Importance of PrinciplesKey Principles
Case Study
ModularityTop-down and bottom-up
Top-downDecompose the whole design into modules first and thenconcentrate on individual module design
Bottom-upConcentrate on modules and then on their composition
They are two phases of the whole design process
Requirement analysisand specification
Design and specification
Code and module testing
Integration and system testing
Delivery and maintenance
Top-down
Bottom-up
12 / 19
Importance of PrinciplesKey Principles
Case Study
Incrementality
Process proceeds in a stepwise fashion (increments)Deliver subsets of a system (prototype) early to get early feedbackfrom expected users, then add new features incrementallyDeal first with functionality, then turn to performance
First step: quick-and-dirty solutionSecond step: more efficient (i.e., cleaner) design
Example: Game DesignFirst 2-D release then work on 3-D designFirst coarse-grained texture then fine-grained texture
13 / 19
Importance of PrinciplesKey Principles
Case Study
Abstraction
Identify the important aspects of a phenomenon and ignore itsdetailsSpecial case of separation of concernsThe type of abstraction to apply depends on purpose or roles(user or designer)
The user of a software concerns the what it does, not how it doesThe designer in a team concerns what and how of his/her ownpart, and what of other parts that belong to other team members
After a module is fully tested and verified, only the what part isconcerned by its user
14 / 19
Importance of PrinciplesKey Principles
Case Study
Generality
Discover if it is an instance of a more general problem whosesolution can be reused in other cases
Increase the reusabilityCarefully balance generality against performance and cost
The solution to a generalized problem most likely is moreexpensive than the solution to a special problem
A program that can handle the multiplication between two generalmatricesA program that is specially designed to handle the multiplicationbetween two sparse matrices
15 / 19
Importance of PrinciplesKey Principles
Case Study
Anticipation of Change
Ability to support software evolution requires anticipatingpotential future changes
Minimize the changes to the existing moduleLeave the spots in the program for future features
Basis for software evolvabilityExample
A sorting program based on array of fixed lengthA sorting program based on link of dynamic length
16 / 19
Importance of PrinciplesKey Principles
Case StudyCompiler Construction
Outline
1 Importance of Principles
2 Key Principles
3 Case StudyCompiler Construction
17 / 19
Importance of PrinciplesKey Principles
Case StudyCompiler Construction
The modular structure of a compiler
Lexicalanalysis
ParsingCode
GenerationSourcecode
“Tokenized”code
Parsetree
Objectcode
Symbol table
Syntax diagnosticsLexical diagnostics
Code Generation
Intermediatecode generation
Machine codegeneration
Intermediatecode
Objectcode
Parsetree
Symbol table
18 / 19
Importance of PrinciplesKey Principles
Case StudyCompiler Construction
Principles breakdown
Rigor and formalityCompiler design is one of the most serious business in softwaredevelopment
Separation of concerns, modularity, and incrementalityCorrectness first, performance next, then ease of useDecompose the whole project into small modules that can bedesigned and verified in a comparatively easy wayCover only a subset of the source language and omit somefeatures in the first release
Abstraction and generalityGenerate intermediate code for an abstract machine
Java Virtual machineUse command-line arguments to specify the target machine
gcc or g++ compiler
Anticipation of changeNew instruction set with new processor architecture
19 / 19