Archive for the ‘Ruby on Rails’ Category

South East IEP

Tuesday, March 16th, 2010

Improvement and Efficiency South East (IESE) is one of nine Regional Improvement and Efficiency Partnerships (RIEPs) and was established to work with the south east’s 74 local authorities and 9 fire authorities to facilitate and fund projects that will drive efficiencies and service improvements across the region.

Themes include adult social care and services for children, capacity building , construction and asset management, corporate transformation, performance improvement, procurement, progress through partnership and waste resource management.

In year one, IESE enabled councils in the south east to make £18.5million cashable savings and estimates over £40m cashable savings in year two. IESE is governed democratically by members across the south east and managed by a south east chief executives’ board.

We worked with them to create a new, more engaging and easy to use site that allows members of the public and local councilors to quickly access the latest tools and news available.

From the ridiculous to the sublime: Moving from PHP to Ruby on Rails

Friday, May 22nd, 2009

Introduction

I’ve been a PHP developer for many years. From my earliest little scripts to our latest fully-fledged web 2.0 apps, PHP has been at the heart of it all. I can read, write, and debug PHP faster than Paris Hilton. If a client wants a new website with any kind of functionality beyond XHTML etc. then PHP it was. I could do everything I wanted, and anything I couldn’t do there’s a billion tutorials and classes on the internet.

Yet, recently its not been that great. Big apps are taking longer and longer to debug or roll out new features. Despite writing nice commented object-orientated code, I’m still re-inventing the wheel too frequently for my liking.

Now, these are two things I hate doing. Really do not enjoy. At all. Its summer, there’s a beer festival in Cambridge, and loads of great music. Working freelance, I’m paid for results, not for now long it takes me to work out why PHP didn’t do what the manual said it would.

I tried to get round this by standardising all my classes and generic server structure, and guess what? It started to look pretty much like a Rails app. Oh dear, time to think seriously. Before getting into the Ruby though, I did know of Ruby a year or two ago, but never made the switch (in truth, I took one look and left). Why?

Why PHP developers do not switch to Ruby

  1. I know PHP, I don’t know Ruby: clients need the project delivered now. This one is pretty relevant to any fundamental change. You have projects on the go, or are due soon, and you know PHP – it works. Even at the planning stage, I can usually get a very accurate estimate of the time a PHP project will take to develop. Ruby has many, many unknowns. Will it support all the things I’ve promised the client? How long will a project take? I can’t charge my clients for the extra time it takes me to learn a new language.
  2. Losing control. PHP lets me control everything; right down to the errors it gives me when it doesn’t work. I know what every part of my app is doing, because I wrote it. Ruby seems to do a lot of stuff for me – how does it know what I’m wanting to do?
  3. It seems too easy. This, I must admit, was my main reason for putting it off. Back when I first started learning PHP (and C, C++ for that matter), your first application was called ‘Hello World’; it did nothing but output the words ‘hello world’. Now with Ruby, your first app is a blog. I mean really, what’s all that about. A blog app should be hundreds of lines of code even for the basics, let alone validation, displaying and so on. Sorry, but anything that can give me a blog app out the box is like one of those Nigerian email scams…

Yet despite these hesitations, I took the leap and got stuck in. And you know what, it was magic.

There were the usual initiation woes – like the first time I switched to Mac, or the first time I played the Viola – were all the ability and creativity you had on your previous system suddenly get taken away, and you’re reduced to scrabbling around to get things working. But, these things are inevitable, so I kept going.

Good start-up tutorials

  1. Ruby on Rails Guides (http://guides.rubyonrails.org/). Fantastic overview of the basics. A lot of it you’ll get through quickly (the MVC model, for example, is simply a nice logical extension of good coding practice in any language), but it does get you immersed.
  2. Railscasts – Free Ruby on Rails Screencasts (http://railscasts.com/). This guy’s a genius. I’ve never been a huge fan of screencasts, but I have to say, he’s got a clear simple solution for all the common features you might need: authentication, e-commerce, cms etc.
  3. Learning Ruby (http://www.math.umd.edu/~dcarrera/ruby/0.3/). Rails is of course more a framework than a language; Ruby is the actual language behind it all. This is probably the biggest learn: all the new syntax and control flows. The concepts behind Rails are probably pretty clear to an experienced developer, it’s the language that’s different.

To finish then, I’ve written a list of the top five tips for PHP developers switching to Ruby. These are the points I wish I new before I started (or maybe I don’t, I certainly learnt a lot doing them the wrong way first)…

Key points for PHP developers:

  1. Rails wants you to do all the things your mother always told you. Get into the groove of a Rails App – it wants you to write DRY code, separate your models, controllers and views, write testing code, and so on. Go with it, don’t fight it.
  2. Don’t micro manage. Rails, for better or worse, takes care of a lot of stuff behind the scenes. Its not the perfect solution for every project, but if you think its right for you, then let Rails do the heavy lifting for you.
  3. Trust the syntax. I know it feels dirty and naked not ending each line with a nice ‘;’, but apparently the world doesn’t come to an end if you don’t. Write your code like natural language, then tidy it up a bit. It’ll probably work.
  4. Don’t re-invent the wheel, go for good gems. There’s a thousand brilliant gems out there to do many things you could want your app to do: restful_authentication, ActiveMerchant, acts_as_tree, and so on. Use them, and spend more time developing rather than re-inventing.
  5. Don’t kick yourself too hard… You only wasted hours of your life debugging poor PHP code.