Archive for the ‘Technology’ Category

Locked out of the Amazon Start-Up Challenge

Monday, September 17th, 2007

Last week Amazon announced “Start-Up Challenge“:

Amazon Web Services (AWS) is searching for the next hot start-up that is leveraging AWS to build its infrastructure and business.

Do you have a great idea or an existing application that uses services from AWS? Enter the AWS Start-Up Challenge to win $100,000 in cash and AWS credits, and receive an investment offer from Amazon.

This got me all excited because I LOVE AWS! I use S3 for backup  (both personal and for live database backups) and the message-queue service is forming up to be an integral part of my “Secret Project” architecture. The money would keep me rolling for 12 months at my current burn rate too.
So I just went to register and realised that I am locked out of the challenge because I am not a US resident.

 Curse my antipodean geography!

Mock testing with mocha

Wednesday, September 12th, 2007

Mocha is a library designed to let you mock objects in your test environment. It’s very useful for testing around external dependencies

Inside one of my controllers I am calling a SOAP Service:

message_result = SOAPService.send_message(message)

This leaves me with a problem in my functional test - external dependencies are not conduive to self-contained test. Enter Mocha to the rescue!

Mocha lets me create a stub for a method on any instance of my object. This means that I can intercept the calls in my test, without needing to touch the code inside my controller.

SOAPService.any_instance.stubs(:send_message).returns( MessageResult.new )
get :respond
assert_match(/1<\/status>/, @response.body)

The get :respond call above would normally invoke a SOAP call, but using any_instance.stubs(:send_message).returns( MessageResult.new ) means that the SOAPService.send_message method now will return a new MessageResult. My controller doesn’t care and now my functional test is tight and focussed, and tests the controller logic without the external dependency being a factor.

Did you find this Ruby on Rails article useful? Why not recommend Toby at Working With Rails?

RailsRumble: distro decisions decisions

Friday, September 7th, 2007

I received my Linode account for the Rails Rumble.

I logged in and the first thing I have to do is pick the Linux distro I want to install and use for the Rumble.

There are far too many options!

The available distros are:

  • Arch 0.7.1
  • Debian 4.0 (Etch)
  • Finnix 86.1
  • Ubuntu 6.06
  • Ubuntu 7.04
  • CentOS 5.0 (RHEL rebuild)
  • Fedora Core 6 (FC6)
  • Slackware 12.0 (-new-)
  • Mandrake 9.1 (Bamboo)
  • Gentoo Linux 2006.1

I’m not really a systems person … I know my way around Linux, but I don’t have a whole lot of experience setting a machine up from scratch. I’ve been lucky that for the last several years I’ve worked with truly awesome sys admins who take care of all this stuff for us.

So what to use?

I am leaning toward Ubuntu 6.06 (Dapper Drake) because it looks like there are some good tutorials around (I even think the Peepcode guys have been using Ubuntu for some of their work - it might be time to subscribe).

Any ideas are appreciated. I am definitely going to learn a lot this weekend.

Facebook Apps are very hard to debug

Tuesday, September 4th, 2007

I am working on a Facebook Application for a client and although the Facebook API itself is rich and elegant, debugging the app is very difficult. Facebook uses it’s own markup called FBML, which is pulled from your app, translated into HTML and Facebook commands and then displayed. This means that applications have to actually run on a remote server that is accesible by the Facebook back-end.

The development process reminds me of the halycon days of my J2EE days (test,fix,build,jar,war,ear,undeploy,waitdeploy,wait,swear):

  1. Make minor change in code
  2. Push the change to the server
  3. Undeploy the application from the test Facebook profile
    1. Remove application
    2. Delete all sessions and cookies
    3. Clear the local database
  4. Redeploy the application
  5. Find another ******** problem!
  6. Repeat

There has to be an easier way. I am going to look at some DNS magic so I can develop on my local machine and point Facebook to it. Problem with that, of course, is you need to reconfigure the application so the client can see it on a public server. Or run your dev box as public a server.

How not to hire …

Friday, August 31st, 2007

37 Signals has a post about Writing Better Help Wanted Ads, which has some excellent advice and a summary of some ideas from around the blogospehere.

I have had some pretty bad (and sometimes actually rude) encounters recently as a Freelance Developer.

A fairly typical example was this response to my considered, thoughtful and detailed application for an advertised position:

I am looking for freelance web programmers who are proficient in the
following:
-HTML, CSS, JavaScript and Flash up to $20/hour
-with PHP, MySQL and Linux, and willing to learn Ruby on Rails up to
$22/hour
-with Ruby on Rails _experience_ up to $25/hour

I prefer programmers with Ruby on Rails experience, but will consider
you if you have _very_ strong skills in the first two items.

You must be able to work under tight deadlines. I prefer people who are
proactive and have a good design sense. You must be a proficient
programmer. You must be willing to take design direction, and work under
an established set of procedures. Work availability varies.

I read this as:

  1. You must be cheap
  2. You must have lots of experience
  3. You must not value that experience (see points 2 via 1)
  4. You must work really hard and under pressure
  5. You must do what we tell you
  6. You still may not get any actual work

There’s no mention of the types of work, the flavour of the projects, or why I might be interested.

On top of all this, it was instantly evident that the responder hadn’t read my application - I had actually detailed my most recent experience with Rails (and other relevant technologies) on several “real-world” projects.

The fact is:

If you are good at your job, you can choose the work you do.

Finding good people is hard, regardless of industry, but particularly in software development. The employment or negotiation process is as much about the potential employer selling the role as it is about me proving I am good at what I do.

I’m certainly not saying you need to treat me like a God of Code, but perhaps you should actually read my job application …

Snippets: dynamic CSS classes

Tuesday, August 14th, 2007

I found myself over the weekend needing to create CSS classes dynamically. Not just add a class to a DOM element, which is easy, but actually building a CSS class based on user input and attaching it to selected elements.

Proved to be harder than it sounds.

  var green = {
    color: "#00FF00"
  };

  Object.extend(Element.Methods, {
    setClass:function(element, className) {
      element = $(element);
      element.addClassName(className);
      klass = eval(className);
      for (var property in klass) {
        element.style[property] = klass[property];
      }
    }
  });
  Element.addMethods();

  function changeClass() {
    elements = document.getElementsByClassName("red");
    elements.each(function(e) {
      e.setClass("green");
    });
  }

This code lets you specify a “CSS Class” as a Javascript object. Then you can use the Element.setClass to add the properties to the element style. The changeClass() function finds all the “red” elements and sets them to use the “green” Virtual CSS class. I use addClassName to add the new class name, which may cause conflicts with existing CSS classes.

The name is added because I was thinking that I would need a way to remove the class. At the moment I don’t, but it wouldn’t be all that hard to implement. You would store the element’s original properties and remove the class name, and reset all the overridden styles. The disadvantage of what I am doing is overriding the styles at the element level - these will take precedence in CSS.

I am positive there is an easier way of doing this with Prototype and Scriptaculous, so let me know if find one. I looked at interacting with the styles directly using the DOM, but it’s pretty messy.

Amazon Flexible Payment Services

Tuesday, August 7th, 2007

Amazon continues to lead the way into a service-driven future with the release of the Amazon Flexible Payments Service:

Amazon Flexible Payments Service (Amazon FPS) is the first payments service designed from the ground up specifically for developers. The set of web services APIs allows the movement of money between any two entities, humans or computers. It is built on top of Amazon’s reliable and scalable payment infrastructure.

FPS supports micro-payments and the fees look very competitive.

Payments are the last piece of the service puzzle and with the release Amazon now has a complete Operating System for services.

Everything you know about scaling is wrong

Friday, August 3rd, 2007

Scalability of the favourite argument topics of the technically inclined. Having developed some fantastic, all-singing, all-dancing, user-generated social networking Web 2.0 platform*, someone will invariably ask:

“Oh, you used {LANGUAGE X}”
“Will it scale?”

You have to imagine the slightly derisive tone for yourself.

Trouble is, languages don’t scale, systems do.

Assessing scalability on the basis of a particular programming language is like saying to someone who is writing an Encyclopedia: “English won’t scale”.

Systems scale.

If you wrote your Encyclopedia the same way you wrote your product brochure, it wouldn’t scale - small page format, lots of pictures, minimal text with plenty of whitespace. If you write an Encyclopedia, you need to develop a system for handling the information - table of contents, indexing, cross referencing, multiple volumes, alphabetical organisation, thin paper, multiple columns of text, readable fonts.

The language used to write the Encyclopedia or Brochure is secondary to the system that delivers it.

The same is true of Web Applications.

Languages are irrelevant to scale and frameworks (being very close to languages and essentially an extension) only have a minimal impact.

I moved to Ruby on Rails from PHP. The standard argument against Rails from PHP developers is that “Rails won’t scale”**. However, this focus misses the point entirely. I have seen arguments from PHP developers who suggest using single quote for strings ‘ rather than double quotes “, because single quotes parse faster in PHP. This thinking is radically broken.

Scalability has nothing to do with processing performance at the language level.

Scalability is about the system as a whole.

At some point as an application scales, it will invariably require multiple servers and multiple databases, and there is very little any language or framework can do to mitigate this requirement. These requirements are system level, not language level - your only real option is to be ready to build your system out accordingly as it grows. The only trouble you find is when you have made decisions early on that limit the way your application can grow out.

As a corrolary to the scaling issue, my final point is this:

You aren’t going to scale

Call me cynical, call me pessimistic, but lots of people build for scale prematurely.

The focus should always be on creating great user experience.

Unless you have the load to warrant a particular system decision you should not be creating that system (but always within the framework of sensible architectural decisions). Scaling issues are often unpredictable (you don’t know your load profile until you hit it, or are hit by it) but worrying about them before you have to wastes valuable developer resources on infrastructure rather than the interface.

In the Web 2.0 world, scaling problems are a sign of success, but the focus should be on the user, not the system.

* We don’t develop applications or, god forbid, sites anymore, we develop platforms.

** I am aware the argument is a bit confused here, because PHP is compared to Rails, when Rail is a framework based on the Ruby Language and should be compared to a PHP framework like CakePHP.

Multitasking is evil

Wednesday, August 1st, 2007

Agile in Action has some very good reasons not to multitask.

I have a larger post on this issue, but I have some other stuff to do first.

Lies, Damned Lies, and Equity

Monday, July 30th, 2007

I keep getting offers to work on projects.

This would be great, but most of these project offers are in exchange Equity: “We have a great idea, help us implement it and we’ll give you a piece of the profits down the track”.

Unfortunately, work for equity in practice turns out to mean work for nothing.

Maybe it’s just me, but I’ve had equity in a number of companies, mostly when I was young and inexperienced and Dot Com Exuberance was the style of the time. Unfortunately for me, none of this equity ever turned into anything useful. You know, like actual cold hard cash.  In fact, in at least one case the lure of equity kept me working long past the use-by date of the company.

You need to think very carefully before taking on projects for equity - your effort may never be rewarded.

The harsh reality of the startup world is that most companies will fail.

Startups  that don’t fail will probably not be as big as they promised.

It’s hard to predict the next Google.

If you’re  software developer, it’s very easy to think that it’s all about having a great product - but if you build it they may not come.  It’s important to remembre that it’s not necessarily all about a great product, you also need great marketing, and most importantly of all, incredible luck.

So I may have just turned the next Google down, but I ‘m betting that I haven’t. And I have to focus on my own startup efforts. After all, maybe I’m building the next Google …