Pluralsight blog Where devs, IT admins & creative pros go for news, tips, videos and more.
Pluralsight + Digital-Tutors - 3,000 tech & creative courses - starting at $29/month Get it now →
March 12, 2012

Meet the Author: Matt Milner on Developing OData Clients

By

In today’s podcast in our Meet the Author series, Fritz Onion speaks to Matt Milner about his Developing OData Clients course.  In the interview Matt explains some of the goals of OData, which companies are using it, and why using OData can be a good idea for companies looking to expose data services with maximum flexibility for their clients.  He also discusses which of the various client technologies he prefers to work with and why.

Listen to the Audio (MP3)

Meet the Author:  Matt Milner on Developing OData Clients

Transcript


[Fritz] Hi, this is Fritz Onion with another Pluralsight author interview. Today I’m here with Matt Milner to talk about his new course OData Clients. Matt is one of the original Pluralsight authors and by far our most prolific with over 20 courses in the library. His courses cover topics ranging from Windows Workflow and BizTalk Server to Windows Azure and WebMatrix. His new course OData Clients is a follow up to a course that he published last year introduction to OData. Welcome, Matt it’s great to talk to you.

[Matt] Thanks, Fritz. It’s great to be here. I’m looking back on that over 20 courses and I hadn’t counted that is a lot.

[Fritz] I know I counted for the first time today and that kind of blew me away. So to begin with why don’t we start with a quick overview of what OData is and purpose it serves.

[Matt] Well OData stands for the open data protocol and you can think of it almost as an ADO.NET or an ODBC for the web. The idea of being that it’s a protocol for doing data querying, data updates, inserts kind of the crud operations. But instead of being, you know something like ADO.NET or ODBC where you have to have a particular Client library to talk to say an Oracle database or, you know any other proprietary system. It’s all based on open standard. So it’s HTTP and then for the data itself it’s JSON or ATOM. And so, you know all open protocols — essentially if you’re going to be doing networking you probably have that the tools already on your system to be able to do OData.

[Fritz] Right.

[Matt] And so the goal is to open up more systems, more data, more resources to a variety of different clients and to do it in a consistent way so that you have a consistent way to query data, you have a consistent way to present data to the server for updates or inserts. And, if you think about today especially on the web, gosh if I want to use Facebook, and Netflix, and EBay and all these other places they all had to come up with their own API’s and they might all just be HTTP, but some of them are probably using their own XML schemas, some of them may have been using JSON. You had to figure out how to address different things, how to query one system or the other. And so as you move from one service to another they were all different and even though they may have had similar bases in technology. They all worked a little differently and you had to figure that out. And so OData’s kind of promis or one of the ideals is that it will bring some consistency to those kinds of services, so as I move from one to the other as a consumer, they all work essentially the same. If I know how to query one, I know how to go to the other one and query for what I want.

[Fritz] Right. Now I know companies like Netflix and EBay have OData feeds and Pluralsight has one actually that you helped build for us. So how pervasive has it become? Like how many companies actually support OData, you know beyond sort of the high — big high, big guys?

[Matt] We’re big in our own way.

[Fritz] That’s right.

[Matt] You know it is one of those things, OData started with Microsoft and Microsoft has had a lot of success in the past that — they’ve created something and opened it up and said, you know we believe this can be an open standard rather than the whole design by committee that takes years, and years to get, you know version one out there. And that’s how this came about is Microsoft kind of built it internally. They released it out and they’ve been working with a lot of industry partners. And so you have companies like IBM, who are building this into Websphere. You have SAP is building it into their latest products. So you have some of these bigger players out there that are starting to embrace this as a way for them to expose data services and data focus endpoints. But you also have a lot of like I said Microsoft products, things like SharePoint. A lot of the Windows Azure, the storage components out there. As well as the company focus, so not a tech company like an IBM or SAP, but you know you mentioned Netflix and EBay. Facebook has some of their API’s exposed. But cities as well and governments. There’s several different principalities in Canada that are exposing a lot of their information through OData feeds and, you know even some places having competitions where — heh, we’re opening up our data or API. Go write a great application on top of that. Go create a great mobile app that helps people figure out, you know something interesting about their city that they’re in or that they’re visiting. And you can actually see Microsoft tries to keep a list and I’m sure it’s not current, it’s probably almost certainly not comprehensive, but it’s a pretty good list out at OData.org/producers. They got a list of just some of the ones that they know about or they’ve worked with those customers. So it starting to gain a lot attraction, as you start to see more clients that consume OData. You start to see more people that are interested in exposing it and also the tools that you use to build an OData service especially in the Microsoft space make it really easy to take an existing object model or data sources and get them out there quickly. And so I think one of the things that people are seeing is if you imagine building a service for someone. Let’s say it’s over your product data, you know the first thing that happens is you have to build up all the infrastructure and build the service and then you have expose out some way to query it. And if that’s a service where you have write a method, maybe you have, you know search product by price, search product by name. And then in three months you get a requirement that, oh we need to search by some other filed. We need enable people to do all these different things when querying and OData just enables that by default. The built in query language the support for paging. The support for, you know drilling down in and getting particular properties is all there from the start and so you don’t have the cascades of requirements of, you know we have all these different customers and they want the data all the different ways. They can write different queries to get it.

[Fritz] So it’s much more than just data interchange format, its’ how to query the data, and how to sort it in the lab as well.

[Matt] Exactly. All right, part of the protocol and the standard is the payload, the actual data. Now here’s what you need to do in response to a request or say I need to format the data if you want to post it, but a big piece of it is the protocol piece that goes in the URI and the headers that go along with that. And so there’s a very rich query language that acts much like language integrated query in .NET. You have the ability to do select and filtering, and like I said paging. You know so you can do skip and top, and those sorts of things.

[Fritz] Yes. And now in your first OData query, so you introduce OData and showed how to implement services that support OData and clients to consume it. What made you decide to write a follow-up course dedicated entirely to building OData clients?

[Matt] Well I felt like we had one, you know one module in that first course on Clients and I thought there was a lot more to explorer in terms of the different ways that you do it. And also just some of the things that maybe aren’t intuitive and I also wanted to highlight some of the great features that some of these libraries have. So why you don’t need really anything on a client other than HTTP and text processing to call one of these services and works with it. A lot of these libraries really make the client experience pretty rich. .NET of course, you know Microsoft started all of this. The .NET experience is great with add service reference support of visual studio. You get a client context that acts like a data context that acts like a you know a data context for Entity Framework or Linq to SQL and you write LINQ. You don’t have to worry about any of the HTTP or, you know getting the query syntax right in the URI. So those were things that I really wanted to highlight and kind of show people how easy it was to use these things. But there’s also kind of some tricky pieces. You know if you’re using .NET there’s four or five different methods that has something to do with links. You know add a link, attach a link, set a link and there were things like that, that I felt like people need to know how to do some of things if they’re really going to get out there and use this, you know in a production fashion and not just go write some simple queries.

[Fritz] Now when you’re in this new course you show three primary platforms from which you can consume OData services, Javascript, Silverlight, and .NET. Have you personally found occasion to use all three of these in your consulting work? And if so which one do tend to use most often?

[Matt] A bit. You know Javascript and .NET — and I like the Javascript I think because it’s much like OData it’s kind of raw. It’s just HTTP and JSON, it’s really a perfect pairing. And with web clients today being able to go out and just pull all of this data in from a v variety places is great and so I think — the Javascript whether your calling back to your own services to get data or to manipulate data, or your calling out to external services to pull that in and kind of augment your site with a data from elsewhere. It’s just a really nice fit. The libraries with their JQuery or there’s a DataJS library that we cover in the course. You know they make it very simple to go out and just grab that data. I love using the JQuery templates. Again, another perfect match. You just kind of pull all of these things together that are just Javascript and HTTP. And you can make some really rich web applications. And I find that, you know if I’m doing web applications its typically the Javascript model certainly Silverlight come in there as well, but I’ve used it also in .NET applications because , you know the support is just great to be able to do add service reference and have that context and be able to query using LINQ, but also to be able to do batch updates so you can, you know make changes to three or four items. And submit all of those changes back as a batch to the server which again makes her really nice. And a management of all that infracture stuff that I don’t want to have to worry about through using the API.

[Fritz] Right.

[Matt] I’ve actually talked to several people that had their own, you know kind of services back end and they had front ends for it that they were building. And what they were talking about is that they would, maybe build their own service using something else. Using WCF or maybe they were using WCF RIA services and Silverlight, but as they started getting request — they’re from other departments or customers to get out their data they found that being able to stand up an OData service, enable all those different clients. Whether they wanted to use Javascript, or a Silverlight, or .NET, or even some other platform. They would stand up an OData service because of all those kind of benefits of the query and letting their customers then just use whatever client platform they wanted.

[Fritz] Right and save them the trouble of having to build a separate UI or separate interface [inaudible] to different Clients.

[Matt] Yep. Yes, with all the different requirements and everybody wanted to query different ways.

[Fritz] Great. Well it sounds like a very useful course and I hope everyone’s looking forward to it as much as I am. And I want to thank you Matt for taking the time. This is Matt Milner, with his new course OData Clients. Thanks again, Matt.

[Matt] Thanks, Fritz.

About the Author

is a Chief Architect specializing in large scale distributed system development and enterprise software processes. Paul has more than twenty years of development experience including being a former Microsoft MVP, a speaker at technical conferences such as Microsoft Tech-Ed and VSLive, and a published author. Prior to working on the Windows platform, he built software using a vast array of technologies including Java, Unix, C, and even OS/2.


Discussion