Components David Talby. 9/27/2016 Object Oriented Design Course 2 This Lecture What Components Are With Demonstrations in Visual Basic Common Object Model.

Slides:



Advertisements
Similar presentations
Overview Environment for Internet database connectivity
Advertisements

Introduction to .NET Framework
Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
COM vs. CORBA.
Intro to COM What is it and how do I use it?. Objectives Teach the fundamentals of COM. Understand the reason for using it. Learn to make a simple in-process.
Component-based Software Engineering Marcello Bonsangue LIACS – Leiden University Fall 2005 Component Model Comparison.
Components David Talby. This Lecture What Components Are With Demonstrations in Delphi Common Object Model (COM) Creating and calling objects Distributed.
Distributed Object Computing Weilie Yi Dec 4, 2001.
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
1 COM/DCOM n Part of Project Presentation (Concept Outline)
Object Based Operating Systems1 Learning Objectives Object Orientation and its benefits Controversy over object based operating systems Object based operating.
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Intro to COM What is it and what can it do for me?
DCOM Technology. What is DCOM? DCOM is just COM with a longer wire DCOM is just COM with a longer wire DCOM extends COM to support communication among.
DCOM Technology Şevket Duran Haşim Sak.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
1 Modular Software/ Component Software 2 Modular Software Code developed in modules. Modules can then be linked together to produce finished product/program.
Visual Basic: An Object Oriented Approach 12 – Creating and using ActiveX objects.
Beyond DHTML So far we have seen and used: CGI programs (using Perl ) and SSI on server side Java Script, VB Script, CSS and DOM on client side. For some.
Quality Assurance for Component- Based Software Development Cai Xia (Mphil Term1) Supervisor: Prof. Michael R. Lyu 5 May, 2000.
Meir Botner David Ben-David. Project Goal Build a messenger that allows a customer to communicate with a service provider for a fee.
Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development.
Jaeki Song ISQS6337 JAVA Lecture 16 Other Issues in Java.
Developing and Deploying Business Components using PowerJ.
COM vs. CORBA Computer Science at Azusa Pacific University September 19, 2015 Azusa Pacific University, Azusa, CA 91702, Tel: (800) Department.
Chapter 3: Objects, Components, and the Web Textbook IT Architectures and Middleware, Second Edition Chris Britton and Peter Bye AIT 600 Jeff Schmitt September.
Enterprise Java Beans Part I Kyungmin Cho 2001/04/10.
Fundamentals of Database Chapter 7 Database Technologies.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Microsoft’s Distributed Component Object Model (DCOM) Jim Ries Updated 10/5/1999 A semi-technical overview.
COM/DCOM Implementation Basics of: Object creation and access Object Reuse Interface referencing.
Distributed Component Object Model (DCOM)
Introduction to COM and DCOM Organizational Communications and Technologies Prithvi N. Rao H. John Heinz III School of Public Policy and Management Carnegie.
CS 603 DCOM April 5, DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication.
COMCOM omponent bject odel After this presentation, you will: Be Able To: Conceptual understanding of COM How it works, What it’s used for Decode Acronyms.
Information Management NTU Interprocess Communication and Middleware.
DEV-5: Introduction to WebSpeed ® Stephen Ferguson Sr. Training Program Manager.
Ni.com Understanding COM/ActiveX Jeff Paulter Staff Software Engineer Thurs Aug 17 10:15-11:30 a.m., 1:45-3:00 p.m. Ash (10A) Jeff Paulter Staff Software.
Introduction to COM and ActiveX Controls. What is an object? In the Fayad sense of the word.
Active Server Pages (ASP), also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically generated web pages.
CS 501: Software Engineering Fall 1999 Lecture 12 System Architecture III Distributed Objects.
Building High Performance, Robust Server Applications with Internet Information Server 5.0 Van Van IIS - Program Manager Microsoft Corporation.
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Tom Meyer, Iowa State SCT/Pixel Online Workshop June, 2001 CORBA Common Object Request Broker Architecture.
Building Custom Controls with ASP.NET and the Microsoft ®.NET Framework Rames Gantanant Microsoft Regional Director, Thailand
Plug-In Architecture Pattern. Problem The functionality of a system needs to be extended after the software is shipped The set of possible post-shipment.
1 Distributed Systems Architectures Distributed object architectures Reference: ©Ian Sommerville 2000 Software Engineering, 6th edition.
Jim Fawcett CSE775 - Distributed Objects Spring 2014
Component Object Model(COM)
CSE791 - Distributed Objects, Spring 2002
CSE775 - Distributed Objects, Spring 2006
Netscape Application Server
Microsoft’s Distributed Component Object Model (DCOM)
Chapter 15 Database Connectivity and Web Technologies
Out-of-Process Components
The Client/Server Database Environment
CMPE419 Mobile Application Development
Web Development Using ASP .NET
Component-Based Software Engineering: Technologies, Development Frameworks, and Quality Assurance Schemes X. Cai, M. R. Lyu, K.F. Wong, R. Ko.
Interpreter Style Examples
Component--based development
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Quality Assurance for Component-Based Software Development
Out-of-Process Components
Graduation Project #1 University Internet Student Registration System
CMPE419 Mobile Application Development
Presented By Justas Raslanas
Plug-In Architecture Pattern
CORBA and COM TIP Two practical techniques for object composition
Presentation transcript:

Components David Talby

9/27/2016 Object Oriented Design Course 2 This Lecture What Components Are With Demonstrations in Visual Basic Common Object Model (COM) Creating and calling objects Distributed COM Component-Oriented Software

9/27/2016 Object Oriented Design Course 3 Components The Holy Grail of Software Engineering Build software by connecting existing components in simple ways “Beyond Object-Oriented Software” Small-scale success, large-scale failure The three parts of industry-scale reuse A widely used object-oriented framework Developers building components for it Other developers using them to build apps

9/27/2016 Object Oriented Design Course 4 Demo Let's start the IDE...

9/27/2016 Object Oriented Design Course 5 Using Components in VB/Delphi Visual Components Visual editors, containers, dialogs Use of properties, events, methods Database Connectivity Non-visual components Delegation & Inheritance between components Office Automation Visual & Non-Visual use Whole programs as components

9/27/2016 Object Oriented Design Course 6 Writing Components in VB/Delphi Writing Components Inheritance Use of properties, events, methods 3 rd Party Components Tens of thousands of components Many are freeware or shareware and others Delphi’s Framework Based on Object Pascal Can import components from COM, CORBA, COM+, EJB, Web Services TObject TPersistent TComponent TControl TWinControl TCustomListControl TCustomCombo TCustomComboBox TComboBox

9/27/2016 Object Oriented Design Course 7 A Component’s Interface A component’s interface has: Methods - like draw() and disconnect() Properties – like color and name (wrappers to getter and setter methods) Events – like onClick and onNetworkError (pointer to function or list of such pointers) What about implementation? Completely unavailable to clients Can be one or many classes Can be in another language

9/27/2016 Object Oriented Design Course 8 Defining Components Definition: a software component is a module with these properties: It can be used by other software modules, called clients (not just humans) Only its specification (interface) is required for clients to use it The clients and their authors do not need to be known to the component’s authors

9/27/2016 Object Oriented Design Course 9 Defining Components II Usually there’s another property: It can be used within a visual designer tool To do so, it must be derived from the framework the tool supports Commercial component frameworks COM (Visual Basic, Visual C++) JavaBeans (Eclipse, NetBeans, JBuilder) Delphi (Delphi).NET (Visual Studio.NET)

9/27/2016 Object Oriented Design Course 10 Comparison of Reuse Techniques Components are less abstract than frameworks Frameworks are incomplete applications: They compile, but they don’t run Components are usually framework-specific Frameworks make components possible Frameworks are less abstract than patterns Include actual code, not just essays Specific to one programming language Specific to one application domain Many patterns came from successful FWs

9/27/2016 Object Oriented Design Course 11 COM: Common Object Model Most widely used component FW on earth Microsoft’s goals in the early 90’s Attracting developers to Windows Combining the speed and power of C++ with the ease of use of Visual Basic Versioning of Windows UI & Services OLE (Object Linking & Embedding) and Clipboard features in Office COM introduced in 1995 as OLE 2.0

9/27/2016 Object Oriented Design Course 12 A Binary Standard COM objects are used via interface pointers Use by normal methods calls COM is a binary standard for doing this: calling methods: calling convention, argument passing Common data types, marshalling Creating and destroying objects

9/27/2016 Object Oriented Design Course 13 Supporting Interfaces An object can implement many interfaces All COM objects implement IUnknown IUnknown defines QueryInterface() Cast to another interface by giving its ID Implementations can be changed dynamically IUnknown also defines AddRef() and Release() COM manages memory by reference counting

9/27/2016 Object Oriented Design Course 14 Versioning COM interfaces are logically immutable Change = New version of interface Not enforced, but required from developers For example, each Office version is backward compatible to old interfaces: “Word.Application.7”, “Word.Application.8”, … Current (last) version is “Word.Application” Windows UI is updated in the same way Buttons, Windows, Standard dialogs, …

9/27/2016 Object Oriented Design Course 15 Creating Objects Create objects using the Windows API The Registry names a “server” – EXE or DLL – which contains the implementation Object is created in server, and the “client” receives a pointer to it

9/27/2016 Object Oriented Design Course 16 Creating Objects II An interface must be uniquely identified CoCreateInstance() receives a CLSID CLSID is a 128-bit globally unique identifier PROGID is easier: “Word.Application.10” The Windows Registry \HKEY_CLASSES_ROOT\ CLSID\ {000209FF C }\ LocalServer32 = C:\Program Files\...\WINWORD.EXE Word.Application.10\ CLSID = {000209FF C }

9/27/2016 Object Oriented Design Course 17 Creating Objects III COM “Servers” EXE or DLL file, with a server entry function DLL can be in-process or out-of-process Server can inquire client & context Request cannot specify an implementation OS manages DLLs and object pools Consequences Requires operating system support A dynamic, very expensive operation Works on all versions of Windows since ‘95

9/27/2016 Object Oriented Design Course 18 Calling Methods Simplest case: In-process DLL “Client” and “Server” in same process Calls are dispatched using virtual tables Same as standard C++ (multiple inheritance) Calling convention is also same as in C/C++ Should be as efficient as virtual methods In reality slower, due to less optimization

9/27/2016 Object Oriented Design Course 19 Calling Methods II The COM object can be in a different process If it’s implemented in an EXE or out-of-process DLL Less efficient calls Shared data between clients Failure of either process won’t terminate the other

9/27/2016 Object Oriented Design Course 20 Calling Methods III The COM object can be in a different machine This is DCOM: Distributed COM Transparent: Add network location in Registry Each method call is very expensive

9/27/2016 Object Oriented Design Course 21 Language Support Any language can use COM objects And can be used for writing such objects Each language has a syntax for interfaces class in C++, interface in Delphi and Java Compiler Support Required Handle COM method calls transparently Replace creation operator by CoCreateInstance() Replace casting with QueryInterface() Call AddRef() and Release() in = operator code Wrap returned error codes with exceptions

9/27/2016 Object Oriented Design Course 22 Defining COM Interfaces Microsoft Interface Definition Language Interface names, CLSID and properties Method names, argument names and types Properties & events have a special syntax Data Types: Primitives, arrays, COM objects ‘in’ and ‘out’ parameters, and other settings MIDL Compiler Produces “Type Libraries” (*.TLB Files) Used by compilers & tools that support COM

9/27/2016 Object Oriented Design Course 23 Writing a COM Server Start a new “COM Server” project Development tool generates code for server entry, register and unregister functions Development tool generates empty IDL file Define interfaces and implement them Define interface in IDL (or visual tool) Implement in your favorite language Build the DLL or EXE Then use regsvr32.exe to register it

9/27/2016 Object Oriented Design Course 24 Calling Methods Summary

9/27/2016 Object Oriented Design Course 25 Distributed COM DCOM is COM’s extension to networks Location Transparency Language Neutrality Simple, two-way connection model Easier than a custom socket-based protocol Connection Management Shared connection pool between clients Distributed garbage collection Efficient ping: per machine, groups all remote object IDs, and piggy-backed on messages

9/27/2016 Object Oriented Design Course 26 Distributed COM II Scalability Thread pool, multi-processing Protocol Neutrality: UDP, TCP, others Flexible deployment & redeployment No server downtime during redeployment Exploits COM’s support for versioning Referral: passing remote references A directory of waiting remote chess players A load-balancing broker component DCOM automatically short-circuits middleman

9/27/2016 Object Oriented Design Course 27 Distributed COM III Security Transparent: NT’s basis & online admin tool Can also be programmatic Any NT security provider – supports encryption and many authentication protocols Distributed Components Injecting server code into the client side An infrastructure for load balancing and fault tolerance (hot failover, recovery cache) Used by MTS for distributed transactions

9/27/2016 Object Oriented Design Course 28 DCOM Design Issues Each method call is very expensive Violate command-query separation to minimize network round-trips (=method calls) Also useful for ordinary COM objects Stateless components are more scalable Transparent proxy & stub model is also useful when objects are a different: Thread Security Context Transaction Context

9/27/2016 Object Oriented Design Course 29 COM Based Technologies All ’90s MS technologies for software developers are based on COM Tied to the Windows platform Efficient, scalable, language neutral A few examples ActiveX: “applications” inside web browsers MTS and COM+: Transaction services VBA and Windows Scripting DirectX, Internet Explorer, ODBC & ADO,...

9/27/2016 Object Oriented Design Course 30 The Competition: JavaBeans The Java Component Model Component = Can be used in a visual designer A component is a Java class With a default constructor Relies heavily on reflection Property = defined by getAbc() and setAbc() Event = same as Swing’s event model With added information in java.beans.* Names, version, company, …

9/27/2016 Object Oriented Design Course 31 Summary: Back to Basics What is a component? A software module that can be used by other modules, knowing only its interface Written “inside” a framework Can usually be inserted into a visual designer Components are key to large-scale reuse Delphi, COM, JavaBeans reuse is a success Object-oriented methods alone aren’t A few leading frameworks lead the industry Write your software as components!