Component - Based Software Engineering - University of Surrey_第1頁
Component - Based Software Engineering - University of Surrey_第2頁
Component - Based Software Engineering - University of Surrey_第3頁
Component - Based Software Engineering - University of Surrey_第4頁
Component - Based Software Engineering - University of Surrey_第5頁
已閱讀5頁,還剩66頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領

文檔簡介

1、Component-Based Software EngineeringIntroduction and OverviewPaul KrauseLecture 1 - OverviewContentsSoftware EngineeringComponents as architectureWhat is a software component?InterfacesSoftware as a “metaproductWhy Software Engineering?The difference between writing a program and engineering a softw

2、are systemis like the difference between building a patio table and building a bridgeYou can patch up one until it worksYou need careful analysis and design to succeed with the otherGood Software Engineering practice is essential for Software ComponentsEngineeringThe profession in whicha knowledge o

3、f the mathematical and natural sciences gained by study, experience and practiceis applied with judgementto develop ways to utilise, economically, the materials and forces of nature for the benefit of mankindAccreditation board for Engineering and Technology, 1996Lecture 1 - OverviewContentsSoftware

4、 EngineeringComponents as architectureWhat is a software component?InterfacesSoftware as a “metaproductSoftware Components mean?The main driver behind software components is reuse.That means we must modularise applications if they are to have potentially reusable parts.The expectation is that if the

5、 parts (often collections of classes) can be reused then costs will be reduced (in the long run).So whats new?Modularisation of software is not new.What we want of a component is thatIt may be used by other program elements (clients) (encapsulation and low coupling good strategies for any modular de

6、sign)The clients and their authors do not need to be known to the components authorsThis is a little bit new, and only works if all the respective authors work to a common standardAn Example ComponentA Windows executableCan be dynamically linked to any Windows applicationCan be composed with other C

7、OM objectsDo we get anything for free?Of course not!Components may be classes (or collections of classes), but they must satisfy additional guidelines:So we really do understand what is provided and what is required at their interfacesSo that we know the framework or architecture in which they are t

8、o be usedComponents as architectureCould view “independent components as a category of software architecturesPipes and filtersUnixParallel communicating processesJava threadsClient-serverWorld-wide web;CORBA a middle layer that provides a common data busEvent systemsJava event model and Java BeansLe

9、cture 1 - OverviewContentsSoftware EngineeringComponents as architectureWhat is a software component?InterfacesSoftware as a “metaproductWhat is a Software Component?“Components are units of deploymentClemens SzyperskiDrivers for CBDThe development of the WWW and InternetSystems of loosely coordinat

10、ed servicesObject-oriented design techniques and languagesMove from Mainframe to client-server based computingRapid pace of technological changeEconomic necessity of maximising reuseAre Components New?SubroutinesTuring, 1949, Checking a Large RoutineStructured ProgrammingDijkstra, 1968LibrariesNAG,

11、1971Information HidingParnas, 1972Software ComponentsComponents are for composition(In principle) already exisiting “things can be reused by rearranging them to make a new compositeSo components are about reuseThis drives many of the engineering requirements for software componentsWhat is a componen

12、t (2)?A component makes its services available through interfacesAnd interfaces are of certain types or categoriesRevised DefinitionA software component is a unit of composition with contractually specified interfaces and explicit context dependencies only.A software component can be deployed indepe

13、ndently and is subject to composition by third parties.1996 European Conference on Object-Oriented ProgrammingLecture 1 - OverviewContentsSoftware EngineeringComponents as architectureWhat is a software component?InterfacesSoftware as a “metaproductConnector Design:Button:Button:Motor:Meterpressedpr

14、essedstartstopspeedvalueConnector Design:Button:Button:Motor:Meterpressedpressedstartstopspeedvalue:OR:Thresholdaba ba ba b:Multiplier:Selector1, 10, 100aba x b5:intabLessons from electronics kitFamilies of products from kits of componentsDesign of a component infrastuctureBasic technology - e.g. do

15、 components interact via procedure calls or remote method invocations?Component designComponents must conform to the component infrastructureProduct buildingInfrastructure:Do pluggable connectors mean common data types across all components?No!Local usage may not fit a common typeAnswer: Encapsulati

16、onNo direct access to the data of any component from outsideAll communication should be a request defined in an interfaceRevised DefinitionA software component is a unit of composition with contractually specified interfaces and explicit context dependencies only.A software component can be deployed

17、 independently and is subject to composition by third parties.1996 European Conference on Object-Oriented ProgrammingIndependent DeploymentEncapsulationCannot be partially deployedMust have clear specifications of what it requires, as well as what it providesMust have well-defined interfacesInterfac

18、esInterfaces allow the clients of a component to access the services provided by a componentDifferent interfaces will normally provide access to different servicesEach interface specification could be viewed as a contract between the component and a clientExplicit context dependenciesComponents must

19、 also specify their needsi.e. the context of composition and deploymentThis means bothThe components requires interfaces, andThe component world it is prepared for(CORBA, COM, Java)Component SpecificationProvides InterfacesThe services a component can offer to a clientRequires InterfacesThe services

20、 required by a component to help it deliver its promisesContext of UseThe “world the component lives inLecture 1 - OverviewContentsSoftware EngineeringComponents as architectureWhat is a software component?InterfacesSoftware as a “metaproductSoftware ICs?PageAcquisitionPageStoreThe nature of softwar

21、e“Delivery of software means delivering the blueprints for productsClemens SzyperskiWhen software is installed on a computer, an instance of the product is instantiatedThe computer can instantiate the product one or more timesBetter to view software as a “metaproductPlans vs. InstancesPlans can be p

22、arameterisedPlans can be applied recursivelyPlans can be scaledPlans can be instantiated any number of timesSummaryWe have:Seen some of the drivers behind the introduction of component-based software engineeringExplored some definitions of software componentsIdentified the importance of specifying r

23、equires and provides interfacesLecture 1 (Part 2) - Software ArchitectureContentsWhy is this interesting?What is Software Architecture?Why is Software Architecture Important?Architectural Views and FrameworksArchitecture-Based DevelopmentSumming UpWhy Study Architecture?The choice of Architecture de

24、termines many of the qualities of a software systemArchitecture is the blueprint for component integrationDefines the context in which a class of components may be usedSoftware Architecture is?Software architecture is about structural properties:ComponentsInterrelationshipsPrinciplesGuidelinesIt is

25、one of the earliest stages in software system designAQUADARWINCLASSICCARBONCOCOAJAVAQUARTZOPENGLQUICKTIMEMac OS X Component ArchitectureMac OS X Component ArchitectureAQUABSD SUBSYSTEMMACH KERNELCLASSICCARBONCOCOAJAVAQUARTZOPENGLQUICKTIMEIMAGING LAYERMac OS X Component ArchitectureAQUABSD SUBSYSTEMM

26、ACH KERNELCLASSICCARBONCOCOAJAVAQUARTZOPENGLQUICKTIMEAPI LAYERMac OS X Component ArchitectureAQUABSD SUBSYSTEMMACH KERNELCLASSICCARBONCOCOAJAVAQUARTZOPENGLQUICKTIMEUSER INTERFACE LAYERStructural Issues?Gross organisation and global control structureProtocols for communication, synchronisation and da

27、ta accessAssignment of functionality to design elementsPhysical distributionComposition of design elementsScaling and performanceWhy is it important?“If a project has not achieved a system architecture, including its rationale, the project should not proceed to full-scale system development. Specify

28、ing the architecture as a deliverable enables its use throughout the development and maintenance process.Barry Boehm, Invited talk, First International Workshop on Architecture for Software SystemsThree Basic Reasons:Mutual communicationA common high-level abstraction that can be used by all the sys

29、tems stakeholdersEarly design decisionsOnes that will be important throughout the lifecycle (development, service and maintenance)Transferable abstraction of the systemRelatively small, intellectually graspable model of the systemTransferable ModelReuse at the architectural level for systems with si

30、milar requirementsEntire product lines can share a common architectureFacilitates use of externally-developed componentsArchitecture constrains how components interact with their environmentHow they receive and relinquish controlThe data they work with and produceThe protocols they use for communica

31、tion and resource sharingThe Need for Multiple ViewsAs well as functionality, we need to reason about physical distribution, process communication and synchronisation May need different views to reflect the concerns of different stakeholdersThe structure represented in a viewMay or may not exist at

32、runtimeMay describe the product, the process of building the product, or the process of using the productSome Representative ViewsConceptual (Logical) ViewAbstract representation of the functional requirements: block diagrams, class diagramsModule (Development) ViewOrganisation of modules, component

33、s, subsystems (e.g. layered architecture)Process (Coordination) ViewRuntime behaviour: concurrency, synchronisationThe Physical ViewMapping of software onto hardwareSummary of ViewsConceptualEnd Users- functionalityModuleProgrammers- software managementProcessSystem Integrators performance scalabili

34、ty throughputPhysicalSystem engineers system topology delivery installation telecommunicationSumming UpComponent-based software engineering is a highly structured way of workingSoftware architecture concerns the structural properties of a system_Getting the software architecture right is a critical

35、success factor in component-based software engineeringLecture 1 Part 3 - Object-Orientation & UMLContentsOverviewClassifiersStatic ModellingDynamic BehaviourSumming UpUnified Modelling LanguageVisual modelling languageSpecifyVisualiseConstructDocumentUML can be used to capture information about:Stat

36、ic structureDynamic behaviourEnvironmental aspectsOrganisational aspectsOverview height: Real age: RealPersonMale_PersonFemale_PersonStatic ViewLockedAvailableSoldtimed outlockunlockbuyBehavioural View: Single Objectcustomercredit servicevendorrequest itemshow availabilityselect itemdemand paymentin

37、sert cardcharge cardDynamic behaviour: communication patternsCreditCardChargesItemSellerManagerInterfaceItemDBSalesServerCustomerInterfaceClientServiceInterfaceSalesTerminal1*1*Deployment ViewLecture 1 Part 4 - Two Real-World ProjectsA Talk in Four PartsPrologueRequirements Modeling for Families of

38、Complex SystemsThe Koala Component Model for Consumer Electronics SoftwareEpilogueContext: Medical imaging: X-RayCardio/VascularUniversalRadiographyandFluoroscopyRadiographySurgeryDocuments: Example modelXrayBeamToDetectorPositionSourceImageDistanceDetectorCircleShutterDiameterSpeedXRayBeamShapeInte

39、nsitySpectrumExposableRectangleShutterHeightWidthXSpeedYSpeedTubeVoltageCurrent11GeneratesShutterDetectorShapesObjectShapesXRaySource10.*10.*11Documents: Example use caseUse case CloseCircleShutter:When the CloseShuttersEvent is received from the ClinicalUser, then the Diameter of the Object CircleS

40、hutter is decreased with a fixed Speed, until either the StopShuttersEvent or the OpenShuttersEvent is received.ConclusionWe learned:Early construction of a requirements object model provides an explicit, shared map of concepts.Developing use cases and object model hand in hand leads to precise use

41、cases and a complete model.Overlapping groups allow many participants and parallel work, while maintaining consistency.Not the individual technique counts, but the way they fit together.Lecture 1 Part 5 - Object-Orientation & JavaContentsGetting StartedA Little Bit of SyntaxDifferences between C and

42、 JavaObject-Oriented Programming in JavaDefining a ClassAccountnumberbalancecredit_accountdebit_accountmembersfieldsmethodspublic class Account public int number; public double balance; public void credit(double x) / do some sums public void debit(double y) / do checking then sums “Circle ExampleCir

43、cleradiuscircumferenceareapublic class Circle public double radius;public double circumference() return 2 * PI * radius;public double area() return PI * radius * radius;public static final double PI = 3.14159;The “Circle classpublic class Circle / A class field public static final double PI= 3.14159

44、; / A useful constant / A class method: just compute a value based on the arguments public static double radiansToDegrees(double rads) return rads * 180 / PI; / An instance field public double r; / The radius of the circle / Two instance methods: they operate on the instance fields / of an object pu

45、blic double area() / Compute the area of the circle return PI * r * r; public double circumference() / Compute the circumference return 2 * PI * r; Lecture 1 Part 6 - InterfacesContentsInterfaces as ContractsFuture ProofingNon-functional requirementsAre we done?Interfaces as contractsCan view an int

46、erface specification as a “contract between the client and a providerSo the interface specification must state:What the client needs to doWhat a provider can rely onWhat a provider must promise in returnWhat the client can rely onPre- and Post-ConditionsPre-conditions:What the client must establish

47、before calling the operationThe provider can rely on this condition being true whenever the operation is calledPost-conditions:What the provider must establish before returning to the clientThe client can rely on this condition being true whenever the call to the operation returnsExamplepublic interface Directory public void addEntry(String name, File file); / pre name != “ and file != null / post File file = map.get(name)Associate pre- and post-conditions to every meth

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論