Welcome!

Microservices Expo Authors: Liz McMillan, Todd Matters, Pat Romanski, Elizabeth White, Stefana Muller

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
    New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists examined how DevOps helps to meet the de...
    For most organizations, the move to hybrid cloud is now a question of when, not if. Fully 82% of enterprises plan to have a hybrid cloud strategy this year, according to Infoholic Research. The worldwide hybrid cloud computing market is expected to grow about 34% annually over the next five years, reaching $241.13 billion by 2022. Companies are embracing hybrid cloud because of the many advantages it offers compared to relying on a single provider for all of their cloud needs. Hybrid offers bala...
    "When we talk about cloud without compromise what we're talking about is that when people think about 'I need the flexibility of the cloud' - it's the ability to create applications and run them in a cloud environment that's far more flexible,” explained Matthew Finnie, CTO of Interoute, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    @DevOpsSummit at Cloud Expo taking place Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center, Santa Clara, CA, is co-located with the 21st International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is ...
    What's the role of an IT self-service portal when you get to continuous delivery and Infrastructure as Code? This general session showed how to create the continuous delivery culture and eight accelerators for leading the change. Don Demcsak is a DevOps and Cloud Native Modernization Principal for Dell EMC based out of New Jersey. He is a former, long time, Microsoft Most Valuable Professional, specializing in building and architecting Application Delivery Pipelines for hybrid legacy, and cloud ...
    Containers, microservices and DevOps are all the rage lately. You can read about how great they are and how they’ll change your life and the industry everywhere. So naturally when we started a new company and were deciding how to architect our app, we went with microservices, containers and DevOps. About now you’re expecting a story of how everything went so smoothly, we’re now pushing out code ten times a day, but the reality is quite different.
    There's a lot to gain from cloud computing, but success requires a thoughtful and enterprise focused approach. Cloud computing decouples data and information from the infrastructure on which it lies. A process that is a LOT more involved than dragging some folders from your desktop to a shared drive. Cloud computing as a mission transformation activity, not a technological one. As an organization moves from local information hosting to the cloud, one of the most important challenges is addressi...
    For organizations that have amassed large sums of software complexity, taking a microservices approach is the first step toward DevOps and continuous improvement / development. Integrating system-level analysis with microservices makes it easier to change and add functionality to applications at any time without the increase of risk. Before you start big transformation projects or a cloud migration, make sure these changes won’t take down your entire organization.
    21st International Cloud Expo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Me...
    "We are a monitoring company. We work with Salesforce, BBC, and quite a few other big logos. We basically provide monitoring for them, structure for their cloud services and we fit into the DevOps world" explained David Gildeh, Co-founder and CEO of Outlyer, in this SYS-CON.tv interview at DevOps Summit at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    Microservices are increasingly used in the development world as developers work to create larger, more complex applications that are better developed and managed as a combination of smaller services that work cohesively together for larger, application-wide functionality. Tools such as Service Fabric are rising to meet the need to think about and build apps using a piece-by-piece methodology that is, frankly, less mind-boggling than considering the whole of the application at once. Today, we'll ...
    Cloud Expo, Inc. has announced today that Andi Mann and Aruna Ravichandran have been named Co-Chairs of @DevOpsSummit at Cloud Expo Silicon Valley which will take place Oct. 31-Nov. 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. "DevOps is at the intersection of technology and business-optimizing tools, organizations and processes to bring measurable improvements in productivity and profitability," said Aruna Ravichandran, vice president, DevOps product and solutions marketing...
    In his session at Cloud Expo, Alan Winters, an entertainment executive/TV producer turned serial entrepreneur, presented a success story of an entrepreneur who has both suffered through and benefited from offshore development across multiple businesses: The smart choice, or how to select the right offshore development partner Warning signs, or how to minimize chances of making the wrong choice Collaboration, or how to establish the most effective work processes Budget control, or how to ma...
    SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
    In the decade following his article, cloud computing further cemented Carr’s perspective. Compute, storage, and network resources have become simple utilities, available at the proverbial turn of the faucet. The value they provide is immense, but the cloud playing field is amazingly level. Carr’s quote above presaged the cloud to a T. Today, however, we’re in the digital era. Mark Andreesen’s ‘software is eating the world’ prognostication is coming to pass, as enterprises realize they must be...
    A common misconception about the cloud is that one size fits all. Companies expecting to run all of their operations using one cloud solution or service must realize that doing so is akin to forcing the totality of their business functionality into a straightjacket. Unlocking the full potential of the cloud means embracing the multi-cloud future where businesses use their own cloud, and/or clouds from different vendors, to support separate functions or product groups. There is no single cloud so...
    Both SaaS vendors and SaaS buyers are going “all-in” to hyperscale IaaS platforms such as AWS, which is disrupting the SaaS value proposition. Why should the enterprise SaaS consumer pay for the SaaS service if their data is resident in adjacent AWS S3 buckets? If both SaaS sellers and buyers are using the same cloud tools, automation and pay-per-transaction model offered by IaaS platforms, then why not host the “shrink-wrapped” software in the customers’ cloud? Further, serverless computing, cl...
    Hybrid IT is today’s reality, and while its implementation may seem daunting at times, more and more organizations are migrating to the cloud. In fact, according to SolarWinds 2017 IT Trends Index: Portrait of a Hybrid IT Organization 95 percent of organizations have migrated crucial applications to the cloud in the past year. As such, it’s in every IT professional’s best interest to know what to expect.
    The taxi industry never saw Uber coming. Startups are a threat to incumbents like never before, and a major enabler for startups is that they are instantly “cloud ready.” If innovation moves at the pace of IT, then your company is in trouble. Why? Because your data center will not keep up with frenetic pace AWS, Microsoft and Google are rolling out new capabilities. In his session at 20th Cloud Expo, Don Browning, VP of Cloud Architecture at Turner, posited that disruption is inevitable for comp...
    Companies have always been concerned that traditional enterprise software is slow and complex to install, often disrupting critical and time-sensitive operations during roll-out. With the growing need to integrate new digital technologies into the enterprise to transform business processes, this concern has become even more pressing. A 2016 Panorama Consulting Solutions study revealed that enterprise resource planning (ERP) projects took an average of 21 months to install, with 57 percent of th...