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 or provide a comment to this blog post.


Working with the HTML5 Canvas

HTML5 has a considerable number of new features to offer. In fact, I discuss many of the new tags that HTML5 has to offer on page 228 of HTML5 Programming with JavaScript For Dummies. In fact, my book demonstrates a number of these tags as part of showing you how to use JavaScript to create applications that run anywhere and on most devices that support HTML5.

One of the more amazing (and least talked about) features of HTML5 is the concept of a canvas that you can draw on, much as an artist uses a canvas to create interesting pictures. I encountered an article about the HTML5 canvas the other day entitled, “All About HTML5 <canvas>” by Molly Holzschlag. In this article you get a great general overview of precisely what a canvas can do for you. I think you’ll find it quite useful, especially if your artistic skills are at the same level as mine are (nearly non-existent). The <canvas> tag makes it possible to create useful graphics in a way that most developers can understand quite easily.

This is one tag that I wish I had explored more fully in my book, but picking topics carefully is part of being a good author. Instead of providing an overview like the one that Molly provided, I chose to include a more specific example that also employs the Google API. My Working with Data Using Maps post describes just one method of working with the Google APIs. Chapters 18 and 20 both discuss methods of working with the Google API and the example in Chapter 20 combines the Google API with the <canvas> to create an interesting example.

If you’re working with HTML5 for the first time, make sure you spend time working with the <canvas> tag. It makes data presentation considerably easier, even if you lack artistic skills. Let me know about the projects you’ve created using the <canvas> tag at


Adding a Web Reference in Visual Studio 2010 (Part 2)

Some time ago I provided some step-by-step instructions for creating both a Web Reference and a Service Reference in Visual Studio 2010 in the Adding a Web Reference in Visual Studio 2010 post. In addition, the post explains the difference between the two to make it easier to understand when to use one over the other. The post has proven popular and a number of people have commented on it.

There are a number of questions about the post though and I wanted to answer them in this follow up post. The biggest question is where the WeatherSoapClient class comes from. The WeatherServiceClient() part of the code comes from the way in which Visual Studio interacts with the WSDL. If you look at:

you find that the WSDL doesn’t contain the word Client either. The WeatherServiceClient class is generated by Visual Studio in response to the WSDL it finds on that site.


Another complaint about that original post is that it relies on C#. Just to make things different, this post uses Visual Basic instead. Creating the Service Reference works precisely the same as it does with C#.

To see how this works, go ahead and create a Service Reference as specified in the original post. When you get done creating just the Service Reference, choose View | Class View in Visual Studio. You’ll see a new Class View window open up. Now, drill down into your project. If you create your example using Visual Basic, you’ll see something very similar to this:


(The C# view of the dialog box is almost precisely the same.) What you’re seeing here is the result of creating the WeatherService Service Reference. I didn’t do anything else at all to this project. Highlighted in the upper window is the WeatherSoapClient referenced in my article. In the lower window you see the methods associated with that class.

Once you get done, you can recreate the example in Visual Basic. Just add two textboxes (txtCity and txtWeather) and one button (btnTest) to your application. Create an event handler for btnTest. Here’s the code you need to make it work:

Private Sub btnTest_Click(sender As System.Object, _
                          e As System.EventArgs) _
                       Handles btnTest.Click
   ' Create an instance of the Web service.
   Dim Client As WeatherService.WeatherSoapClient = _
      New WeatherService.WeatherSoapClient()
   ' Query the weather information.
   Dim Output = From ThisData _
      In Client.GetWeather(txtCity.Text) _
      Select ThisData
   ' Clear the current information and
   ' output the new information.
   txtWeather.Text = ""
   For Each Letter In Output
      txtWeather.Text = txtWeather.Text + Letter
End Sub

As you can see, the code is similar to the C# version I provided in the previous post. The point is that you really do need to use the Class View at times to determine how to interact with a Web service after you create either a Web Reference or a Service Reference. My book, LINQ for Dummies, provides a lot more in the way of helpful information on using Web services effectively for queries. If you want a simpler view of Web services using the C# language, check out C# Design and Development instead. Now you know that the names used by other authors don’t come out of thin air either, even though it might seem that way at times. Please let me know if you have any other questions about this example at


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


Working with Data Using Maps

It’s hard for most people to visualize abstract data. The tables of information presented at meetings of various sorts provide information that people need, but often people don’t absorb the information because they don’t actually see it. The data doesn’t seem to have a connection to the real world. Part of the answer it so present the data as charts and graphs—making it easier to visualize the data. Unfortunately, charts and graphs have a certain level of abstractness as well, so they don’t fully perform the task of making the data. Fortunately, there are other tools in your arsenal, including maps. Creating a pictorial view of the data as it appears in context with the viewer’s surroundings often makes the data come alive. This is the reason I wrote “Using the Google Maps API to Add Cool Stuff to Your Applications.”

You can use the Google API to create data presentations that convey information that is more than the sum of the individual data components. The presentation of data as part of a map tells the viewer more than what happened, how much happened, and where it occurred. A human viewer can often see patterns that aren’t part of the data by viewing that data on a map. The right map can make it possible to understand the data in ways that the data itself doesn’t allow. For example, you might determine that most of your business occurs near crowded intersections during the 5:00 rush hour. Extending what you have learned might make it possible to optimize store locations so that more people will be able to visit during times of peak sales.

The creative presentation of data is important today because attention spans have grown ever shorter as more information sources clamor for a viewer’s attention. When you can make the data presentation interesting and also provide a means to derive more information than the information itself would tend to support, you have a winning presentation strategy. Maps provide such a strategy. Let me know your thoughts on data presentation at


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


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


Web Service Examples in Books

A number of my books include Web service examples. It’s hard to write a book about any sort of development today and not include one or two Web service examples in it. In fact, some of my books, such as Start Here! Learn Microsoft Visual C# 2010 Programming contain a number of these examples. The reason is simple. Online services provide access to a wealth of information and can also reduce the programming burden on developers. Learning to use Web services provides a significant competitive advantage, so I need to discuss them in my books.

Creating a useful and interesting Web service example in a book is a lot harder than you might think. It’s not as if my book is for a particular kind of reader or someone who is looking for a specific type of information. In addition, I need to consider the overall learning experience that the reader will receive from the example. With these criteria in mind, I ask myself the following questions when choosing a Web service for a book.


  • Is the service free?
  • Is it general enough to be appealing to my reader?
  • Will the service be around tomorrow so that the reader doesn’t find a blank site?
  • Does the service include a well-designed API that will make it easy for my reader to learn?
  • Will the service be easy enough to use that the examples won’t become too complex?

There are often other questions I must ask, but you get the general idea from these questions. It isn’t simply a matter of choosing something, anything, online. Even though I’m particular about which Web service I choose, readers often encounter problems. Just this past week at least one reader complained about the REST example in Chapter 6 of Start Here! Learn Microsoft Visual C# 2010. It was a frustrating problem to troubleshoot because the example continued to work just fine for me. However, here are some things to consider when working through the Web service examples in one of my books:


  • Use the book’s source code, rather than type the source in yourself.
  • Look on my blog for updates for your book that show how to use any Web service updates.
  • Check your Internet connection to ensure it’s active.
  • Verify that the Web service is actually functional (and try back a few times, just in case).
  • Contact the Web service owner with questions you have about it.
  • Contact me at about example code that you simply can’t get to work.

I want you to have a great experience using my books. When I do encounter a Web service that has changed or is no longer in service (it does happen), I’ll try to update my example code so you can continue using the book, as long as the book is still supported (please check the unsupported book list on my Web site).


The Release of Start Here! Learn Microsoft Visual C# 2010 Programming

It’s always exciting to see a new book released. I had previously told you about my new book, “Start Here! Learn Microsoft Visual C# 2010 Programming” in my post entitled, “New Book Announcement: Start Here! Learn Microsoft Visual C# 2010 Programming.” That post provides some basic information about the book, including a list of the chapters and what you should expect as content. Today this book is finally in print, so you can see it for yourself. Interestingly enough, I’ve already received a few queries about this book. I’ll answer the most commonly asked question in this post, which is what prompted me to write it.

Every time I receive an e-mail, see a review of one of my books online, or obtain information about a book in some other way, I try to see if I can use the feedback to improve later editions or to write a better book. In fact, I maintain statistics about each of my books because I really value your input and want to make the best use of it. The statistics I obtain from all of these forms of input help me understand how you use books better.

One of the comments I receive fairly often is that most books feel like college courses. They’re highly structured and seem most interested in teaching how to write applications using a stilted, old fashioned approach that doesn’t fit the reader’s needs very well. At least one reader has associated this approach with learning how to play piano using textbooks—you spend hours performing boring exercises to learn how to play something relatively simple. In the reader’s words, “Such an approach sucks every bit of joy out of the process of learning to play piano.” Yes, many people do learn to play piano using textbooks, but others learn to “play by ear” (simply by doing it without learning any basics first). These readers wonder why computer books can’t be written in a way that let’s you learn how to program using the “play by ear” approach.

I agree that not everyone learns in the same way. All other things being equal, one person may require a completely different book from someone else in order to get anything out of it because the two people learn differently. So, even if I wrote the most error free and comprehensive book ever written about C# application development, some people would love it and others would hate it simply because of the approach I took. Trying to solve this problem of writing a book that uses the “play by ear” approach has proven difficult.

To solve this problem, I needed to come up with a technique that would allow the reader to write code and then “hear” what the code does by running it. However, simply seeing the output isn’t sufficient in this case. In order to understand the code, the reader has to trace through itessentially “hearing” the individual tasks performed by each line of code. I tried a tracing technique for the first time in LINQ for Dummies and received quite a few positive responses about it. Now, LINQ for Dummies does use the college approach for the most part, but some sections use this new “play by ear” approach and it seems to work well for readers who require that approach.

It was with great excitement then, that I took on a book that would approach C# development from a completely different perspective after Russell Jones asked me about it. Start Here! Learn Microsoft Visual C# 2010 Programming is the result of my efforts. This book uses the tracing technique I started to develop in LINQ for Dummies extensively. Instead of spending hours learning about basic programming constructs and then writing tiny programs to put the theory into practice, you begin writing code immediately.

The main plus I see in using this approach is that nearly anyone should be able to learn to write useful (but basic) applications in a fraction of the time normally required and without devoting nearly as much time to the activity. The learning process should also be significantly less boring because you’re always doing something that has real world results. Of course, I’m extremely interested in seeing how this approach works for you, the reader. The only way I’ll get that information is if you write me at and tell me what you think of the book.

New Book Announcement: Start Here! Learn Microsoft Visual C# 2010 Programming

Have you ever attended a college course and found that you just didn’t understand what the teacher was trying to say? Worse yet, you found yourself dosing during a lecture? Many people require a hands-on approach to learning—they just don’t learn well using the college approach. Start Here! Learn Microsoft Visual C# 2010 Programming is designed to answer needs of anyone who has quickly become disenchanted with the way that colleges teach programming. You’ll start coding in Chapter 1 and won’t stop coding until you’ve completed the book!

Start Here! Learn Microsoft Visual C# 2010 Programming takes an entirely new approach to learning how to write code. You begin by writing some codeimagine that! Then, you use a special tracing technique to see how the code workswhat it does and how it does it. Instead of mind numbing sessions involving the discussion of keywords from a purely theoretical view, you jump right into using those keywords to do something useful.

You also don’t waste your time with silly Hello World applications. You get right into techniques that will prove useful later when you’re creating applications on your own. Chapter 1 starts things off right by showing you how to display an image from a Web site on the local desktop. Instead of spending hours trying to figure out looping mechanisms, you use the modern techniques provided by Language INtegrated Query (LINQ) to achieve your goals. You’ll do things like access a Web service and request weather information from it. There are even Silverlight and Windows Presentation Foundation (WPF) examples. Here is a quick overview of the book’s content:

  • Chapter 1: Getting to Know C#
  • Chapter 2: Developing a Web Project
  • Chapter 3: Using Simple Data Manipulation Techniques
  • Chapter 4: Using Collections to Store Data
  • Chapter 5: Working with XML
  • Chapter 6: Accessing a Web Service
  • Chapter 7: Using the Windows Presentation Foundation
  • Chapter 8: Working with Libraries
  • Chapter 9: Creating Utility Applications
  • Chapter 10: Using LINQ in Web Applications
  • Chapter 11: Working with Silverlight Applications
  • Chapter 12: Debugging Applications

You’ll also gain knowledge that many people spend years learning. For example, the tracing technique you use throughout the book naturally leads into the debugging information in Chapter 12. Debugging won’t be a mystery to youit’ll actually be a natural part of your work process so you’ll find it much easier to locate the bugs in your applications.

There is even a chapter on writing command line utilities. More and more administrators are returning to the command line because the GUI is simply too slow in today’s competitive world. Unfortunately, many developers don’t know how to write a really good command line utility, but you’ll gain this skill at the outset.

This book (my 88th) is truly designed for the complete novice. You do need to know how to work with Windows and perform basic tasks such as installing applications. However, you don’t need to know anything about coding to start using this book. In fact, people who already have a good starting knowledge of programming may find that some of the material is a little too simple. If you have any questions at all about my new book, please let me know at