Monday, 31 March 2008

Rails Patch accepted!

I came across a Rails problem last week while writing the VAT validation plugin. So based on the open source principle of 'he who finds fixes' I submitted a patch, and it has been accepted!

It's nice to be part of the process.

Saturday, 29 March 2008

Why IT is perennially irritating - and what we can do about it

The levee of early adoption has been breached and the sea of banality is flooding in. It has been for a while, but now some of the pioneers are starting to notice a bit of a smell.

Is it that Web 2.0 has matured like a fine, but overly strong, stilton and is ready to take its place next to dotcom, client-server, outsourcing, windows, PC terminals, 4GLs and probably several others I've forgotten in the pantheon of IT panaceas.

I'm not sure whether I'm fortunate or unfortunate to have seen this process happen several times. Certainly it is very disheartening to see it happen all over again. But that is the way the economics of this business works - as it does for all service businesses. And that's due to a number of factors as I see it
  • The customer and the consumer are very often, if not always, different people. You are writing the software for the person who wants 'Ebay with knobs on' and only superficially for the person who is going to use it. The marketing fluff builds to get the customer to sign. Delivery becomes a matter of doing the minimum possible to get the customer to sign the thing off and pay.

  • Nobody knows if you are any good or not. So customers don't go for the best solution, they go for the one with the least perceived risk. You reduce perceived risk by fluffing up your marketing - hire more PhDs to sit in a corner and twiddle their thumbs, up the impressive graphics, work on your brand, give lots of slick superficial presentations and bridge away from the difficult questions to "The Big Picture (tm)". To pay for this you cut corners at the back-end where nobody will look. After all you will have sold out before the first power cut won't you.

  • Your 'tool' is not as good as you think it is and frankly nobody but you gives a monkeys about it. Why are you so sure it can't be replicated by a keen script-kiddy in a couple of weekends? And if it can, why do you think you have a sustainable business charging £10 per month for the privilege? Fancy graphics? Force of ego?

  • Most of the 'tools' out there are largely superficial. I got into this game to make people's lives easier by automating and eliminating drudgery. Yet the tools created seem to turn people either into Mrs Doyle ("some of us like drudgery"), or human versions of Pavlov's dogs - desperately waiting for the next IM or twitter to give meaning to their existence.

Andy Mitchell makes the points well in his blog post

However the most insidious problem IMHO is The Flip - the standard way of investment and detailed in exquisite form here. Capitalism is driven by those who own the capital, and the bottom line is if you have an external investor then you work for them and they are looking for a profit on the sale of your business - quickly. To quote "The business must be able to generate significant value within 2 years to provide an exit for investor."

There is no doubt it works, and as a side effect it actually does occasionally create something wonderful, but it is ultimately not fulfilling for those looking for a deeper meaning from what they do. As 37Signals point out - rightly in my view: "The sad fact is cashing in often begins to trump building a quality product."

So what can we do about it?

  • Get away from the focus on the product. In a modern development world products are easily replicable. Any product is merely an enabler for creating a service - a set of people and connections - and it is these people and connections that have the value, not the product. Concentrate on the people and their philosophy not the product.

  • Try to automate the process. One of the disturbing trends I see is humans used as the ultimate flexible middleware between niche point web applications. Find a way of getting the machines to do the hard work.

  • Start charging for what you are actually selling. Why do we sell the products with free support? The product has an incremental cost of zero, and the support involves expensive people. So charge for the support and give the product away for free. That way you can move to 'branded' individuals or branded small teams of individuals and they can charge more. Any decent architect could have designed The Gherkin, so why did they pay for Norman Foster?

  • Merge your customer and consumer. Try and make sure the person laying out the cash (or at least making the buying decision) is the one using your services. Concentrate on those markets where this applies.

  • Build your FY fund. It worked for Humphrey Bogart, it can work for you. If you have to earn something today then you are not in control of your destiny. You have no capital in a capitalist society and once again those that own it will be telling you what you can and can't do - whether you are employed, freelance or whatever. So if you're in an area where there is a rich seam of cash to be mined, then grit your teeth and mine it. Then put it to one side. The world will wait until you are ready.

  • Get good with money. It's always amazed me the number of people who are quite happy to do several hours overtime, but won't spend fifteen minutes to change their utility suppliers to a vastly cheaper offering. If you are building a capital sum so you can control your destiny then obviously it builds faster if it doesn't leak. Go learn how to plug your leaks. You probably don't have to go as far as I did (by training in accountancy) and I admit I have a genetic advantage when it comes to cost efficiency :-), but if you remember one thing, remember this: £15 saved is as much as £25 earned when you account for tax. (£33 if you access tax credits - seriously!).

  • Be the Investor. He who pays the piper calls the tune - always.

Getting round The Flip is a harder problem to solve. There has to be a model of operation that gets away from the short-termism inherent in The Flip with its obsession about capital value. There has to be some way of getting back to concentrating on income, cash flow and customers and making equity patient again. Thoughts:

  • Founders as partners, where partner is more an ownership mindset than a legal structure. In all other professional fields partnership is the primary model, where capital value is owned directly by the individual. Few in IT understand the partnership approach and the way capital value accrues in such a structure. Often what you find in IT is a pseudo partnership approach sat under a Limited Company.

  • Build one to throw away. Where you get involved in a capital project and use the proceeds of that to do what you really want to do - an income project. Ubuntu falls into this category.

  • Internal project. Where you build your product alongside your standard agency work and gradually convert over to an income business. 37Signals worked this way. I'm just not convinced that the 'tenner a month' software leasing model is sustainable in the medium term.

The one I like most at the moment is the Free Software network idea, where you get over the idea that you must hide the product from the world if you are to profit from it. Make it easy for those who are good at the partnering and branding thing to do their stuff in whatever niche they fancy. Sell the setup and the backup preferably on a branded individual basis; put development down as a marketing cost. White-Box Web 2 if you like.

It may be that the Flip and the OTT marketing it generates is the only way that works in IT. In which case you've just got to put up with it, or get out. Unfortunately it is not any better anywhere else, so I rather hope that something will drop out of this debate.

Let me know what you think.

Thursday, 27 March 2008

Checking for Active EU Vat Numbers in Rails with SOAP and REST

Rather than implementing checksums and the like for VAT numbers I've decided to go straight to the Internet database and check the number there. It is exposed as a soap service and the ActiveRecord code looks like this:

  #Use the SOAP checker on the Internet to see if the VAT number is live
#The driver is created on first use and cached
def active?
if valid?
@@vat_check_driver ||= create_vat_check_driver
result = @@vat_check_driver.checkVat(
:countryCode => country_code,
:vatNumber => identifier
)
end
result && result.valid == "true"
end

private

require "soap/wsdlDriver"
def create_vat_check_driver
wsdl = "http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl"
SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
end


'countrycode' and 'identifier' are the names of the ActiveRecord attributes containing respectively the 2 character ISO country code and the Vat number.

For a bit of mild amusement I translated this into a REST based collection sat on http://3accounts.co.uk/active_eu_vat_numbers so that you can get them using ActiveResource.

class ActiveEuVatNumber < ActiveResource::Base
self.site = "http://3accounts.co.uk"
end

ActiveEuVatNumber.find("gb123456789")


You'll get an ActiveResource exception if the record doesn't exist.

Wednesday, 26 March 2008

Validates As EU VAT Number Rails plugin published

I've extracted the validation routines into a plugin that checks an ActiveRecord attribute to see if it conforms to the correct format for a VAT number. It works with all the EU countries and is tested with real EU VAT numbers as harvested from the good ol' Interweb.

Install

Install via script/plugin

script/plugin install http://accounts4free.rubyforge.org/svn/plugins/validates_as_eu_vat_number


or use piston

piston import http://accounts4free.rubyforge.org/svn/plugins/validates_as_eu_vat_number


Usage

The plugin provides another validation helper validates_as_eu_vat_number which takes a set of attributes and an optional :with modifier that points to the attribute containing the country code, or a string containing the country code itself. If you don't use the :with modifier then the routine expects the country code to be the first two characters of the attribute itself, e.g:

  class VatNumber < ActiveRecord::Base
validates_as_eu_vat_number :full_vat_number
validates_as_eu_vat_number :vat_number,
:with => :country_code
end


In common with other validates plugins, this one takes the usual :if, :unless, :on, :message, :allow_nil and :allow_blank options provided by the underlying validation mechanism.

Documentation

The plugin has rdoc documentation included. Run rake within the plugin directory to create it.

Testing

ValidatesAsEuVatNumber has an extensive test suite created using Rspec and a lot of Googling for VAT numbers. The easiest way to run the test suite is to do rake spec:plugins from the root directory of the Rails application containing the plugin (and the rspec and rspec_on_rails plugins as well obviously).

Freebies

The plugin creates an EU module with a couple of constants in it.

EU::MEMBER_STATES_COUNTRY_CODES is an array containing the ISO code strings of all the EU member states.
EU::MEMBER_STATES_VAT_PICTURES is a hash indexed on the country code containing the Regular expression VAT pictures for every EU country .

Links

If you're looking for a VAT validator but not working with Rails then you might want to try this Javascript validator
And if you just want to check a VAT number to see if it is live, then use the online checker on Europa.

Bugs/Comments/Faint Praise

Let me know