Welcome!

Microservices Expo Authors: Elizabeth White, Pat Romanski, Liz McMillan, Yeshim Deniz, Carmen Gonzalez

Related Topics: Microservices Expo

Microservices Expo: Article

Horses for Courses: Services, Objects, and Loose Coupling - Integration without compromise

Horses for Courses: Services, Objects, and Loose Coupling - Integration without compromise

Object-oriented technologies are used today in the design and development processes for many computer systems; it is a proven paradigm and has made possible the development of large and complex software systems. Enabling platforms and tools for building and consuming Web services will not be an exception. However, how a service is implemented using objects and the way in which it interacts with other services via message exchanges require very different approaches.

Today, most tools represent Web services to application developers as objects. Such an approach carries the danger of underperformance and fragile applications with too tight a level of coupling, which loses the benefits of service orientation. This article shows you how objects and services should be integrated to build loosely coupled, performant, and reusable services without compromising either paradigm.

Anatomy of a Web Service
To frame this discussion, we must first reach a common understanding of what exactly a Web service is. Our deliberately simple view of a service is as an entity that exchanges messages (usually with other services), with well-defined boundaries. A Web service shares those characteristics, but adds the constraint that the messages exchanged between Web services are in fact SOAP messages carried over some suitable transport protocol (which may include application protocols like HTTP).

Those messages may contain out-of-band data for quality-of-service purposes, and are produced and consumed by a piece of middleware, usually called a SOAP server, SOAP stack, or SOAP message processor. It is this middleware that performs the translation of SOAP messages into a form more suitable for processing at the application level, which it typically does by converting the SOAP XML message into application objects. This canonical Web service is shown in Figure 1, and will form the basis for later discussion on how objects and services interact. Please note that Figure 1 is only a conceptual view of a canonical Web service and there is no suggestion of a one-to-one association between a Web service and a particular host. Indeed, an entire infrastructure with computational, data, human, etc., resources could make a single Web service.

An Object-Oriented System
Before we explore the interaction between objects and services, it is useful to recall how we would implement a purely object-based system. Consider a simple purchase-order system that is used by a (potentially remote) purchase-order application, composed from a number of purchase-order objects.

In Figure 2, we see that the purchasing application holds a reference to (potentially remote) purchase order objects. Through those references, the application can obtain information about the purchase order, such as the order number, the date, the cost of the order, and the items requested.

While this approach is appealing because of its simplicity, it suffers from a number of drawbacks if we try to scale it to Internet-level computing. First, while the interface of the purchase order object is defined at the right level for a closed system (either a stand-alone application or an intranet-based distributed object environment), it is far too fine grained to use efficiently over a wide area network. The network overhead of calling a method like getPurchase OrderNo() outside of a single domain is prohibitively high.

Second, we see that the level of coupling with this approach is very high. If, for example, the purchasing application and the purchase order object physically belong in separate organizations (which is the normal case in CORBA, where object references are propagated around an application and the underlying infrastructure handles location transparency), then the organization hosting the purchase order object can legitimately delete that object but, as a consequence, breaks the other organization's purchasing application, which relied on a reference to that object. Of course, technologies for maintaining referential integrity have been devised (e.g., distributed reference counting and garbage collection, leasing, etc.), but in most cases they don't scale very well either.

Finally, and most crucially, this approach assumes that there is a type system shared by the purchasing application and the purchase order object. If two application domains are unable to share a type system, for instance if one is built on .NET and the other on J2EE, then direct invocation of objects from one domain into the other is all but precluded, which means that specialist adapters then have to be deployed to solve the problem piecemeal.

While middleware like CORBA or DCOM can hide the differences between individual language and platform technologies and allow, for example, a C++ purchasing application to invoke a Java purchase order object, it does so because it uses its own metalevel type system, and does not solve the problem of sharing types but moves it to the metalevel. It also throws up the barrier that if there is no IDL mapping to the language that a specific component is written in, then there is no way that component can be used in the application.

Don Box of Microsoft sums this up very neatly when he notes that "shared abstractions are expensive." Box convincingly argues that for a distributed object approach to have a hope of working across enterprise boundaries, all parties involved in the construction of the application have to agree on the set of shared abstractions. As the number of parties involved increases, there is a combined explosion of different systems, different people, and different corporate politics to navigate, and eventually the rewards for deploying such a system are outweighed simply by the effort required to deploy it.

An Object-like System Using SOAP and WSDL
If there are problems in scaling object-based systems, it seems an attractive idea to use technologies like SOAP and WSDL to alleviate that problem. One such common approach is shown in Figure 3.

The example shown in Figure 3 at first appears to solve the issues that we previously identified with integrating multiple enterprises' object-based systems. Certainly, it seems to solve the problem about having shared types, since now all type information is exposed via a WSDL interface that allows any software agent that understands the WSDL to invoke the object behind the service. It also means that specialist adapters can be replaced with commodity SOAP stacks in order to plumb various application components together. The ability to understand XML, XML Schema, and SOAP are the only assumptions being shared.

However, there are significant flaws in this approach. While this approach may be platform neutral because of the XML payloads that we move across the network, applications built this way may not be performant because we have exposed the same fine-grained object interface for consumption, and we still have to bear the cost of translating to and from XML whenever we want to invoke such a method.

Worse, applications built this way are brittle. For example, imagine that the purchase order object is made available at the URL http://example.com/wsj/purchaseOrder/14529 and that the client binds to that URL and begins to invoke methods (via SOAP) on the purchase order object. Given that the purchase order object is a resource that belongs to an enterprise, that enterprise is perfectly within its rights to manage that resource as it sees fit, including to move or delete it. If the URL of the purchase order object changes or disappears, this has the knock-on effect of breaking the purchasing application.

While we have schemes such as that used in OGSI, which address this brittleness by providing a mechanism to re-resolve an endpoint in case a resource is moved, this patch fails to address the fundamental problem with this approach - that an enterprise's private resources (objects) are being exposed to the network. In short, this approach is nothing more than CORBA or DCOM with angle brackets, and while CORBA and DCOM were extremely useful technologies in their specific domain, in this context such an architecture is, at best, ungainly.

Given these drawbacks, we must ask what would drive developers and architects to propose such solutions. While one motivation is the (completely inaccurate) view that Web services are a yet another distributed object system, we feel the primary reason for this model having permeated so far into the developer mindset is tool support.

For instance, the WebMethod attribute in .NET makes it easy to expose an object as a Web service, even though such objects may well have fine-grained interfaces that are wholly unsuitable for exposure as a Web service. On the client side, tools like Axis WSDL2Java present the abstraction of a Web service as an object with methods (which is ironic given that at least some of the time it, lamentably, is).

A Service-Oriented View
So far we have seen the pitfalls of mixing service and object orientation. However, both are extremely valuable techniques and in order to derive maximum benefit from them we simply need to understand where it is best to utilize each, and how the object-service interface should look. To put things into perspective, let's revisit the purchase order system from a service-oriented architecture point of view.

The diagram shown in Figure 4 fixes all of the problems we encountered in examining previous approaches. There is much looser coupling in this system since no back-end resources are exposed across administrative boundaries. Instead, a (logically, though not necessarily physically) single, fixed endpoint is used as the entry point to a process that deals with the creation of a purchase order. When that process is invoked, some business-specific activity is executed and a purchase order document is passed back to the purchasing application. The purchase order service interface is now much more coarse grained as it captures an entire business process rather than individual method calls, and is likely to be performant and scalable.

However, this is only half the story as far as we are concerned. While this architecture is the correct choice for this application, we still need to see how it can be mapped into code in the service implementation. Figure 5 presents the details of the implementation of the purchasing order service and shows in greater detail how a service could be implemented using objects without actually exposing them.

The fundamental issue shown in Figure 5 is that it is the messages exchanged with Web services that should be consumed by applications, and not the Web services themselves. Where Web services are seen as application-level objects, there is the constant danger we'll fall into the trap of treating them as objects.

However, with this approach we use fewer but richer message exchanges, we increase the granularity of a Web service, and reduce the performance penalty. This strategy also ensures that loose coupling is the norm since applications never bind directly to services, only to messages. Since those messages can come from any source as far as the application is concerned, migrating the service provider to another service is not invasive to the application. Finally, since the architecture is concerned only with messages and message exchanges, the barrier to entry for any enterprise is low. There is no need to argue about whether a system should be based on J2EE, .NET, or some other technology since most platforms have Web services support nowadays.

Conclusion
Building object-like systems on top of Web services specifications is a strategy that leads to tightly coupled, brittle, and underperforming systems. While the current crop of tool support implicitly advocates this approach to the unwary, a far better solution is to think of an application in terms of services and the messages that those services exchange. When building code for those service implementations don't be tempted to bind directly to a Web service, but instead bind to the messages that the service produces and consumes. Such an approach promotes loose coupling; your applications will be able to transcend changes in the service they consume and will be much easier to maintain.

References

  • Box, Don. (2003). "Service-Oriented Architecture and Programming (SOAP), Parts 1 and 2." Talks from the MSDN TV archive (Part 1, Part 2).
  • Tuecke, Steve., et al. (2003) "Open Grid Services Infrastructure (OGSI) - Version 1.0". https://forge.gridforum.org/projects/ogsi-wg.
  • More Stories By Jim Webber

    Dr. Jim Webber is a senior researcher from the University of Newcastle
    upon Tyne, currently working in the convergence of Web Services and Grid
    technologies at the University of Sydney, Australia. Jim was previously
    Web Services architect with Arjuna Technologies where he worked on Web
    Services transactioning technology, including being one of the original
    authors of the WS-CAF specification. Prior to Arjuna, Jim was the lead
    developer with Hewlett-Packard on the industry's first Web Services
    Transaction solution. Co-author of "Developing Enterprise Web Services -
    An Architect's Guide," Jim is an active speaker and author in the Web
    Services space. Jim's home on the web is http://jim.webber.name

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    @MicroservicesExpo Stories
    The Software Defined Data Center (SDDC), which enables organizations to seamlessly run in a hybrid cloud model (public + private cloud), is here to stay. IDC estimates that the software-defined networking market will be valued at $3.7 billion by 2016. Security is a key component and benefit of the SDDC, and offers an opportunity to build security 'from the ground up' and weave it into the environment from day one. In his session at 16th Cloud Expo, Reuven Harrison, CTO and Co-Founder of Tufin, ...
    By now, every company in the world is on the lookout for the digital disruption that will threaten their existence. In study after study, executives believe that technology has either already disrupted their industry, is in the process of disrupting it or will disrupt it in the near future. As a result, every organization is taking steps to prepare for or mitigate unforeseen disruptions. Yet in almost every industry, the disruption trend continues unabated.
    SYS-CON Events announced today that HTBase will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. HTBase (Gartner 2016 Cool Vendor) delivers a Composable IT infrastructure solution architected for agility and increased efficiency. It turns compute, storage, and fabric into fluid pools of resources that are easily composed and re-composed to meet each application’s needs. With HTBase, companies can quickly prov...
    Building custom add-ons does not need to be limited to the ideas you see on a marketplace. In his session at 20th Cloud Expo, Sukhbir Dhillon, CEO and founder of Addteq, will go over some adventures they faced in developing integrations using Atlassian SDK and other technologies/platforms and how it has enabled development teams to experiment with newer paradigms like Serverless and newer features of Atlassian SDKs. In this presentation, you will be taken on a journey of Add-On and Integration ...
    Culture is the most important ingredient of DevOps. The challenge for most organizations is defining and communicating a vision of beneficial DevOps culture for their organizations, and then facilitating the changes needed to achieve that. Often this comes down to an ability to provide true leadership. As a CIO, are your direct reports IT managers or are they IT leaders? The hard truth is that many IT managers have risen through the ranks based on their technical skills, not their leadership abi...
    The essence of cloud computing is that all consumable IT resources are delivered as services. In his session at 15th Cloud Expo, Yung Chou, Technology Evangelist at Microsoft, demonstrated the concepts and implementations of two important cloud computing deliveries: Infrastructure as a Service (IaaS) and Platform as a Service (PaaS). He discussed from business and technical viewpoints what exactly they are, why we care, how they are different and in what ways, and the strategies for IT to transi...
    Without a clear strategy for cost control and an architecture designed with cloud services in mind, costs and operational performance can quickly get out of control. To avoid multiple architectural redesigns requires extensive thought and planning. Boundary (now part of BMC) launched a new public-facing multi-tenant high resolution monitoring service on Amazon AWS two years ago, facing challenges and learning best practices in the early days of the new service.
    All organizations that did not originate this moment have a pre-existing culture as well as legacy technology and processes that can be more or less amenable to DevOps implementation. That organizational culture is influenced by the personalities and management styles of Executive Management, the wider culture in which the organization is situated, and the personalities of key team members at all levels of the organization. This culture and entrenched interests usually throw a wrench in the work...
    DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
    As software becomes more and more complex, we, as software developers, have been splitting up our code into smaller and smaller components. This is also true for the environment in which we run our code: going from bare metal, to VMs to the modern-day Cloud Native world of containers, schedulers and micro services. While we have figured out how to run containerized applications in the cloud using schedulers, we've yet to come up with a good solution to bridge the gap between getting your contain...
    As organizations realize the scope of the Internet of Things, gaining key insights from Big Data, through the use of advanced analytics, becomes crucial. However, IoT also creates the need for petabyte scale storage of data from millions of devices. A new type of Storage is required which seamlessly integrates robust data analytics with massive scale. These storage systems will act as “smart systems” provide in-place analytics that speed discovery and enable businesses to quickly derive meaningf...
    DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm. In his Day 3 Keynote at 20th Cloud Expo, Chris Brown, a Solutions Marketing Manager at Nutanix, will explore t...
    DevOps has often been described in terms of CAMS: Culture, Automation, Measuring, Sharing. While we’ve seen a lot of focus on the “A” and even on the “M”, there are very few examples of why the “C" is equally important in the DevOps equation. In her session at @DevOps Summit, Lori MacVittie, of F5 Networks, explored HTTP/1 and HTTP/2 along with Microservices to illustrate why a collaborative culture between Dev, Ops, and the Network is critical to ensuring success.
    With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend @CloudExpo | @ThingsExpo, June 6-8, 2017, at the Javits Center in New York City, NY and October 31 - November 2, 2017, Santa Clara Convention Center, CA. Learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
    Everyone wants to use containers, but monitoring containers is hard. New ephemeral architecture introduces new challenges in how monitoring tools need to monitor and visualize containers, so your team can make sense of everything. In his session at @DevOpsSummit, David Gildeh, co-founder and CEO of Outlyer, will go through the challenges and show there is light at the end of the tunnel if you use the right tools and understand what you need to be monitoring to successfully use containers in your...
    What if you could build a web application that could support true web-scale traffic without having to ever provision or manage a single server? Sounds magical, and it is! In his session at 20th Cloud Expo, Chris Munns, Senior Developer Advocate for Serverless Applications at Amazon Web Services, will show how to build a serverless website that scales automatically using services like AWS Lambda, Amazon API Gateway, and Amazon S3. We will review several frameworks that can help you build serverle...
    The IT industry is undergoing a significant evolution to keep up with cloud application demand. We see this happening as a mindset shift, from traditional IT teams to more well-rounded, cloud-focused job roles. The IT industry has become so cloud-minded that Gartner predicts that by 2020, this cloud shift will impact more than $1 trillion of global IT spending. This shift, however, has left some IT professionals feeling a little anxious about what lies ahead. The good news is that cloud computin...
    An overall theme of Cloud computing and the specific practices within it is fundamentally one of automation. The core value of technology is to continually automate low level procedures to free up people to work on more value add activities, ultimately leading to the utopian goal of full Autonomic Computing. For example a great way to define your plan for DevOps tool chain adoption is through this lens. In this TechTarget article they outline a simple maturity model for planning this.
    While DevOps most critically and famously fosters collaboration, communication, and integration through cultural change, culture is more of an output than an input. In order to actively drive cultural evolution, organizations must make substantial organizational and process changes, and adopt new technologies, to encourage a DevOps culture. Moderated by Andi Mann, panelists discussed how to balance these three pillars of DevOps, where to focus attention (and resources), where organizations might...
    The rise of containers and microservices has skyrocketed the rate at which new applications are moved into production environments today. While developers have been deploying containers to speed up the development processes for some time, there still remain challenges with running microservices efficiently. Most existing IT monitoring tools don’t actually maintain visibility into the containers that make up microservices. As those container applications move into production, some IT operations t...