zoukankan      html  css  js  c++  java
  • (zt)OO vs. SOA

    Removing the intimacy to create services

    Ram is back from vacation has been blogging on the subject of SOA and OO.

     

    While I agree with option C in Ram’s post, some of his comments took me back to the PDC talk where Don was explaining the difference between a service and an object.  One of his observations that resonated with me was that ‘services help remove the intimacy’ from distributed computing.  For those who didn’t see the talk, here’s my extended and modified analogy from this:

     

    Imagine two entities, A and B.  A wants to borrow $5 from B in good faith.  A plans to return the money to B by the end of the day.

     

    If these two entities were objects, the interaction may look like this: 

     

    A walks up to B, goes into B’s pocket, promptly removes his wallet and the $5.  After he has the money, A leaves.  B is left wondering ‘Hey, what happened?  I was robbed!’  B doesn’t know if and when he’ll see his money again.

     

    In this case, the interaction between A and B in the object world is very intimate.  B can of course use security to prevent A taking the money, but in general there is little to do to remove the intimacy of the interaction.  

     

    To think like a service, you have to remove this intimacy.  One of the easiest ways to do this is to think about how a similar interaction would take place in the real world.  Going up to another person and trying to forcibly remove cash from their wallet in this way is likely to end you up in some trouble.  Instead, the interaction in the real world (and the model that we can adopt for a more service based approach) looks like this:

     

    Again, A wants to borrow $5 from B in good faith. 

     

    A walks up to B and asks ‘Hey, can I borrow $5?  I forgot my ATM card and need to buy lunch’.

     

    B wants some reassurance about A.  B takes a quick look at A.  Assuming no breakthroughs in human cloning, B decides he can trust A as he has had previous interactions, and A still looks and sounds the same.   Despite this, B wants some validation that his money is going to be returned.

     

    ‘When will I get my money back?’ B enquires.

     

    ‘I’ll have it back to you by the end of the day, plus an extra $1 for your trouble’.                                        

     

    B accepts the proposal, opens his wallet and gives A the $5.  The interaction is concluded and A walks away happy.

     

    Although a simple analogy, I’ve found that removing the intimacy and thinking about how the interaction could occur in the real world can really help when defining services – and more importantly the types of interfaces that services expose.  Even if the technology promotes a service orientated approach, it’s this type of shift in thinking that helps define true services as opposed to merely exposing objects.

     

     

    Published Thursday, January 29, 2004 11:48 PM by smguest
    Done is better than perfect.
  • 相关阅读:
    css之隐藏内容的方法
    字符串对象的各种方法
    javascript之自增自减典型运算(易错)
    Fuel 30 分钟快速安装OpenStack
    使用Sublime Text 3做Python开发
    Ubuntu 14.04.02 安装openvswitch-2.3.1
    linux 技巧:使用 screen 管理你的远程会话
    MQTT的学习研究(十七)Mosquitto简要教程(安装&使用)
    MQTT的学习研究(十六) MQTT的Mosquitto的window安装部署
    MQTT的学习研究(十五) MQTT 和android整合文章
  • 原文地址:https://www.cnblogs.com/zhaorui/p/931607.html
Copyright © 2011-2022 走看看