Using Hypermedia to Your Advantage

Many developers are familiar with the task of making a request to a server and receiving a response. We’ve been performing the same task since before the PC even appeared on the scene. So, it’s hard to imagine that anything new has come up. Hypermedia is that new thing, but before we go to far, let me fill in a few details.

When working on the Web, these requests normally go through a Web service that relies on a technology such as SOAP or REST. The essential idea is always the same—send a request, receive a response to that request (even when the response is an error). Of course, the Web adds it’s own wrinkles to the process. For example, most Web services rely on text-based data transfers, rather than the binary transfers used in the past.

The problem with this request/response scenario is that it assumes that the Application Programming Interface (API) used to make the transfer of information happen is well-documented by the provider and also well-understood by the developer. Unfortunately, documentation is often poor and understanding is even poorer. Wouldn’t it be nice if along with the response to a request, a developer also received a list of things that the result allows. Hypermedia performs precisely that task. When you make a request to a service that provides hypermedia support, not only do you get the information you requested, but you also get a list of things you can do with that information.

Hypermedia has just started picking up steam in the last year, so it doesn’t appear in any of my current books (you can bet it will in the future). However, I recently wrote an article about it entitled, Working with Hypermedia APIs. The article provides you with a good overview of what hypermedia APIs can do for you, why they’re an important new way of working with services, and what you can expect from them. Still, hypermedia APIs are in their infancy and I’ll eventually need to provide additional information about them.

Precisely what I do depends on your response to the article and to this post. For example, it may eventually be a good idea to get into the design criteria for hypermedia APIs. On the other hand, it may be better to start with existing hypermedia API services so that you can better see how they work. I’d like to hear from you about your interest level in the topic so that I know how to proceed. Make sure you write me about hypermedia APIs at John@JohnMuellerBooks.com or provide a comment to this blog post.

 

Web Services and Protocols

A number of my books (such as HTML5 Programming with JavaScript For Dummies, Start Here! Learn Microsoft Visual C# 2010 Programming, Professional Windows 7 Development Guide, and LINQ for Dummies) discuss Web services and how to access them. As developers become more and more pressed for time, using code that has been debugged and tested by someone else becomes extremely tempting. Web services provide free or paid access to someone’s code in a specific manner. Using Web services is the only way that many organizations can deliver robust applications on time and within budget today. That’s the reason Web services figure prominently in previous books and will become even more important in upcoming books.

If every one of these Web services used a different set of low-level rules to provide access, it would be a nightmare for developers to access them. Fortunately, Web services generally use one of two methods of low-level access: Simple Object Access Protocol (SOAP) or REpresentational State Transfer (REST). Most developers assume that one or the other protocol is best, but a recent article that I wrote, “Understanding SOAP and REST Basics” points out that you actually need to be proficient with both protocols to get the most out of the resources available online. The overall point of this article is that a well-equipped developer can make things happen quickly by using the best Web service for a particular task, irregardless of the underlying protocols that it uses.

Web services still have many differences. In most cases, the differences are due to individual team perspectives of the task at hand, rather than some requirement for exposing the data in a certain way. A few of these differences are incredibly convoluted. Sending REST requests where you include data as part of the request header is one example of a needlessly cumbersome method of transferring information. The need to send every SOAP request as pure XML creates ticklish situations at times. Future standards (and there will be many) will help smooth these differences out and make Web service access even easier.

The use of Web services as a programming strategy is still in its infancy, so you should expect to see some major changes as more developers rely on Web services as a basic programming tool. What are some of the most pressing problems you see with SOAP and REST today? Do you feel there will be a third standard that marries the best features of the two standards and also adds a few features of its own? What sorts of Web services would you like to see in the future? Let me know your thoughts on the topic at John@JohnMuellerBooks.com.

 

An Update on Microsoft’s New Casablanca Release

A little over a month ago I wrote a post entitled, “Microsoft’s New Casablanca Release” about Microsoft’s newest Casablanca product. Niklas Gustafsson, a member of the Microsoft Visual C++ Team was kind enough to contact me and answer a few questions about this release. I decided that you also need to know the answers to these questions so that you can make an intelligent decision about Casablanca. As a quick recap, Casablanca is a new product that lets C++ developers interact with the cloud using REST.

The first thing Niklas pointed out is that Casablanca isn’t precisely a product—it’s what is termed as an incubation effort, something to see what is possible and will work. Casablanca is early in its life cycle and doesn’t provide either the quality or maturity that a released product would provide. to me, this means that you need to be careful using Casablanca. For the time being, it’s probably an interesting technology to play with, but you probably shouldn’t employ it in your production application because it will change quite a lot.

Even though I use C++ for utilities and low level program (as described in C++ All-In-One Desk Reference For Dummies), Niklas pointed out that many organizations use C++ for larger, line of business applications. In many cases, the reason for using a language like C++ for this purpose is that the organization has already made an investment in C++, so the language is familiar and the organization already has the required resources. I still can’t imagine creating a large scale user application using C++, but I’m also not the one trying to forge ahead in a large organization. It seems to me that using other languages would be simpler and less error prone, but I’m well-versed in using a number of languages, so I have the option of using the best tool for a specific task. In fact, Niklas summarized C++ usage for larger applications in the following points:

 

  • Raw performance
  • Portability
  • It’s what they know

To make his point clearer, Niklas provided me with a link to a whitepaper entitled “C++ and Cloud Computing” that makes a number of points clear. I encourage you to download this whitepaper and give it a read before you make any decisions regarding C++ and the cloud. It certainly helped me envision how someone might use Casablanca a bit better. For example, even a low-level application could need access to an online storage provider in order to access the information it needs. I also hadn’t considered some special areas of program, such as gaming, when I wrote my original post—I was thinking more along the lines of what a business developer would need.

With regard to my question about using REST, rather than SOAP, Niklas pointed out that REST currently enjoys far wider support than SOAP and that it’s simpler to implement. If Casablanca becomes a success, SOAP support could follow. So, at least the team is thinking about SOAP as a future addition.

It’s also important to remember that many organizations are only starting to think about cloud computing, so technologies such as Casablanca are still well ahead of the curve. Sometimes in reading the technical articles online, you get the idea that cloud computing is already well entrenched in the enterprise. The truth is that many enterprises are only now experimenting with the cloud and some will never use the cloud due to regulatory or other concerns.

I was really happy that Niklas took time out to contact me regarding Casablanca. I’ll be taking another look at this technology as the Visual C++ Team works on it and will likely provide you with an update sometime in the future. In the meantime, let me know how your organization is working in the cloud today at John@JohnMuellerBooks.com.

 

Microsoft’s New Casablanca Release

When I wrote C++ All-In-One Desk Reference For Dummies, I provided the reader with a view of C++ as a low-level language. It’s true that most developers use C++ to create command line utilities, drivers, embedded systems, libraries, and even operating systems. While I might use C++ to create a database engine, I probably wouldn’t use it to create a database application. I’d probably lean toward some combination of a procedural language such as C# or Visual Basic and a declarative language such as SQL or LINQ for the purpose. I’ve written database applications using PHP, Java, and a host of other languages, but never in C++ because C++ isn’t the optimal tool for the job. Many developers have written about the strength of C++ being the flexibility it provides to perform amazing tasks. So, I was a bit surprised to learn that Microsoft has delivered a new product codenamed Casablanca that lets C++ developers interact with the cloud using REST.

In reading the blog post announcing Casablanca, I detect a lack of direction. I understand that C++ currently lacks library support for any sort of Web service access without buying a separate third party product. However, that’s all that the blog post tells me. It doesn’t provide me with any ideas of how Microsoft sees the developer using this library. Given that some people do write C++ applications, I imagine that Microsoft envisions developers creating full-fledged applications with their product, but the intent is a mystery (and will remain so until someone at Microsoft speaks up). The last paragraph of the blog post says it all, ‘We would love to know whether you’re interested in using C++ to consume and implement cloud services, and if so, what kind of support you want in order to do so, whether “Casablanca” is on the right track, and how you’d like to see it evolve.’ Apparently, Microsoft is hoping that the development community will come up with some ideas on using this product.

Casablanca also comes with some significant restrictions. The most important of these restrictions is the platforms that support it:

 

  • Windows Vista
  • Windows 7
  • Windows 8


This means you can’t use Casablanca to create a library for all of those Windows XP users on your network. It doesn’t surprise me that Microsoft would place these platform limits on the product, but I’m wondering just how many developers will be able to use Casablanca in today’s enterprise environment for a product application. The fact that Microsoft’s Casablanca site heavily promotes its use with Azure leaves no doubt that this product is designed for the enterprise (or at least, a larger business).

Another strange limitation is that the product only supports REST. At one time, Microsoft was promoting SOAP and many Web services still rely on this protocol. In fact, it’s actually easier to create a connection to a SOAP Web service in Visual Studio than it is to create a REST connection. I’m sure that Microsoft will address this limitation at some point, but for now, this remains a problem for developers.

Casablanca does come with the usual Microsoft bells and whistles. If you buy the latest version of Visual Studio, you’ll obtain a complete set of templates that will make coding access to a REST Web service easier. I’m sure that there are developers who are working with just the supported platforms, work with Azure, and have the most recent version of Visual Studio who will absolutely love this product, but I have to wonder how many developers outside this small core group will be able to use Casablanca to do something productive.

Normally, I try to find something positive to say about new product releases, but this one has me scratching my head. I’ve downloaded Casablanca and plan to play with it some more. If there are some truly dazzling features, I’ll post an updated blog entry later. In the meantime, I’d like to hear your input. Is Casablanca an amazing new product that C++ developers must have? If so, how do you plan to use it? Let me know at John@JohnMuellerBooks.com.