Kĩ thuật lập trình - Chapter 6: Semantic integrity in component based development

The visible state of the random access component is defined in a state schema called RandomAccess The term records represent all the records in the file and R is the record data type. The variable hwm (for 'high water mark') shows how much of the file is in use.

ppt18 trang | Chia sẻ: huyhoang44 | Lượt xem: 510 | Lượt tải: 0download
Bạn đang xem nội dung tài liệu Kĩ thuật lập trình - Chapter 6: Semantic integrity in component based development, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Chapter 6Semantic Integrity in Component Based DevelopmentPage Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentOverviewIntroductionGeneral Issues of Semantic Concern Levels of Formalism for Semantic SpecificationsPhases in a Component’s Life A Taxonomy for Component Semantics Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentIntroductionThe specification of an interface: is partly syntactic, partly semanticThe semantic component properties are expressed:using invariants for the component as a wholecontracts expressed through pre- and postconditions, for each operation Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentSpecification LevelsLevels of a component specification:Syntax: includes specifications on the programming language level.Behavior: relates to contracts.Synchronization: describes the dependencies between services provided by a component.Quality of service: deals with quality of service.Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentContractsThe semantics of an operation are described with a contract. Pre-condition: specifies the required entry conditions for activating the operation.Post-condition: specifies the exit conditions guaranteed by the operation at the end of its execution, provided the pre-condition was satisfied at the entry. The outcome in case the pre-condition was not satisfied is explicitly left undefined. Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentRequired and Provided InterfacesTo be composable solely on the basis of its specification, a component needs to be equipped with:Explicit declarations of functionality, synchronization and quality required propertiesprovided propertiesComponentPage Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentLevels of Formalism for Semantic SpecificationsThe levels of formalism, in an increasing order of formalism: No semantics Intuitive semantics Structured semantics Executable semantics Formal semantics Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentAn ExampleC omponent RandomAccesscontrolling the access to random access file of a record type Rrecords of a fixed sizeaccess to the file is by record number.It is assumed that the file is continuous.Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentThe contractThe precondition for this interface contract single input parameter of the operation is the number of the record concerned, which must exist in the file. The post-condition result of the operation is the required data record of type R.Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentLevel 0: No SemanticsThe following definition of the operation getRecord illustrates how a purely syntactic specification would be given: Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentIntuitive SemanticsAn intuitive specification of the operation getRecord:Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentStructured SemanticsA structured specification of the operation getRecord:Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentExecutable Semantics By “executable semantics” expressed in a way that can be executed and controlled by the system during run-time. Executable specification for getRecord:Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentTrapping Offending CallsFor debugging purposes, the component itself may use the executable precondition to trap offending calls: Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentEnsuring a Correct CallThe client code may also take advantage of the executable assertions by checking the precondition before the call, as illustrated below: Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentFormal SemanticsThe visible state of the random access component is defined in a state schema called RandomAccessThe term records represent all the records in the file and R is the record data type. The variable hwm (for 'high water mark') shows how much of the file is in use.Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentFormal Semantics ContinuedThe file operation is defined as a state schema called getRecord and is illustrated below: Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based DevelopmentA Taxonomy for Component SemanticsLifecycleCreationUseMaintenanceNo semanticsIntuitive semanticsStructured semanticsExecutable semanticsFormal semanticsSemantic formalism********************************************************Page Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based Development

Các file đính kèm theo tài liệu này:

  • ppt06_chapterwc_3904.ppt