The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of...
-
Upload
solomon-hampton -
Category
Documents
-
view
219 -
download
3
Transcript of The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of...
![Page 1: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/1.jpg)
The Joys of Working with Distributed Component Systems
Prof. Rushikesh K JoshiDepartment of Computer Science and
Engineering
Indian Institute of Technology, Bombay
![Page 2: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/2.jpg)
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
![Page 3: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/3.jpg)
`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
![Page 4: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/4.jpg)
“The best way to explain is to do it”
Understanding by Doing
![Page 5: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/5.jpg)
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.
![Page 6: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/6.jpg)
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
![Page 7: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/7.jpg)
“And the whole party at once crowded round her, calling
out in a confused way, `Prizes! Prizes!'
Distribution Vs. Centralization
![Page 8: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/8.jpg)
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
![Page 9: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/9.jpg)
Coordinating Daemons
M1M2
M3
objects Orb daemonOrb daemon
![Page 10: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/10.jpg)
Libraries and Daemon Processes
object
object
CORBA libraries
A CORBAdaemon
CORBAlibraries
Another CORBA daemon
Another CORBA Service
A CORBA Service
![Page 11: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/11.jpg)
"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
![Page 12: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/12.jpg)
‘How I Wonder What You are At!'
Sending Messages to remote Objects, without having to
know ‘where’ they go..
![Page 13: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/13.jpg)
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”)}
![Page 14: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/14.jpg)
Designing Surrogate/Proxy Objects
ClientProg Account
deposit ()
AccountProxy
deposit ()
remoteAcc->deposit
RealAccount
deposit ()
remoteAcc
![Page 15: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/15.jpg)
The General Proxy Pattern
Client subject
operation ()
Proxy
operation()
realSubj->operation
RealSubject
operation ()
realSubj
![Page 16: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/16.jpg)
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
![Page 17: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/17.jpg)
`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
![Page 18: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/18.jpg)
‘How neatly spread his claws, And welcome little fishes inWith gently smiling jaws!’
Receiving and ‘Digesting’ Message to Objects held inside a Server
![Page 19: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/19.jpg)
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);
}
![Page 20: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/20.jpg)
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
![Page 21: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/21.jpg)
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
![Page 22: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/22.jpg)
“I know what ‘it’ means enough when I find a thing”
Designing Generic Services
![Page 23: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/23.jpg)
The basis: Generalization
A Specialization
Generalization
Yet AnotherSpecialization
Another Specialization
![Page 24: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/24.jpg)
An Example of a Generic Service
Send in
Take out
narrow
Implemented by
![Page 25: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/25.jpg)
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
![Page 26: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/26.jpg)
‘I say what I mean’ ‘I mean what I say’
Applying Contracts in Design and
Implementation
![Page 27: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/27.jpg)
Applying Contracts
• Syntactic• Behavioral (e.g. Meyer’s Design by contract)
– Preconditions– Postconditions– Invariants
• Orthogonal contracts
![Page 28: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/28.jpg)
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
![Page 29: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/29.jpg)
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
![Page 30: The Joys of Working with Distributed Component Systems Prof. Rushikesh K Joshi Department of Computer Science and Engineering Indian Institute of Technology,](https://reader036.fdocuments.net/reader036/viewer/2022062422/56649e745503460f94b74073/html5/thumbnails/30.jpg)
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