The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of...
-
Upload
solomon-hampton -
Category
Documents
-
view
218 -
download
3
Transcript of The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of...
The Joys of Working with Distributed Component Systems
Prof. Rushikesh K JoshiDepartment of Computer Science and
Engineering
Indian Institute of Technology, Bombay
What are we discussing today?
• Some facets of system design in the domain of component systems
• Our approach will be through scattered examples from standards to services to implementation of standards
• The link between them is that they form a part of the issues which are addressed by component systems in various layers
`What IS a Caucus-race?' said Alice; not that she wanted much to know, but the Dodo had paused as if it thought that SOMEBODY ought to speak, and no one else seemed inclined to say anything.
`Why,' said the Dodo, `the best way to explain it is to do it.' (And, as you might like to try the thing yourself, some winter day, I will tell you how the Dodo managed it.)
From Alice’s Adventures in Wonderland
“The best way to explain is to do it”
Understanding by Doing
Refining our Understanding of a System
• Understanding and Implementations at user level are not enough to truly appreciate the architecture that makes it possible to express and execute high level ideas
• Try implementing small bits and fractional pieces of the system that you want to understand
• When I showed this slide to a student, he asked me whether it has something to do with prototyping. I am not talking of prototyping of your applications, it’s about understanding some design aspects of lower layers which form the basis of expression and execution of your applications.
But who is to give the prizes?' quite a chorus of voices asked.
`Why, SHE, of course,' said the Dodo, pointing to Alice with one finger; and the whole party at once crowded round her, calling out in a confused way, `Prizes! Prizes!'
Alice had no idea what to do, and in despair she put her hand in her pocket
From Alice’s Adventures in Wonderland
“And the whole party at once crowded round her, calling
out in a confused way, `Prizes! Prizes!'
Distribution Vs. Centralization
Realizing a Framework for a Distributed Component System
• Components
• Component Framework Bus: A set of protocols
• How to implement them?
• Single vs. Coordinating Distributed Servers
• Load sharing and Fault tolerance
Coordinating Daemons
M1M2
M3
objects Orb daemonOrb daemon
Libraries and Daemon Processes
object
object
CORBA libraries
A CORBAdaemon
CORBAlibraries
Another CORBA daemon
Another CORBA Service
A CORBA Service
"Twinkle, twinkle, little bat! How I wonder what you're at!"
You know the song, perhaps?' `I've heard something like it,' said Alice. `It goes on, you know,' the Hatter continued, `in this way:--
"Up above the world you fly, Like a tea-tray in the sky. Twinkle, twinkle--"‘
From Alice’s Adventures in Wonderland
‘How I Wonder What You are At!'
Sending Messages to remote Objects, without having to
know ‘where’ they go..
ClientObserve the Location Transparency
// This is a client// ...main () {Library * iitb_lib ;
//...iitb_lib = Library :: bind (“IITB_LIB”);
Book b = iitb_lib->list_a_book (“OOP”)}
Designing Surrogate/Proxy Objects
ClientProg Account
deposit ()
AccountProxy
deposit ()
remoteAcc->deposit
RealAccount
deposit ()
remoteAcc
The General Proxy Pattern
Client subject
operation ()
Proxy
operation()
realSubj->operation
RealSubject
operation ()
realSubj
Design Aspects to Note about the Proxy
• Both real and proxy objects confirm to an abstract superclass
• Thus, they both implement the same interface• However, their implementations are different• A client can handle a remote object through the
proxy as if it’s available locally.• Internally, the proxy object carries out the
communication with the remote object • An IDL compiler generates the require proxy code
and helper functions
`How doth the little crocodile
Improve his shining tail,
And pour the waters of the Nile
On every golden scale!
`How cheerfully he seems to grin,
How neatly spread his claws,
And welcome little fishes in
With gently smiling jaws!‘
From Alice’s Adventures in Wonderland
‘How neatly spread his claws, And welcome little fishes inWith gently smiling jaws!’
Receiving and ‘Digesting’ Message to Objects held inside a Server
An Example Server
//….Class Library_Skeleton { ….}; // generated for you
Class Library_Impl : public Library_Skeleton {…};main ( ){Library *lib ;
lib = new Library;
orb->object_is_ready (lib);orb->implementation_is_ready (lib);
}
Designing a service loop and dispatcher
Service loop:While true
receiveAMessagePacketidentify the object
dispatch the messagePacket to the objectreturn the returned result
And In the object:decode the packetcall local methodreturn results
Found WHAT?' said the Duck.
`Found IT,' the Mouse replied rather crossly: `of course you know what "it" means.'
`I know what "it" means well enough, when I find a thing,' said the Duck: `it's generally a frog or a worm. The question is, what did the archbishop find?'
From Alice’s Adventures in Wonderland
“I know what ‘it’ means enough when I find a thing”
Designing Generic Services
The basis: Generalization
A Specialization
Generalization
Yet AnotherSpecialization
Another Specialization
An Example of a Generic Service
Send in
Take out
narrow
Implemented by
Then you should say what you mean,' the March Hare went on. `I do,' Alice hastily replied; `at least--at least I mean what I
say--that's the same thing, you know.' `Not the same thing a bit!' said the Hatter. `You might just as
well say that "I see what I eat" is the same thing as "I eat what I see"!'
`You might just as well say,' added the March Hare, `that "I like what I get" is the same thing as "I get what I like"!'
`You might just as well say,' added the Dormouse, who seemed to be talking in his sleep, `that "I breathe when I sleep" is the same thing as "I sleep when I breathe"!'
`It IS the same thing with you,' said the Hatter, and here the conversation dropped, and the party sat silent for a minute
From Alice’s Adventures in Wonderland
‘I say what I mean’ ‘I mean what I say’
Applying Contracts in Design and
Implementation
Applying Contracts
• Syntactic• Behavioral (e.g. Meyer’s Design by contract)
– Preconditions– Postconditions– Invariants
• Orthogonal contracts
Syntactic Contracts
• Interfaces– JAVA interfaces
– C++ Pure Abstract Classes
– CORBA IDLs
– COM interfaces which are closed for modification
• Typically captures set of messages in terms of member function names, parameters, their types and their directions, blocking/non-blocking type
Mayer’s Design by Contract TM
• Preconditions to be ensured by client
• Postcondition to be satisfied by supplier
• What are the benefits?
• Class invariants
• An Example in Eiffel
Further Readings
• OMG’s CORBA standard • Programmer’s manual for MICO• Eric Gamma et al.’s book on Design Patterns• Design Patterns in CORBA, try to inspect the code
generated by IDL compiler• OMG’s CORBA Naming Service Specification • Bertrand Mayer’s book on Object Oriented Software
Construction• And of course..Lewis Carroll’s Alice’s Adventures in
Wonderland