InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Dynamic C# in Action

Posted by Jonathan Allen on Nov 10, 2008

Sections
Architecture & Design,
Development,
Enterprise Architecture
Topics
SOA ,
.NET ,
Dynamic Languages ,
REST
Tags
C#

REST-style web service calls have a significant advantage over SOAP based ones in that they do not require tooling support. This makes them particularly easy to call from languages such as Ruby or Python. Unfortunately, the same cannot be said for C#, where the lack of tooling works against the developer.

The reason for this difference is dynamic typing. Languages like Ruby and Python can turn JSON and XML-based results directly into an object model. This can then be accessed using each languages standard method and property syntax. For languages like C#, no such mapping is possible without knowing ahead of time what they object graph is going to look like. This involves a tedious and error-prone process of hand-coding the necessary classes and parsing logic.

With C# 4, all this goes away. By combining it with Nikhil Kothari's Dynamic Rest project, C# and VB developers can get the same clean syntax that the dynamic programmers have come to expect. Since it is based on the early preview, there are some limitations,

Note that in the CTP, there isn't any support for indexers used against dynamic types, which gets in the way of normal array syntax. Hence the workaround above using Item(). However, I've been told, that support for indexing into dynamic types already exists in later builds.

In a follow-up post Nikhil demonstrates using C# 4 to call Amazon and Flickr services.

  • This article is part of a featured topic series on SOA
Myth - SOAP needs tooling by Paul Fremantle Posted
Re: Myth - SOAP needs tooling by Jonathan Allen Posted
  1. Back to top

    Myth - SOAP needs tooling

    by Paul Fremantle

    It is a complete myth that SOAP requires tooling while REST doesn't. They both require you to read and write some data representation - whether its XML or JSon doesn't really matter. If you have an XML parser or toolkit you can create a SOAP message just as easily as you can do REST. Tooling helps, but tooling can help with REST too.

    Paul Fremantle, CTO, WSO2

  2. Back to top

    Re: Myth - SOAP needs tooling

    by Jonathan Allen

    Honestly though, how often do you people actually trying to hand-roll SOAP messages? Sure it can be done, but the complexity level is so high it just doesn't make sense to do so.

Educational Content

Jesper Boeg on Priming Kanban

In this interview, Jesper Boeg, author of the new InfoQ book – Priming Kanban, discusses the keys to using Kanban effectively, and how to get started if you are currently using other approaches.

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.