340 likes | 424 Views
Classes. Author: Hans v Leunen Editors: Henk de Vries & William Ringer. Classification. Classification simplifies handling Class-wide items need only to be handled once Features that are special to the individual must be treated separately for each member of the class.
E N D
Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer
Classification • Classification simplifies handling • Class-wide items need only to be handled once • Features that are special to the individual must be treated separately for each member of the class. • The implementation becomes smaller and simpler when the class-wide part is implemented separately • If that is done systematically, it has sense to use the same principle for singletons
A managers view onto the subject An in depth treatise for the technically interested Choose your trail
Programming is modeling • Programming is a creative occupation • Programming is a way of modeling a natural or an artificial item in program code
Modeling elements • Where painters use colors and forms to generate an abstraction of their subject, programmers will use properties, aspects of behavior, relations, communication, encapsulation and coordination as ingredients for their model • It is smarter to use mutually independent descriptors • The original, more natural modeling ingredients can be converted into a new set of mutually independent categories of modeling ingredients.
Properties Relations Aspects of behavior Communication Encapsulation Coordination Modeling Elements Attributes Operations Protocol Trigger Envelop Taskmanagement& synchronization
How programmers implement modeling elements • The original, more natural modeling ingredients can be converted in a new set of mutually independent categories of modeling ingredients. • Programmers have straightforward implementations for each of these new ingredients.
Modeling => Implementation in SW Properties Attributes Datastructs Relations Operations Routines Aspects of behavior Protocol Documents Communication Trigger Call Encapsulation Envelop ADT Taskmanagement& synchronization Coordination (RTKOS)
Grouping Design Elements 1 • The design elements can be divided in two groups: • A group that describes a class of similar items • A group that describes the individuals of that class • A group can be classified according to itsbehavior and the kind of its assets
I & C I & C I & C I & C Wider Scope of Elements Properties Attributes Relations Operations C Aspects of behavior Protocol C+ Communication Trigger Encapsulation Envelop Taskmanagement& synchronization Coordination
view Architecture Scope Creative andcombinatorialtalents of thearchitect Best practices rules Model target methods requirements
model model model model View1.0 View1.0 View1.1 View1.1 View1.2 Architecture Dynamics model model target
Grouping Design Elements 2 • The design elements can be divided in two groups: • A group that describes the passive relational part of the architecture • A group that describes the active part of the architecture
Passiverelational Active View1.2 Services Architecture Split up Simple, publishable,specifies usage Complex,contains IP,specifies co-ordination
Modeling => Division Properties Attributes Relations Passive Envelop Aspects of behavior Protocol Communication Operations Encapsulation Active Trigger Taskmanagement& synchronization Coordination
Repository Repository IP-Repository Open-Repository Implement Passiverelational Active Interactiveprototyping View1.2 Incrementalsteps Services Exploiting the Division Publishable,specifies usage Skeleton target
Implementation • The implementation of an item has a class related part and a part that sets the individual apart • The result is a binary representation of an abstract data type
Class wide Individual Attribute Class ref Attribute Attribute Routine 1 Attribute Routine 2 Attribute Method Attribute Routine 3Routine 3a Method Attribute Routine 4 Method Routine 5 Method Routine 6Routine 6a Method Method Routine 6 Routine 3 Method Routine 7 Method Routine 8 Redirected ADTobject Orientation Environment 1 n ADT++ Object data Object data Class data Class data Inheritance
Environment 1 Class wide Individual n Attribute Class ref Attribute Attribute ADT++ Routine 1 Attribute Routine 2 Attribute Method Attribute Routine 3Routine 3a Method Attribute Routine 4 Method Routine 5 Method Routine 6Routine 6a Method Object data Method Routine 6 Routine 3 Method Object data Routine 7 Class data Method Routine 8 Class data Redirected Inheritance Object Orientation, Deficiencies
Encapsulation Environment Communicate with individual Generate new individual association association association Class (Operations) Individual (State) association Pass call tooperation
Class Libraries base base Class libraries are structured sets of class modulesClass modules contain differences with respect to parent classBase class modules contain the full class
library library Shell child unchanged unused Applications From Class Libraries Application children
Shell child unchanged unused Implementing Distributed Services services Application children
libraries Shell child unchanged unused Distributed Services Conflict services services Application children
Oneuniform access way Environment Class wide Individual ADT++ Attribute Class ref Attribute Attribute Routine 1 Attribute Routine 2 Attribute Method Method Attribute Routine 3Routine 3a Class ref Method Method Attribute Routine 4 Method Method Routine 5 Method Method Routine 6Routine 6a Method Method Method Method Routine 3 Routine 6 Method Routine 7 Method Method Routine 8 Method Redirected Class data Encapsulation Effective IPR hiding OO Component Orientation Environment 1 n ADT++ Object data Object data Class data Class data Inheritance
The COM object model • In short the COM object model is an abstract data type that supports multiple vtbl data structures. • Each vtbl represents an interface • Each interface includes the base interface IUnknown • The COM object model is independent of the programming language
B FuncB4 Object Interface (COM) hidden QueryInterface hidden IUnknown AddRef Release FuncA4 hidden A FuncA5 hidden hidden FuncA6 B QueryInterface hidden AddRef Release hidden FuncB4 FuncB5 hidden hidden hidden Vtbl A hidden hidden hidden hidden Class data Instance data Vtbl B
COM deficiencies • The decision to let the clients of the component manage the reference counting appeared to be a design fault. • The result is, that a COM component is not robust • It can be abused by its clients
Robust Component Object Model • In RCOM the reference counting support is deferred to the supporting infrastructure • The base interface contains a ‘ResetInstance’ method that brings the instance to its initial condition. This function may also include a cleanup task. • Cleanup and reset are required when a task that passed the instance is halted.
B FuncB4 Under the control of the infrastructure Robust Component Object Model hidden QueryAccessPoint IAccessor hidden ResetInstance FuncA3 FuncA4 A hidden FuncA5 hidden hidden FuncA6 QueryAccessPoint B hidden ResetInstance FuncB3 FuncB4 reqItf1 FuncB5 conReq hidden reqItf2 Vtbl A hidden hidden hidden hidden Class data Instance data Vtbl B
B FuncB4 Variable Variable Register Register Hardware Adding HW interfaces hidden QueryAccessPoint Accessor hidden ResetInstance FuncA3 Class data FuncA4 A hidden FuncA5 hidden hidden FuncA6 B QueryAccessPoint hidden ResetInstance FuncB5 FuncB4 reqItf1 FuncB5 conReq hidden reqItf2 Vtbl A hidden hidden hidden Vtbl B hidden Instance data Variable to register map
B FuncB4 stream Variable Variable SWStream Register Register HWStream Adding Streaming Interfaces hidden QueryAccessPoint Accessor hidden ResetInstance FuncA3 Class data FuncA4 A hidden FuncA5 hidden hidden FuncA6 B QueryAccessPoint hidden ResetInstance FuncB5 FuncB4 reqItf1 FuncB5 conReq hidden reqItf2 Vtbl A hidden hidden hidden Vtbl B hidden Instance data Variable to register map Hardware
Equipped for embedding • The HW interfaces, the streaming interfaces and the features of the component model render RCOM components particularly suitable for real-time embedded applications.
Inheritance in Component Technology • Interfaces are in fact abstract component classes. • With respect to interfaces, component classes feature multiple specification inheritance • Via the CLSID components feature singlespecification inheritance • Via the IID interfaces feature singlespecification inheritance • Other forms of inheritance are not supported