RESTful Services versus SOAP or XML-RPC

February 15, 2009

The purpose of this blog posting is a quick review, for myself, on the differences and the advantages and disadvantages of RESTful services versus SOAP or XML-RPC. When is it appropriate to be using RESTful services? When is it appropriate to use SOAP? Well, if you are consuming web services, the answer is pretty simple: Use whichever is appropriate for the service being published. You don’t really have much of a choice in that situation.
The next two circumstances deserve a little more attention. First, when you are both producer and consumer of the webservice, and second, when you are the producer of the webservice for one or more outside entities, possibly the public. Now, which do you use? Well, here’s the basic rundown on each, for comparison’s sake.

REST (REpresentational State Transfer) – ie. the object is represented by the URL

1) On the plus side, it is SIMPLE, and so requires less handholding for outside entities to make use of it, and it does not require any special tools.
2) It is lightweight, so less code is required, typically, and smaller data transfers (less XML overhead)
3) The results are human readable, in most cases.
-) On the downside, it is not supported by Apache Axis 1.4, which is the version used in ColdFusion 7.

SOAP (Simple Object Access Protocol) or XML-RPC (Remote Procedure Calls):
1) It can be simple, if you have the right tools.
2) It is strongly typed and explicit, essentially establishing a contract between the client code and the service provider.

The REST approach was embraced by David H. and is highlighted in his keynotes on Ruby on Rails. The virtues of REST are touted by Dave Thomas, the Pragmatic Programmer, and others. It tends to be the favored approach for developers in Ruby on Rails, PHP, and a signature prescription for a Web 2.0 style web application.

SOAP is more “old school”, and tends to be the favored approach by Java developers.

A new driver for the SOAP versus REST pro-con discussion is the widespread emergence of mobile phones with internet capability. The assumptions about connections and bandwidth usually assigned to desktop computers do not necessarily apply to mobile phones. So, the lower overhead of a RESTful approach does contribute to the argument for using REST rather than SOAP.

Both sides have good arguments behind their use. In general, though, the trend is moving away from SOAP and XML-RPC toward the more RESTful approach, largely due to the successes it has brought sites that use REST. In an culture where there is a strong sentiment toward SOAP, likely the case in an old Java shop, it may not be the battle that you wish to engage in.


Maintaining a Windows XP System

February 6, 2009

This is low level general purpose stuff, which may be off-topic, but hopefully will prove useful to somebody. I have had to re-locate these sites a couple of times, so at least, they remain here as a reference for me.
My adventures began with the purchase of a notebook computer with SATA drives about a year ago. The first thing to note is that the notebook shipped with Windows Vista. I requested Windows XP Professional, because, at the time, ColdFusion was not supported on a Vista system. It was going to cost me extra to get Windows XP, I was told. And, indeed, as I searched on other sites selling systems, they included the option to “downgrade” to XP Professional from Windows Vista. This was just one indicator that Windows Vista was a horrible mistake on Microsoft’s part, something that they would not soon live down. Indeed, a year or so later, on the Dell site, they are offering the option to “downgrade” to XP Pro from the pre-installed Vista OS. It is not special order. It is a checkbox on the order, more than a year after the release of the Vista OS.

clipped from Ad on Dell Site Feb 6, 2009

clipped from Ad on Dell Site Feb 6, 2009


Not that XP is perfect. I wouldn’t be making a point of capturing these links (scroll to the end, they are there, I am sure), if it weren’t for one glaring oddity of the Windows XP installation procedure. The Windows XP standard installation disc (Service Pack 2), does not include support for SATA drive controllers. That’s okay, there is a way to add drivers during install, if there are mass storage drivers which are needed. The Windows XP installer will prompt you to insert the floppy disc containing the drivers into your floppy drive. Fantastic. My notebook doesn’t have a floppy drive. Most notebooks nowdays don’t come with a floppy drive. Well, I thought, no problem, I’ll just put the drivers on a USB drive, or burn them on a CD. The installation is reading off a CD, so it must be able to read from a CD, right??? Wrong. The only way to supply it with drivers mid-install, is via a floppy drive.
The only remaining solution is to add the drivers to the Windows XP installer *before* the install begins. Which means hacking the installer, somehow, or hoping some clever PC techno-whiz has pre-hacked it, and left some nice notes or better yet, some utilities to help with the process… Well, much to my pleasant surprise, the wizards of the world had been hard at work and had done that and more.
First, there is the BART PE site to create a bootable windows CD, or USB stick,
then, using that work is the Ultimate Boot CD for Windows(tm). a bootable Windows CD with a collection of utilities.
Each of these detail the process of Slipstreaming the drivers (and service packs) into the windows install, and provide utilities to assist with the task.
Going beyond the service packs, and including the hotfixes and some custom registry tweaks is Ryans VM.
For a fairly comprehensive set of drivers included in the install package, the driverpacks site is a great resource, and includes a utility to build an installer with (very likely) all the drivers you require.
And finally, for a great reference, the Windows Unattended Install (not unintended install) site is a great source of information.

Really, I hope to not need to refer back to this… but I am sure I will.


Naming Conventions for Data Objects

January 25, 2009

One of the things that was at once striking to me about David H’s description of the Ruby on Rails recipe, in the book Agile Development with Rails, was his headfirst launch into the data object naming conventions. They were as follows (this is not complete. For a more complete list, see : http://rails.raaum.org/database-conventions.html ) :

1) Database table names are always to be plural – This reminds me of a project a number of years ago, when the database was being reorganized. Well, they had decided to name everything in the singular. Their thinking was, it is obvious that a table named USER would contain users, a table named ORDER would contain orders, and a table named LANGUAGE would contain languages. It was soon discovered, however, that all of these were reserved words in the RDBMS system we were switching to. The solution was to add a character at the end of the name. So, ORDER became ORDERR and USER became USERR, and so on. The simplicity of just using plural for the table names struck me as something to lean towards in most RDBMS environments.

2) Primary Identity Fields will be named id. I’ve seen many cases where the identity field is named like a foreign key would be. That has advantages, like when the field names are matched exactly, as some tools will do. But  there is nothing wrong with just “id” for the field name, and it is clear what this means.

3) Foreign Key fields will be named (singular table name ) + “_” + “id”

At a certain point, it becomes clear that the rules are in place to assist automatic generation of various pieces of the Rails framework. By simplifying the components and requiring them to adhere to strict naming rules, the framework is able to maximize its power while minimizing complexity. The human user of the framework is admonished to conform to strict guidelines, to enjoy the large benefit.

  These “strict guidelines” (there’s an oxymoron for you), are in support of the concept of favoring “convention over configuration.”  By clearly stating the assumptions and defaults of the underlying framework, the designers have eliminated the need for configuration files which would spell out the exact same details.  Most software development teams would opt to leave the defaults in the first place, making all of the configuration work basically wasted effort.  By adopting convention, and eliminating a large chunk of configuration time, a real quantifiable savings can be immediately realized.

Often, I am lamenting the lost opportunities in computing systems, for real accommodation of the user. I find myself in situations where I have to repeat my phone number to computer systems on the phone, when a network of connected systems should “remember” my phone number, and even pass it on to the agent at the destination of my call. All of that made even more laughable given the fact that we do not block caller id, so the called party has access to my phone number by default, and should not have to ask for it in the first place.  It should simply ask if the number I am calling from is the number associated with the account.

  I was installing a printer on my computer, and operating systems said it recognized a Networked HP 2610 and asked if I would like to use it. I said yes, or clicked yes, as the case may be. Then, on the next screen, I was asked to select a driver. And not just from HP drivers, but from a large assortment of possibilities. HP wasn’t even the default.

So, it leads me to think that perhaps, as I have seen before, there was simply not enough time to address all the issues at the end of the line. The software had to be shipped and besides, we have “online updates” now anyway, so it doesn’t have to be 100%. The engineers probably wanted to take care of these last details, but were pulled off onto another project, and a new team was brought in for support and post release development. Did they plan for this from the beginning? The project managers, I mean. Or did time escape them, as it does so many of us?

Is it possible that they spent a lot of time at the beginning of the project, trying to sort out naming conventions for their data objects, or untangling legacy integrations?  Or editing configuration files for frameworks?  Or, automating things a little bit, by generating the configuration files?  (Even with automation, these things take time to do).  Is it possible that the manager, not being able to read code, did not understand the significance of the efforts under the hood, and was anxious for results he/she could “see”, and cut these efforts short?  Is it possible that with some of the up front efforts out of the way, the underlying engine of the project basically together, that the focus could be returned to the customer, and better managing workflow related tasks?

I, for one, would join the chorus of those who point out the significance of the approach used by David H. in the Rails framework, rather than the specific language he utilized.  That said, isn’t the language itself a convention, and the act of using a different language, a sort of configuration?  Food for thought.


ColdFusion Unit Testing Frameworks

April 19, 2008

I am starting from scratch, putting in a unit testing framework, and working within the existing organization’s culture to introduce enough of the tool’s benefits without burdening the organization with too many of the downsides. Everything has a downside, a cost, or whatever you wish to call it. There is no free lunch.
The first steps were to gage the organization’s desire for the possible benefits of a unit testing framework, and their willingness to commit to moving forward, and accepting the cost. Having been in an “extreme” programming environment, which was only “extreme” in the sense that projects were “extremely” haphazard and “extremely” mismanaged, making sure that people are clear on what can be expected from implementing some test automation for unit testing and regression testing. Automated does not mean that you do nothing, and the machine does everything. It is difficult to know what people have been sold by the trade journals, and blogs, and common terms are often misappropriated.
The current environment is Flex/Actionscript and HTML, with a ColdFusion backend, with a ColdSpring framework. The goals are:
1) Automated testing with Ant, with performance metrics logged in a database, and pass/fail results e-mailed nightly to interested parties. (Thorough regression testing and reporting is key).
2) Eclipse Integration or reasonably nice Unit Runner, with easy ability to select individual tests, or test suites. (Easy sell to the engineers is key)
3) Mock Objects, automated test generation, anything to minimize the time impact on engineering, while maximizing the benefit, and keeping the program moving.

Sean Corfield had mentioned MXUnit fairly recently, so it seemed worth a look. Given the higher volume of activity on MXUnit, when compared to CFCUnit and CFUnit, it seemed like a reasonable way to go, for the best of all worlds for future itegrated add-ons. The first downside I will mention is that *MXUnit’s Eclipse Integration is Not Flex Builder 2.01 Compatible, or rather, not compatible with the version of Eclipse (3.11) that ships with Flex Builder 2.01*  This wasn’t super clear from the  MXUnit website, so it’s possible for an engineer to go through the installation instructions, and end up with a failing plug in.  This might not be a problem for some organizations, but may be for others.  Most of the team has not yet upgraded to FB 3, so it could be an issue at the moment.

  MXUnit’s Eclipse integration isn’t quite finished, or at least that’s how it felt for me.  It “worked”, but was lacking a few things that I thought were important.  An html or Flex based unit runner will do the trick though, so it’s not a huge problem.  The things which make the integrated unit runner a little less than usable, for me, are: 1) It seems to have no memory of past tests, so I would have to go through the selection process for the unit test every time; some way to save the available test cases/test suites would be desireable/required, 2) The test case selection process was awkward; I found myself unable to select a Test Case which I knew was present on more than one occasion;  This could be forgiven more easily, if it would remember the test cases I had selected in the past, but I was required to select/find the test case with each restart of Eclipse, or any time I wanted to switch tests

On the plus side, the ant unit runner does a great job, and it is clear how to modify the ant task.  The availability of the different test result formats, allows me to feed the results into a variety of destinations with ease.  The key item was logging test results and performance metrics, and not just logging into a text file, but logging into a database table, so it could be consulted for history.  I was able to hack this item in really easily using the cfquery output format for the testResults.

I should at least mention that CFUnit and CFCUnit are both seemingly capable frameworks.  I was able to set up integrated Eclipse (with Flex Builder 2.01!) unit tests, and test suites.  But the availability of the test Result Formats, and the volume of project activity, were enough to convince me.  That does not mean that I am right, nor does it mean it is the best choice for everyone.  But the software selection is but one small piece of the puzzlement.

ColdFusion Unit Testing Frameworks, and related info:

Next steps, automating test generation, designing effective unit tests, and Flex Unit testing frameworks.  I’ll post if anything interesting comes up.

 


Flash Creations – a quick catalog

April 19, 2008

With no clear category to post these in, but wanting to share with those who may visit, and bookmark for a reminder to myself, here are “galleries” of beautiful, and instructive, actionscript creations.  Most of these are provided along with source code.  A bestiary, gallery, or compendium, call it what you will.  (And some of these talk back, if your sound is turned on):

http://www.liquidjourney.com/flash/lq3.html

http://krazydad.com/bestiary/

http://www.robertpenner.com/index2.html

http://www.indivision.net/genomesea/

http://www.arseiam.com/index2.htm

http://www.generatorx.no/

http://www.levitated.net/daily/index.html