52
Principles of Object- Oriented Software Development Component Technology

Principles of Object-Oriented Software Development Component Technology

  • View
    231

  • Download
    5

Embed Size (px)

Citation preview

Page 1: Principles of Object-Oriented Software Development Component Technology

Principles of Object-Oriented Software Development

Component Technology

Page 2: Principles of Object-Oriented Software Development Component Technology

Component Technology

Introduction

Objects versus components Standards for interoperability The Java Platform A simple workgroup application Crush -- extending hush with CORBA

Summary Q/A Literature

Page 3: Principles of Object-Oriented Software Development Component Technology

Component Technology

• objects versus components -- definitions

• interoperability

• requirements for distribution

• a simple workgroup application

• extending hush with CORBA

Additional keywords and phrases:(D)COM, Java, CORBA, OLE, persistent objects, ODMG,workgroup

Page 4: Principles of Object-Oriented Software Development Component Technology

Objects versus components

Subsections:

Definitions The technology matrix Component myths

Page 5: Principles of Object-Oriented Software Development Component Technology

Definitions

Component substitutability

unit of independent deployment unit of third party composition no persistent state

Object identity

unit of instantiation (persistent) state encapsulation of state and behavior

Page 6: Principles of Object-Oriented Software Development Component Technology

A software component is a unit ofcomposition with contractuallyspecified interfaces and explicitcontext dependencies only. Asoftware component can bedeployed independently and issubject to composition by thirdparties.

Szyperski

Page 7: Principles of Object-Oriented Software Development Component Technology

The technology matrix

distribution mobility language platform reflection COM - - * - +/- DCOM + - * +/- +/- CORBA + - * * +/- Java/Beans - classes Java * + Java/RMI + classes Java * + Voyager + objects Java * +

Page 8: Principles of Object-Oriented Software Development Component Technology

Components: Myths and Reality

component-ware allows for combining components if semantical issues can be resolved

component-ware simplifies software distribution and maintenance development becomes more complex

component-ware support mega applications it affects performance significantly

component-ware is a revolution wrong, it is an evolution from OO and C/S

unknown source

Page 9: Principles of Object-Oriented Software Development Component Technology

Component Questions

• How to describe the interaction between components?

• How to manage variety and flexibility?

• How to guarantee critical system-wide properties?

Page 10: Principles of Object-Oriented Software Development Component Technology

Standards for interoperability

Subsections:

Microsoft COM OMG CORBA ODMG persistency

Page 11: Principles of Object-Oriented Software Development Component Technology

Object linking and embedding

COM

Page 12: Principles of Object-Oriented Software Development Component Technology

Object-enabling technology

• document centered -- text, graphics, reports

• component software -- standard programmatic interface

• distributed object systems -- component object model

OLE

(D)COM

Features linking, embedding, storage

Alternatives IBM SOM/DSOM, Apple OpenDoc

Page 13: Principles of Object-Oriented Software Development Component Technology

Object Request Brokers

CORBA

Page 14: Principles of Object-Oriented Software Development Component Technology

Standardization -- system integration OMG information sharing -- technology, policy

Object Management Architecture -- interface standards IDL

Object Services Object Request Broker CORBA

Common Facilities -- file manipulation, print queuing, email Application Objects -- spreadsheets, word processor

The OMG standardization effort

Page 15: Principles of Object-Oriented Software Development Component Technology

Object Services

• life cycle -- creation and deletion

• persistence -- management of object storage

• naming -- mapping names to references

• event notification -- registration of events

Future

transactions, concurrency, relationships,...,time

Page 16: Principles of Object-Oriented Software Development Component Technology

Persistent objects

ODMG

Page 17: Principles of Object-Oriented Software Development Component Technology

Persistent objects ODMG database extension -- unified type system

Object Definition Language ODL standard types -- objects and literals references -- Ref< T > collections -- List< T > , Bag< T >, Set< T >

Object Manipulation Language OML create, delete, modify, reference

Object Query Language OQL oql(type& value, const char* query,...)

The ODMG-93 standardization efforts

Page 18: Principles of Object-Oriented Software Development Component Technology

Design principles object model

the programmer feels that there is one language

Language binding C++ODL/OML objects and literals -- embedded objects are literals relationships -- not directly supported by C++ extents -- must be maintained by programmer keys -- simulated by C++ data members

Language binding -- C++ ODL/OML

Page 19: Principles of Object-Oriented Software Development Component Technology

C++ODL/OML binding -- future

no distinction between persistent and transient objects better integration of the query sublanguage

Modifications to C++

overloading dot (access operator), r/l values, ...

Standardization efforts -- de facto market share

PDES/STEP, ODA, PCTE, OSI/NMF, ISO ODP, ANSI X3

Future standardization efforts

Page 20: Principles of Object-Oriented Software Development Component Technology

The Java Platform

technology innovation

Page 21: Principles of Object-Oriented Software Development Component Technology

Perspectives

• Internet Applications -- the dial-tone of the Internet

• Software Engineering -- long-term maintenance

• Language Design -- semantic compromises

• System Development -- light weight clients, heavy weight servers

• Computer Science -- towards declarative, verifiable technology

• IT (in) Business -- standards for business objects and processes

• Global Village -- virtual world technology

Page 22: Principles of Object-Oriented Software Development Component Technology

An Internet-based Workgroup Applications

Page 23: Principles of Object-Oriented Software Development Component Technology

Object Model

Page 24: Principles of Object-Oriented Software Development Component Technology

Crush

extending hush with CORBA

Page 25: Principles of Object-Oriented Software Development Component Technology

Extending a frameworkwith CORBA

• the legacy problem -- granularity of wrappers

• object creation and access -- factories and tables

• client-side adaptors -- to fit within native type system

• events versus objects -- natural interfaces

Page 26: Principles of Object-Oriented Software Development Component Technology

Interfaces

Page 27: Principles of Object-Oriented Software Development Component Technology

The hush module

interface handler { handler event dispatch( in event data ); };

interface event : handler { event attribute long type; attribute long x; attribute long y; };

Page 28: Principles of Object-Oriented Software Development Component Technology

interface kit : handler { kit void source(in string file); void eval(in string command); string result(); widget root(); };

Page 29: Principles of Object-Oriented Software Development Component Technology

interface item : handler { item void move( in long x, in long y ); };

interface widget : handler { widget

string path(); void eval( in string cmd ); void configure( in string options ); void pack( in string options ); };

Page 30: Principles of Object-Oriented Software Development Component Technology

interface iterator { iterator

Object next(); };

interface container { container

long length(); Object first(); Object next(); Object current(); iterator walk(); };

Page 31: Principles of Object-Oriented Software Development Component Technology

interface factory { factory

hush::kit kit(in string name); hush::event event(in long type); };

interface dot { dot

hush::kit kit(in string name); hush::container container(in string name); hush::iterator iterator(in string name); hush::factory hush(in string name); };

Page 32: Principles of Object-Oriented Software Development Component Technology

The widgets module module widgets { interface canvas : hush::widget { canvas

canvas create( in hush::widget anc, in string path ); hush::item circle( in long x, in long y, in long radius, in string options ); // other items ... };

interface message : hush::widget { message

message create( in hush::widget anc, in string path ); void text(in string txt); };

Page 33: Principles of Object-Oriented Software Development Component Technology

interface factory : hush::factory { factory

widgets::canvas canvas(in string name, in string options); widgets::message message(in string name, in string options); };

interface dot : hush::dot { dot

widgets::canvas canvas(in string name); widgets::message message(in string name); widgets::factory widgets(in string name); }; };

Page 34: Principles of Object-Oriented Software Development Component Technology

Examples

Page 35: Principles of Object-Oriented Software Development Component Technology

A remote interpreter kit client hush::dot* hush; // (distributed) object tables widgets::dot* widgets; // widgets contains hush hush::kit* tk; // remote kit object widgets::message* banner; try { hush = widgets = widgets::dot::_bind (SERVER, argv[1]); tk = hush->kit("tk"); banner = widgets->message("hello"); // must exist } catch (...) { cerr << "Unexpected exception ..." << endl; return -1; }

Page 36: Principles of Object-Oriented Software Development Component Technology

while (1) { client (ctnd) char text = readtext(); // from stdin banner->text( text ); // display text tk->eval(text); }

class application : public session { server public: application(int argc, char* argv[]) : session(argc,argv,"hello") { } void corba(); int main();};

Page 37: Principles of Object-Oriented Software Development Component Technology

int application::main() { tk->trace(); kit::declare("tk",tk); message* m = new hello(".hello"); m->pack(); message::declare("hello",m); corba(); // make yourself available as a server return OK; }

Page 38: Principles of Object-Oriented Software Development Component Technology

void application::corba() { widgets::dot* dw = new widgets_dot_srv(); // create dot for widgets try { CORBA::Orbix.registerIOCallback(it_orbix_fd_open, FD_OPEN_CALLBACK); CORBA::Orbix.registerIOCallback(it_orbix_fd_close, FD_CLOSE_CALLBACK); CORBA::Orbix.impl_is_ready(SERVER,0); CORBA::Orbix.processEvents(0); } catch (...) { cout << "apparently something went wrong" << endl; }}

Page 39: Principles of Object-Oriented Software Development Component Technology

Evaluating logical queries

try { client tk = hush->kit("bp"); // A kit for BinProlog tk->eval("consult(facts)"); } catch(...) { cout << "An exception ... " << endl; }while (1) { char* text = readtext(); tk->eval(text); char* q = 0; while ( (q = tk->result()) ) cout << "Result: " << q << endl; }

Page 40: Principles of Object-Oriented Software Development Component Technology

A remote canvas

class draw_clt : public canvas { draw_clt public: void plug(widgets::canvas* x) { draw = x; } int operator()() { hush::event* e = hush->event(_event->type()); cerr << "Getting event " << e->type() << endl; e->x(_event->x()+10); e->y(_event->y()+10); hush::event::_duplicate(e); // CORBA 2.0 hush::event* res = draw->dispatch(e); return canvas::operator()(); }

Page 41: Principles of Object-Oriented Software Development Component Technology

draw_clt(const widget* w, char* path ) : canvas(w,path) { configure("-background white"); geometry(200,100); self()->bind(this); dragging = 0; } draw_clt(char* path ) : canvas(path) { configure("-background white"); geometry(200,100); self()->bind(this); dragging = 0; }

Page 42: Principles of Object-Oriented Software Development Component Technology

void press( event& ) { dragging = 1; } void motion( event& e) { if (dragging) { self()->circle(e.x(),e.y(),2,"-fill black"); draw->circle(e.x(),e.y(),3,"-fill yellow"); } } void release( event& ) { dragging = 0; } protected: int dragging; widgets::canvas* draw; };

Page 43: Principles of Object-Oriented Software Development Component Technology

class draw_srv : public canvas { draw_srv public: draw_srv( const widget* w, char* path ) : canvas(w,path) { geometry(200,100); self()->bind(this); dragging = 0; } void press( event& ) { dragging = 1; } void motion( event& e) { if (dragging) circle(e.x(),e.y(),10,"-fill black"); } void release( event& ) { dragging = 0; } protected: int dragging; };

Page 44: Principles of Object-Oriented Software Development Component Technology

Moving items

server list<hush::item>* rlist = new list<hush::item>; item* it = draw->circle(40,40,10,"-fill yellow"); hush::item* rit = new item_srv(it); rlist->insert(rit); it = draw->circle(30,30,10,"-fill red"); rit = new item_srv(it); rlist->insert(rit); hush::container* rx = new list_srv<hush::item>(rlist); list<hush::item>::declare("items",rx); // store server iter<hush::item>* riter = rlist->walk(); iter<hush::item>::declare("riter",riter);

Page 45: Principles of Object-Oriented Software Development Component Technology

Summary

Page 46: Principles of Object-Oriented Software Development Component Technology

Objects versus components

• definitions -- components

• the technology matrix

• component myths -- (r)evolution

1

Page 47: Principles of Object-Oriented Software Development Component Technology

Standards for interoperability

• Microsoft COM

• OMG CORBA

• ODMG persistency

2

Page 48: Principles of Object-Oriented Software Development Component Technology

The Java Platform

• a matter of perspectives

3

Page 49: Principles of Object-Oriented Software Development Component Technology

An Internet-basedworkgroup application

• agent, workgroup, agenda, appointment

• CORBA server, Java applets

4

Page 50: Principles of Object-Oriented Software Development Component Technology

Crush -- extending hushwith CORBA

• factories -- (distributed) object tables

• server wrappers -- remote objects

• client-side adaptors -- transparant typing

5

Page 51: Principles of Object-Oriented Software Development Component Technology

Questions

1. Give a definition of the notion of components. How is this related to a definition of objects? Explain the difference between these definitions. 2. What actual component technologies can you think of? How would you compare them? 3. Describe Microsoft (D)COM, OMG CORBA, ODMG Persistent Objects. Is there any relation between these standards? 4. Discuss the Java platform. What perspectives can you think of? Discuss pros and cons! 5. Describe the architecture of an Internet-based workgroup application. What technology would you use? 6. What issues may arise in extending a given library or framework with CORBA? Can you think of any solutions?

Page 52: Principles of Object-Oriented Software Development Component Technology

Further reading

I recommend [Szyperski97], both as an introduction to component-technology, and as a reference for more advanced readers. For an introduction to CORBA, you may read [Siegel96]. A readable account of the ODMG standard is given in [Cattell94]. For more information on Java, again, visit http://www.javasoft.com . For information on (D)COM, look at http://www.microsoft.com/com . Learning how to program CORBA applications is probably best learned from the manuals that come with your CORBA distribution.