Software Engineering Principles - University Of Arkansas

Transcription

Importance of PrinciplesKey PrinciplesCase StudySoftware Engineering PrinciplesMiaoqing HuangUniversity of ArkansasSpring 20101 / 19

Importance of PrinciplesKey PrinciplesCase StudyOutline1Importance of Principles2Key Principles3Case StudyCompiler Construction2 / 19

Importance of PrinciplesKey PrinciplesCase StudyOutline1Importance of Principles2Key Principles3Case StudyCompiler Construction3 / 19

Importance of PrinciplesKey PrinciplesCase StudyPrinciples, Methodologies, and ToolsPrinciples primarily deal with the process of softwareengineering, i.e., the development of softwareThe right process will help produce the desired software productPrinciples will guide the adoption of methodologies and the toolsMethodologies and tools change more frequently than principles4 / 19

Importance of PrinciplesKey PrinciplesCase StudyPrinciples, Methodologies, and ToolsExampleHow can we fly?Principle: fight against the gravityHot air is lighter than cold airBuoyancy (lift-up force) Gravity (drag-down force)5 / 19

Importance of PrinciplesKey PrinciplesCase StudyPrinciples, Methodologies, and ToolsExampleHow can we fly?Principle: fight against the gravity12Air is diverted down fromwingsAir pushes backNewton’s third law3The airplane is lifted up intothe sky6 / 19

Importance of PrinciplesKey PrinciplesCase StudyOutline1Importance of Principles2Key Principles3Case StudyCompiler Construction7 / 19

Importance of PrinciplesKey PrinciplesCase StudyKey Principles1Rigor and formality2Separation of erality7Anticipation of change8 / 19

Importance of PrinciplesKey PrinciplesCase StudyRigor and FormalitySoftware Engineering must be practiced systematicallyRigor is a necessary complement to creativity that increases ourconfidence in our developmentsComputer is not the same as human, i.e., it is not able to handlevague commandsFormality is rigor at the highest degreeSoftware process is driven and evaluated by mathematical lawsExamples:Mathematical (formal) analysis of program correctnessSystematic (rigorous) test data derivationRigorous documentation of development steps helps projectmanagement and assessment of timeliness9 / 19

Importance of PrinciplesKey PrinciplesCase StudySeparation of Concerns, ModularitySeparation of ConcernsSeparate the complexities and concentrate on one at a time“Divide and conquer”Example: keep product requirement separate, i.e., functionality,performance, usabilitySupport parallelization of efforts and separation ofresponsibilitiesModularity: 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 concernsWhen dealing with a module we can ignore details of othermodules10 / 19

Importance of PrinciplesKey PrinciplesCase StudyModularityCohesion and CouplingHigh couplingLow couplingLaw of DemeterEach unit should only talk to its friends; don’t talk to strangersThe resulting software tends to be more maintainable andadaptable11 / 19

Importance of PrinciplesKey PrinciplesCase StudyModularityTop-down and bottom-upTop-downDecompose the whole design into modules first and thenconcentrate on individual module designBottom-upConcentrate on modules and then on their compositionThey are two phases of the whole design processRequirement analysisand specificationTop-downDesign and specificationCode and module testingBottom-upIntegration andsystem testingDelivery andmaintenance12 / 19

Importance of PrinciplesKey PrinciplesCase StudyIncrementalityProcess 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 performanceFirst step: quick-and-dirty solutionSecond step: more efficient (i.e., cleaner) designExample: Game DesignFirst 2-D release then work on 3-D designFirst coarse-grained texture then fine-grained texture13 / 19

Importance of PrinciplesKey PrinciplesCase StudyAbstractionIdentify 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 membersAfter a module is fully tested and verified, only the what part isconcerned by its user14 / 19

Importance of PrinciplesKey PrinciplesCase StudyGeneralityDiscover if it is an instance of a more general problem whosesolution can be reused in other casesIncrease the reusabilityCarefully balance generality against performance and costThe solution to a generalized problem most likely is moreexpensive than the solution to a special problemA program that can handle the multiplication between two generalmatricesA program that is specially designed to handle the multiplicationbetween two sparse matrices15 / 19

Importance of PrinciplesKey PrinciplesCase StudyAnticipation of ChangeAbility to support software evolution requires anticipatingpotential future changesMinimize the changes to the existing moduleLeave the spots in the program for future featuresBasis for software evolvabilityExampleA sorting program based on array of fixed lengthA sorting program based on link of dynamic length16 / 19

Importance of PrinciplesKey PrinciplesCase StudyCompiler ConstructionOutline1Importance of Principles2Key Principles3Case StudyCompiler Construction17 / 19

Importance of PrinciplesKey PrinciplesCase StudyCompiler ConstructionThe modular structure of a compilerSymbol ��codeLexical diagnosticsParseCodeObjecttree Generation codeSyntax diagnosticsSymbol tableParsetreeIntermediate Intermediate Machine codecode generationcodegenerationObjectcodeCode Generation18 / 19

Importance of PrinciplesKey PrinciplesCase StudyCompiler ConstructionPrinciples breakdownRigor and formalityCompiler design is one of the most serious business in softwaredevelopmentSeparation 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 releaseAbstraction and generalityGenerate intermediate code for an abstract machineJava Virtual machineUse command-line arguments to specify the target machinegcc or g compilerAnticipation of changeNew instruction set with new processor architecture19 / 19

Principles, Methodologies, and Tools Principles primarily deal with the process of software engineering, i.e., the development of software The right process will help produce the desired software product Principles will guide the adoption of methodologies and the tools Methodologies and tools change more frequently than principles 4/19