Download It

454 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
454
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Download It

  1. 1. University of Genoa Course of Software Engineering II 01-02 Elisabetta Parodi
  2. 2. Summary 1/2 <ul><li>Introduction </li></ul><ul><ul><li>Walking towards COM </li></ul></ul><ul><li>COM </li></ul><ul><ul><li>Introducing COM </li></ul></ul><ul><ul><li>Terminology </li></ul></ul><ul><ul><li>COM Binary Standard </li></ul></ul><ul><ul><li>Interface </li></ul></ul><ul><ul><li>Component Object Library </li></ul></ul><ul><ul><li>COM Server </li></ul></ul><ul><ul><li>COM Object </li></ul></ul><ul><ul><li>COM Technologies </li></ul></ul><ul><ul><li>Example </li></ul></ul>
  3. 3. Summary 2/2 <ul><li>DCOM </li></ul><ul><ul><li>Introducing DCOM </li></ul></ul><ul><ul><li>DCOM Architecture </li></ul></ul><ul><ul><li>Location Independence </li></ul></ul><ul><ul><li>Connection Management </li></ul></ul><ul><ul><li>Security </li></ul></ul><ul><li>Global Overview </li></ul><ul><ul><li>Weaknesses of COM/DCOM </li></ul></ul><ul><ul><li>Comparison of DCOM, CORBA, RMI </li></ul></ul><ul><li>References </li></ul>
  4. 4. Introduction : walking towards COM <ul><li>Windows purpose : moving integration between applicative functions to O.S. level </li></ul> it needs effective communication mechanisms between applications 1/2 clipboard DDE OLE COM
  5. 5. Introduction : walking towards COM 2/2 <ul><li>DLL s are a good starting point for modularity </li></ul><ul><li>problems : </li></ul><ul><ul><li>physical location dependency </li></ul></ul><ul><ul><li>version management </li></ul></ul> we need a better communication mechanism. An object-based and synchronous client-server technology facilitates: <ul><ul><li>robustness </li></ul></ul><ul><ul><li>API’s homogeneity </li></ul></ul><ul><ul><li>physical location independency </li></ul></ul><ul><ul><li>splitting into components </li></ul></ul>
  6. 6. Introducing COM <ul><li>component software architecture that allows applications and systems to be built from components supplied by different software vendors </li></ul> supports : interoperability and reusability  benefits : maintainability and adaptability however, in order to interact, components must adhere to a binary structure specified by Microsoft <ul><li>COM : Component Object Model (1992) </li></ul>
  7. 7. COM Terminology <ul><li>Interface </li></ul><ul><li>a group of related functions that specifies a contract </li></ul><ul><li>Class </li></ul><ul><ul><li>named, concrete implementation of one or more interfaces </li></ul></ul><ul><li>Object </li></ul><ul><ul><li>an instance of a COM class </li></ul></ul><ul><li>Component </li></ul><ul><ul><li>binary unit of code that creates COM objects </li></ul></ul>
  8. 8. COM Binary Standard <ul><li>  A standard way to : </li></ul><ul><li>lay out virtual function tables ( vtables ) in memory </li></ul><ul><li>call functions through the vtables </li></ul><ul><li> any language that can call functions via pointers (C,  C++, Small Talk, Ada, and even Basic) can be used to write components that can interoperate with other components written into the same binary standard </li></ul>
  9. 9. Interface 1/3 <ul><li>collection of functions by which applications interact with each other and with the system </li></ul><ul><li>strongly typed contract between software components to provide a small but useful set of semantically related operations (methods) : Component Object Design </li></ul><ul><li>definition of an expected behavior and expected responsabilities </li></ul>
  10. 10. <ul><li>considered logically immutable </li></ul>reason : removing the potential for version incompatibility new functionality : can be exposed through a different interface remember : <ul><li>is not a class </li></ul><ul><li>is not a component object </li></ul><ul><li>denotes behavior only, not state </li></ul><ul><li>component objects can implement multiple interfaces </li></ul><ul><li>is strongly typed </li></ul>Interface 2/3
  11. 11. Interface 3/3 <ul><li>identified by an IID </li></ul><ul><li>must derive from Iunknown : </li></ul><ul><ul><li>one special interface to implement some essential functions: all component objects are required to implement it </li></ul></ul><ul><ul><li>three methods : </li></ul></ul><ul><ul><li>QueryInterface allows clients to dynamically discover whether or not an interface is supported by a component object; if so, it returns an interface pointer from a component object </li></ul></ul><ul><ul><li>AddRef </li></ul></ul><ul><ul><li>Release </li></ul></ul><ul><ul><li>simple reference counting methods </li></ul></ul>
  12. 12. Component Object Library <ul><li>A system component that provides the mechanics of COM: </li></ul><ul><li>provides the ability to make IUnknown calls across processes </li></ul><ul><li>encapsulates all the “legwork” associated with launching components and establishing connections between components </li></ul>
  13. 13. Component Object Library Registration DB Application CLSID Creating a component object CLSID DLL .EXE CLSID
  14. 14. COM server <ul><li>In general : </li></ul><ul><li>some piece of code that implements some component object such that the Component Object Library and its services can run that code and have it create component objects </li></ul>Three ways in which a client can access COM objects provided by a server: <ul><li>In-Process Server </li></ul><ul><li>Local Object Proxy </li></ul><ul><li>Remote Object Proxy </li></ul>
  15. 15. Cient Application In-Process Object Local Object Proxy Client Process In-Process Server Remote Object Proxy Stub Local Object Local Server Process COM Local Server RPC Remote Machine Stub COM Remote Object Remote Server Remote Server Process RPC COM
  16. 16. COM object In general : some function that produces a defined output, given tah the input meets predefined parameters. COM encapsulates the function, only giving the client of an object acces to the object interface(s). <ul><li>All COM objects : </li></ul><ul><li>are registered with a component database </li></ul><ul><li>have no identity </li></ul>
  17. 17. Client Application COM Object Server What happens when a client wishes to create and use a COM object? 1) Create Object 2) Locate Implementation 4) Call interface members 3) Get object interface pointer return to client
  18. 18. <ul><li>When an application uses a COM object: </li></ul>2) calls CoCreateInstance (exported by COMPOBJ.DLL) passing the CLSID of the used object; CoCreateInstance :  uses the registry to discover which server implements the desidered class  asks the server to create an instance  receives from the server a pointer to the IUnknown interface 1) initializes the system : CoInitialize 3) uses IUnknown.QueryInterface to access the wanted interface 4) uses Addref and Release to manage the object lifecycle 5) in the end calls CoUninitialize
  19. 19. COM Technologies <ul><li>Interfaces and API functions that expose operating system services , as well as other mechanisms necessary for a distributed environment : </li></ul><ul><li>Type Information </li></ul><ul><li>Structured Storage and Persistence </li></ul><ul><li>Monikers </li></ul><ul><li>Uniform Data Transfer </li></ul><ul><li>Connectable Objects </li></ul>
  20. 20. Example : AMF Bowling Center System 1/6 <ul><li>In 1998 AMF Bowling rearchitected their international bowling center operations software using ActiveX controls and COM components. </li></ul><ul><li>We’ll see : </li></ul><ul><li>the container supporting the AMF BOSS System, version 1.0 </li></ul>
  21. 21. Example : AMF Bowling Center System 2/6 The AMF container
  22. 22. Example : AMF Bowling Center System 3/6 <ul><li>Building blocks : </li></ul><ul><ul><ul><li>Microsoft ActiveX controls </li></ul></ul></ul><ul><ul><ul><li>implement user interface for each primary </li></ul></ul></ul><ul><ul><ul><li>functional area </li></ul></ul></ul><ul><ul><ul><li>Component Object Model objects </li></ul></ul></ul><ul><ul><ul><li> used by the controls to perform processing </li></ul></ul></ul>
  23. 23. Example : AMF Bowling Center System 4/6 <ul><li>The container : </li></ul><ul><li>needs to know enough about any ActiveX control </li></ul><ul><li>offers its services via interfaces </li></ul><ul><li>communicates with each control by using an agreed upon COM interface </li></ul><ul><li>manages all ActiveX controls and their relationships </li></ul><ul><li>supports add-in COM objects </li></ul>
  24. 24. Example : AMF Bowling Center System 5/6 <ul><li>Architectural requirements : </li></ul><ul><ul><ul><li>ability for customers to upgrade their system </li></ul></ul></ul><ul><ul><ul><li>isolated development of new modules </li></ul></ul></ul><ul><li>Solution : </li></ul><ul><ul><li>COM deployed in a traditional client/server environment </li></ul></ul>
  25. 25. Example : AMF Bowling Center System 6/6 CContainer CCentralManageDlgbars CCentralManageActiveXControls CDynDlgbar Creates/Destroys Handles Messages for Creates/Destroys uses IManageDlgbars IManageActiveXControls uses Creates/Destroys uses Manages
  26. 26. Introducing DCOM DCOM (1995) is a seamless evolution of COM  you can take advantage of your existing investment in COM-based applications, components, tools and knowledge An extension to COM that allows network-based component interaction COM : processes can run on the same machine but in different address spaces DCOM extension : allows processes to be spread across a network
  27. 27. DCOM Architecture DCOM sits right in the middle of the components fo your application; it provides the invisible glue that ties things together. Component COM Object Component Security Provider DCE RPC Protocol Stack Security Provider DCE RPC Protocol Stack DCOM network- protocol COM Object
  28. 28. Location Independence <ul><li>Conflicting design constraints… </li></ul>… with DCOM are easy to work around, because the details of deployment are not specified in the source code : DCOM completely hides the location of a component <ul><li>in practice, however, applications need to consider the two primary constraints of a network connection: </li></ul><ul><li>bandwidth </li></ul><ul><li>latency </li></ul> preferred transport protocol : UDP
  29. 29. Connection Management <ul><li>DCOM : </li></ul><ul><li>manages connections to components that are dedicated to a single client, as well as components that are shared by multiple clients, by mantaining a reference count on each component </li></ul><ul><li>uses an efficient pinging protocol to detect if clients are still active </li></ul><ul><li>takes advantage of Windows NT support for multiprocessing for enhancing applications’ scalability </li></ul>
  30. 30. Security by Configuration <ul><li>DCOM obtains user name </li></ul>2) Authenticate user 3) Is user in the list? 4) Fail or allow call
  31. 31. Security on the Internet <ul><li>DCOM uses the security framework provided by Windows NT , this supports multiple security providers including : </li></ul><ul><li>Windows NT NTLM authentication protocol </li></ul><ul><li>the Kerberos Version 5 authentication protocol </li></ul><ul><li>distributed password authentication </li></ul><ul><li>secure channel security services </li></ul><ul><li>a DCE-compliant security provider </li></ul>
  32. 32. Weaknesses of COM/DCOM <ul><li>COM/DCOM is hard to use </li></ul><ul><li>COM is not robust enough for enterprise deployments </li></ul> Microsoft is walking to turn COM and the MTS into one programming model that will simplify the lives of developers building distributed, enterprise-wide COM applications <ul><li>COM/DCOM are best supported on Windows 95 and NT platforms </li></ul><ul><li>low cost development tools provide the ability to build and access COM components for Windows platforms, for other platforms the prices are considerably more expensive </li></ul>
  33. 33. Comparison of DCOM, CORBA, RMI Their main goal : to provide an infrastructure to enable writing distributed applications with relative ease , although they do so in different ways Java RMI comes from JavaSoft CORBA is a specification resulting from OMG DCOM comes from Microsoft
  34. 34. Java RMI <ul><li>Very easy to use </li></ul><ul><li>Remoteable interfaces have a special exception </li></ul><ul><li>Supports object-by-value </li></ul><ul><li>Versioning is built into serialization </li></ul><ul><li>Callbacks are blocked in synchronized methods </li></ul><ul><li>Not always intuitive </li></ul><ul><li>Not available to other languages </li></ul><ul><li>There are limited development tools </li></ul><ul><li>Performance can be slow as you scale </li></ul>
  35. 35. CORBA 1/2 <ul><li>Architecture for system composition </li></ul><ul><li>Has a standard terminology for concepts </li></ul><ul><li>Declarative interfaces separate the interface from the implementation </li></ul><ul><li>Provides mappings from IDL to C, C++, SmallTalk and Java </li></ul><ul><li>Supports : </li></ul><ul><ul><ul><li>evolvable and marshallable data </li></ul></ul></ul><ul><ul><ul><li>design portability </li></ul></ul></ul><ul><ul><ul><li>standard interoperability protocols </li></ul></ul></ul><ul><li>Scalable for large systems </li></ul>
  36. 36. CORBA 2/2 <ul><li>No inheritance for Exceptions </li></ul><ul><li>Objects cannot support two versions of the same interface </li></ul><ul><li>IDL is not internationalized </li></ul><ul><li>Divergent security mechanisms (Kerberos, SSL) </li></ul><ul><li>Few advanced services </li></ul><ul><li>C++ mapping has complicated memory management rules </li></ul><ul><li>Limited developer tools (usually just an IDL compiler) </li></ul><ul><li>Limited concurrency model </li></ul>
  37. 37. DCOM <ul><li>Lots of tools, books and developers </li></ul><ul><li>Separates interface from implementation </li></ul><ul><li>Good integration of automation objects with VisualBasic and Java </li></ul><ul><li>Good set of compound document interfaces </li></ul><ul><li>Microsoft depends on it working </li></ul><ul><li>Minimal support on non-Microsoft platforms </li></ul><ul><li>Hard to keep registry consistent </li></ul><ul><li>Reference counting is a problem </li></ul><ul><li>Client has to choose the interaction model </li></ul>
  38. 38. So, What Shall I Use? 1/2 <ul><li>Requirement : no recompilation moving applications to various platforms </li></ul> the Java/CORBA solution may be more appropriate then COM <ul><li>Requirement : interaction with DCOM objects </li></ul> pure DCOM solution
  39. 39. So, What Shall I Use? 2/2 <ul><li>Requirement : distributed application written entirely in Java </li></ul> RMI for its ease of programming <ul><li>Requirement : plug-in components created by third parties </li></ul> components may be based around a DCOM or CORBA interface
  40. 40. References 1/2 <ul><li>http://www.microsoft.com/ </li></ul><ul><ul><li>Main source : terminology, technical documentation, example from official Microsoft site </li></ul></ul><ul><li>www. sei.cmu.edu/str/descriptions/com_body.html </li></ul><ul><ul><li>The Software Engineering Institute (SEI) is a federally funded research and development center sponsored by the U.S. Department of Defense. I found some interesting documentation in their Software Technology Review </li></ul></ul><ul><li>www2.umassd.edu/coursepages/SoftwareArchitecture/paul-com/ </li></ul><ul><ul><li>University of Massachussets, lessons of the module of Software Architecture about COM. </li></ul></ul>
  41. 41. References 2/2 <ul><li>http://www.whatis.techtarget.com/ </li></ul><ul><ul><li>An IT company which offers targeted industry-specific search engines that deliver access to relevant information on the Web. I found here useful explanation about DDE, OLE, MTS, ActiveX. </li></ul></ul><ul><li>http://www.webopedia.com/ </li></ul><ul><ul><li>Online dictionary and search engine for computer and Internet technology. </li></ul></ul><ul><li>Introduzione a COM – seminario di E. Lodolo </li></ul><ul><ul><li>From a lesson at University of Genoa : introduction about COM and Windows fundamentals </li></ul></ul>
  42. 42. THE END T H E E N D
  43. 43. Clipboard <ul><li>The simplest mechanism available to exchange data between applications running in hte Windows environment </li></ul><ul><li>A section of computer memory that temporarily stores data especially to facilitate its movement or duplication </li></ul><ul><ul><ul><ul><ul><li>back </li></ul></ul></ul></ul></ul>
  44. 44. DDE : Dynamic Data Exchange <ul><li>An asynchronous message-based communication protocol </li></ul><ul><li>An interprocess communication (IPC) system built into the Macintosh, Windows, and OS/2 operating systems </li></ul><ul><li>Enables two running applications to share the same data </li></ul><ul><li>Example : DDE makes it possible to insert a spreadsheet chart into a document created with a word processor. Whenever the spreadsheet data changes, the chart in the document changes accordingly. </li></ul><ul><li>Still used by many applications </li></ul><ul><li>Supplanted by OLE </li></ul><ul><li> provides greater control over shared data. back </li></ul>
  45. 45. OLE : Object Linking & Embedding <ul><ul><li>A compound document standard developed by Microsoft Corporation </li></ul></ul><ul><ul><li>Enables you to create objects with one application and then link or embed them in a second application. Embedded objects retain their original format and links to the application that created them. </li></ul></ul><ul><li>back </li></ul>
  46. 46. DLL : Dynamic Link Library <ul><li>Two kinds of executables in Windows: </li></ul><ul><li>EXE </li></ul><ul><li>DLL </li></ul>Functions exported from a DLL are linked at runtime, not during compilation. <ul><li>We have two linking modalities for a DLL: </li></ul><ul><li>static link : when application is loaded </li></ul><ul><li>dynamic link : at any time by API’s LoadLibrary, GetProcAddress, FreeLibrary </li></ul>Advantages : modularity, code sharing,substitutability. back
  47. 47. <ul><li>Virtual methods can be redefined in derived classes. </li></ul><ul><li>Virtual methods calls are solved at execution time (late binding)  indirect jump  (small) overhead </li></ul>VMT : Virtual Method Table 1/2 In compiled object languages virtual methods are implemented by VMT : a function pointer table <ul><li>one VMT for each class </li></ul><ul><li>instance : data structure holding an object state </li></ul><ul><li> its first field is a pointer to the VMT of the class to which the object owns </li></ul><ul><li>all instances of the same class point to the same VMT </li></ul>
  48. 48. VMT : Virtual Method Table 2/2 I1 : C1 Pointer to VMT Attribute 1 Attribute 2 Attribute 3 …………………… I2 : C1 Pointer to VMT Attribute 1 Attribute 2 Attribute 3 …………………… Pointer to function 1 Pointer to function 2 Pointer to function 3 Pointer to function 4 VMT of class C1 implementations back
  49. 49. MTS : Microsoft transaction Server 1/2 <ul><li>A container for in-process server side components . </li></ul>A component-based programming model . An MTS component is a type of COM component that executes in the MTS run-time environment. <ul><li>Allows you to define and use transactions within COM objects </li></ul>What does it do? <ul><li>Enforces modelling based on components – just as COM </li></ul>
  50. 50. <ul><li>Uses roles and packages </li></ul><ul><li>Uses Just In TIME (JIT) Activation </li></ul><ul><li>Run-time divided into three parts : </li></ul><ul><li>Surrogate Process (MTS.EXE) </li></ul><ul><li>Microsoft Distributed </li></ul><ul><li>Transaction </li></ul><ul><li>Coordinator (MS DCT) </li></ul><ul><li>MTS Explorer </li></ul>back <ul><li>Handles communication between components through DCOM and HTTP protocols </li></ul>MTS : Microsoft transaction Server 2/2
  51. 51. ActiveX 1/2 <ul><li>Technology developed by Microsoft for sharing information among different applications </li></ul><ul><li>Outgrowth of OLE and COM </li></ul><ul><li> supports new features that enable it to take advantage of the Internet </li></ul><ul><li>Not a programming language but a set of rules for how applications should share information </li></ul>
  52. 52. ActiveX 2/2 <ul><li>ActiveX control </li></ul><ul><ul><ul><li>similar to Java applet but : </li></ul></ul></ul><ul><ul><ul><ul><li>full access to the Windows operating system </li></ul></ul></ul></ul><ul><ul><ul><ul><li>limitated to Windows environments </li></ul></ul></ul></ul><ul><ul><ul><li>can be developed in a variety of languages </li></ul></ul></ul><ul><li>back </li></ul>

×