Microservices Expo Authors: Mehdi Daoudi, Pat Romanski, Flint Brenton, Elizabeth White, Gordon Haff

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.

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.


  • 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
    For over a decade, Application Programming Interface or APIs have been used to exchange data between multiple platforms. From social media to news and media sites, most websites depend on APIs to provide a dynamic and real-time digital experience. APIs have made its way into almost every device and service available today and it continues to spur innovations in every field of technology. There are multiple programming languages used to build and run applications in the online world. And just li...
    There is a huge demand for responsive, real-time mobile and web experiences, but current architectural patterns do not easily accommodate applications that respond to events in real time. Common solutions using message queues or HTTP long-polling quickly lead to resiliency, scalability and development velocity challenges. In his session at 21st Cloud Expo, Ryland Degnan, a Senior Software Engineer on the Netflix Edge Platform team, will discuss how by leveraging a reactive stream-based protocol,...
    The general concepts of DevOps have played a central role advancing the modern software delivery industry. With the library of DevOps best practices, tips and guides expanding quickly, it can be difficult to track down the best and most accurate resources and information. In order to help the software development community, and to further our own learning, we reached out to leading industry analysts and asked them about an increasingly popular tenet of a DevOps transformation: collaboration.
    "We started a Master of Science in business analytics - that's the hot topic. We serve the business community around San Francisco so we educate the working professionals and this is where they all want to be," explained Judy Lee, Associate Professor and Department Chair at Golden Gate University, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
    We call it DevOps but much of the time there’s a lot more discussion about the needs and concerns of developers than there is about other groups. There’s a focus on improved and less isolated developer workflows. There are many discussions around collaboration, continuous integration and delivery, issue tracking, source code control, code review, IDEs, and xPaaS – and all the tools that enable those things. Changes in developer practices may come up – such as developers taking ownership of code ...
    The dynamic nature of the cloud means that change is a constant when it comes to modern cloud-based infrastructure. Delivering modern applications to end users, therefore, is a constantly shifting challenge. Delivery automation helps IT Ops teams ensure that apps are providing an optimal end user experience over hybrid-cloud and multi-cloud environments, no matter what the current state of the infrastructure is. To employ a delivery automation strategy that reflects your business rules, making r...
    Cloud Governance means many things to many people. Heck, just the word cloud means different things depending on who you are talking to. While definitions can vary, controlling access to cloud resources is invariably a central piece of any governance program. Enterprise cloud computing has transformed IT. Cloud computing decreases time-to-market, improves agility by allowing businesses to adapt quickly to changing market demands, and, ultimately, drives down costs.
    Modern software design has fundamentally changed how we manage applications, causing many to turn to containers as the new virtual machine for resource management. As container adoption grows beyond stateless applications to stateful workloads, the need for persistent storage is foundational - something customers routinely cite as a top pain point. In his session at @DevOpsSummit at 21st Cloud Expo, Bill Borsari, Head of Systems Engineering at Datera, explored how organizations can reap the bene...
    How is DevOps going within your organization? If you need some help measuring just how well it is going, we have prepared a list of some key DevOps metrics to track. These metrics can help you understand how your team is doing over time. The word DevOps means different things to different people. Some say it a culture and every vendor in the industry claims that their tools help with DevOps. Depending on how you define DevOps, some of these metrics may matter more or less to you and your team.
    "CA has been doing a lot of things in the area of DevOps. Now we have a complete set of tool sets in order to enable customers to go all the way from planning to development to testing down to release into the operations," explained Aruna Ravichandran, Vice President of Global Marketing and Strategy at CA Technologies, in this SYS-CON.tv interview at DevOps Summit at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
    "We are an integrator of carrier ethernet and bandwidth to get people to connect to the cloud, to the SaaS providers, and the IaaS providers all on ethernet," explained Paul Mako, CEO & CTO of Massive Networks, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
    "Grape Up leverages Cloud Native technologies and helps companies build software using microservices, and work the DevOps agile way. We've been doing digital innovation for the last 12 years," explained Daniel Heckman, of Grape Up in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
    "NetApp's vision is how we help organizations manage data - delivering the right data in the right place, in the right time, to the people who need it, and doing it agnostic to what the platform is," explained Josh Atwell, Developer Advocate for NetApp, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    "Outscale was founded in 2010, is based in France, is a strategic partner to Dassault Systémes and has done quite a bit of work with divisions of Dassault," explained Jackie Funk, Digital Marketing exec at Outscale, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    "I focus on what we are calling CAST Highlight, which is our SaaS application portfolio analysis tool. It is an extremely lightweight tool that can integrate with pretty much any build process right now," explained Andrew Siegmund, Application Migration Specialist for CAST, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
    Let's do a visualization exercise. Imagine it's December 31, 2018, and you're ringing in the New Year with your friends and family. You think back on everything that you accomplished in the last year: your company's revenue is through the roof thanks to the success of your product, and you were promoted to Lead Developer. 2019 is poised to be an even bigger year for your company because you have the tools and insight to scale as quickly as demand requires. You're a happy human, and it's not just...
    The enterprise data storage marketplace is poised to become a battlefield. No longer the quiet backwater of cloud computing services, the focus of this global transition is now going from compute to storage. An overview of recent storage market history is needed to understand why this transition is important. Before 2007 and the birth of the cloud computing market we are witnessing today, the on-premise model hosted in large local data centers dominated enterprise storage. Key marketplace play...
    Cavirin Systems has just announced C2, a SaaS offering designed to bring continuous security assessment and remediation to hybrid environments, containers, and data centers. Cavirin C2 is deployed within Amazon Web Services (AWS) and features a flexible licensing model for easy scalability and clear pay-as-you-go pricing. Although native to AWS, it also supports assessment and remediation of virtual or container instances within Microsoft Azure, Google Cloud Platform (GCP), or on-premise. By dr...
    With continuous delivery (CD) almost always in the spotlight, continuous integration (CI) is often left out in the cold. Indeed, it's been in use for so long and so widely, we often take the model for granted. So what is CI and how can you make the most of it? This blog is intended to answer those questions. Before we step into examining CI, we need to look back. Software developers often work in small teams and modularity, and need to integrate their changes with the rest of the project code b...
    Kubernetes is an open source system for automating deployment, scaling, and management of containerized applications. Kubernetes was originally built by Google, leveraging years of experience with managing container workloads, and is now a Cloud Native Compute Foundation (CNCF) project. Kubernetes has been widely adopted by the community, supported on all major public and private cloud providers, and is gaining rapid adoption in enterprises. However, Kubernetes may seem intimidating and complex ...