Component technology

6


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


slide: Component technology

subsections:


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

slide: Definitions

A software component is a unit of composition with contractually specified interfaces and explicit context dependencies only. A software component can be deployed independently and is subject to composition by third parties.


Components: myths and reality

if semantical issues can be resolved

development becomes more complex

it affects performance significantly

wrong, it is an evolution from OO and C/S

unknown source


slide: Components: myths and reality

subsections:


Object-enabling technology

OLE


  • document centered -- text, graphics, reports
  • component software -- standard programmatic interface
  • distributed object systems -- component object model
  • (D)COM


Features

  • linking, embedding, storage

Alternatives

  • IBM SOM/DSOM, Apple OpenDoc

slide: Object-enabling technology -- OLE


Standardization -- system integration

OMG


  • information sharing -- technology, policy

Object Management Architecture -- interface standards

IDL


  • Object Services
  • Object Request Broker
  • Common Facilities -- file manipulation, print queuing, email
  • Application Objects -- spreadsheets, word processor

slide: The OMG standardization effort


Object Services

Future


slide: The OMG Object Services


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,...)

slide: The ODMG-93 standardization efforts


Design principles

object model


Language binding

C++ODL/OML



slide: Language binding -- C++ ODL/OML


C++ODL/OML binding -- future

Modifications to C++

Standardization efforts -- de facto market share


slide: Future standardization efforts


Perspectives


slide: Perspectives



slide: Object model


Extending a framework with CORBA


slide: Extending a framework with CORBA



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

slide: handler



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

slide: event



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

slide: kit



  interface widget : handler { 
widget
string path(); void eval( in string cmd ); void configure( in string options ); void pack( in string options ); };

slide: widget



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

slide: item



  interface iterator { 
iterator
Object next(); };

slide: iterator



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

slide: container



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

slide: factory



  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); };

slide: dot



  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); }; 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); }; };

slide: module widgets


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;
      }
  
  
      while (1) {
  	char text = readtext(); // from stdin
  	
  	banner->text( text );  // display text
  	tk->eval(text);
          }
  

slide: A tk client


tk server">

server



  class application : public session {
  public:
  application(int argc, char* argv[]) : session(argc,argv,"hello") {
  }
  void corba();
  int 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;
      }
  };
  

slide: The



  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;
     }
  

slide: A tk application


client



      try {
  
          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;
  	}
  

slide: Evaluating logical queries



  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()(); } 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; } 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; };

slide: A (remote) canvas client



  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; };

slide: A canvas server


server



      list* rlist =  new list;
      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(rlist);
      list::declare("items",rx); // store server
  
      iter* riter = rlist->walk();
      iter::declare("riter",riter);
  

slide: Moving items


Objects versus components

1



slide: Section 6.1: Objects versus components


Standards for interoperability

2



slide: Section 6.2: Standards for interoperability


The Java platform

3



slide: Section 6.3: The Java platform


An Internet-based workgroup application

4



slide: Section 6.4: An Internet-based workgroup application


hush with CORBA">

Crush -- extending hush with CORBA

5



slide: Section 6.5: Crush -- extending


  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?

slide: Questions

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 . For information on (D)COM, look at www.microsoft.com/com . Learning how to program CORBA applications is probably best learned from the manuals that come with your CORBA distribution. For an evaluation of object store management and naming schemes see  [Persistent].