Archive for category Ruby

Tech Ed EMEA 2008 Day One

The keynote speech delivered by the ever-enthusiastic Jason Zander, as usual, promised and delivered peeks into forthcoming Microsoft products. In this case, pre-alpha versions of both Visual Studio 2010 and the much awaited Windows 7.
Read the rest of this entry »

, , ,

Leave a Comment

TheServerSide Java Symposium, Barcelona: Day 1

The [tag]TSSJS[/tag] kicked off today in not so sunny Barcelona! I’ve been here since Saturday enjoying the sights and sounds of what must be one of the most beautiful cities in Europe. The weather so far has been fantastic but not so today; hence I don’t mind that much spending the day in sitting in conference rooms listening to wise and learned individuals instead of strolling through this magnificent city.

Read the rest of this entry »

2 Comments

Amazon Web Services (EC2 & S3) – The Future of Data Centre Computing? Part 1

On the back of an article published by CNet news.com on Sun CTO’s, Greg Papadopoulos, assertion that “the world only needs five computers”, DSI has taken the time step back and look at what Amazon, surely a strong candidate for one of the five, is offering on the market today in terms of processing power on demand.

Read the rest of this entry »

5 Comments

RailsConf 2006 – Day 2

RailsConf 2006 Day 2

Ajax on Rails

“… to quote one of the eminent thinkers of our time, Paris Hilton, ‘That’s hot’” — Justin Gehtland

I’m always wary of people who talk about ajax within the context of a particular back end. Ajax shouldn’t care about what back-end its talking to, so I almost skipped this session. This wasn’t really about ajax, prototype and script.aclio.us were mentioned, but that was about it. He went through what rails can do for you from an ajax perspective without you having to write any javascript. He did acknowledge that

“This is normally a bad thing”

but argued that it is ok in this case as the javascript being generated can be viewed and edited, as can the code that is generating the javascript. Also the javascript being generated is clean. I still think if you want to get serious about Ajax your going to have to bit the bullet and learn javascript properly, but you can get a few ajaxian things done here.

They moved on to demo a replacement for scaffold that uses ajax. It’s called streamline and they will be open sourcing it about a month from now (basically ASAP). I believe it will push Rails way beyond where it is now. It’ll be even harder to ignore.

The only session worth talking about after that was “Using Rails on Legacy Database Schemas with iBatis for Ruby”. Very quickly, iBatis follows the “data mapper” pattern vs the ActiveRecord pattern used in Rails.

“Active Record leverages simplicity,
Data Mapper tackles complexity.”

What they have done here is very slick. You can write your own SQL and create mappings to build objects out of the ResultSet you get back. It then hands these objects off to ActiveRecord in Rails and Rails in none the wiser. The validation in your model still works the same way. However they warn you not to underestimate how much SQL you will have to write. If it is at all possible to do it the ActiveRecord way, they recommend doing that. Chad Fowler has been credited with summing it up best.

“I like what you’re doing, but I hope I never have to use it”

Next up, Mike Clark again, (he’s Java free for 15 months and 17 day now). They have opened up the three rooms into one again (yea, it’s a small conference) so there is no choice everybody is attending this session. I think it is indicative of the Rails comunity that they want (or expected) everyone to attend this session. Testing is at the core of Rails, when you create a Rails project; the test harness is already in place, making you feel guilty about not writing tests. This is what I love about Rails and indeed Ruby. It encourages and rewards you for doing the right thing. If your primary key is an auto-incrementing integer call id, you don’t have any code to write, if not you have to do some stuff, but more importantly you have to ask yourself why not. It educates you, but still gives you the choice. We get an overview of the five types of test that every rails app get the infrastructure for the moment it is created. unit for testing the model, fixtures for placing data in the db to test against, functional for testing controllers (without a web server running) and integration for user stories. This seem to end up heading towards a DSL and from what I saw would fit (on pun intended) very well with fit.

The final talk before the auspicious DHH. “Homesteading” This was a strange one, was a comparison between the Homesteading bill in the 1800 in America and the web today. At time it was like a religous sermon and at one point when he was talking about time a quote from furturama pop into my head

“Now you’ve watch it, you can’t unwatch it”

essentially he was encouraging people to start small companies out there on the world wild web.

The final session of the day was David Heinemeier Hansson (DHH). He talked about a CRUD constraint world.

“CRUD has a bad name”

He gave a few examples of using CRUD arguing that, like test driven design is more about design than testing, developing using only CRUD is more an aspiration or design technique. The first example he gave was groups and users. Users have to be added to groups or vice versa. If you add membership to the domain then simple CRUD operations on membership remove the need for a complex many-to-many relationship between group and user. This is covered well by Evans in Domain Driven Design.

Another advantage of limiting yourself to CRUD is the controller is greatly simplified. Most of the time you can get away with create, show, update and destroy.

“How I learned to stop worrying and love the CRUD”

And this advantage can be pushed ever further. Take HTTP for example. The spec defines a number of methods to be preformed on the object defined by the URL. GET and POST are well known as they are supported in HTML. However if you add PUT and DELETE you have the basic CRUD operations. This simplifies your URLs

POST /people/create
GET /people/show/1
POST /people/update/1
POST /people/destroy/1

Can become

POST /people
GET /people/1
PUT /people/1
DELETE /people/1

This lead to the introduction of ActiveResource. Taking all the advantages that Rails has exploited from ActiveRecord and applying them to web apps via HTTP instead of DB via a database connection. The whole web opens up as a potential resource for your application. This is the direction DHH see Rails heading.

Leave a Comment

RailsConf 2006 – Day 1

“Welcome to the largest gathering of rails developers in the know universe… ever.” — Rick Kilmer

That’s how it started, and looking around it’s an interesting bunch of people. Not that I expected anything else. For example, there are more MacBook’s here than your average Apple Store. I’m not sure if it’s a good sign for Apple or a bad sign for Rails or vice versa (for the moment lets go with “Early Adopters”). Anyway, after a quick rundown of the sponsors the first keynote speakers, Dave Thomas, was introduced.

Dave Thomas, began with Google. Starting with a search on “Ruby on Rails”, pointing out 21 million hits, the number of advertisers and the different type of advertisments. To futher his point we saw that rails downloads has passed the half million mark and he compared, using Google Trends, the populatiry of Rails vs. some of the big names (Websphere, jBoss) and technoloiges (PHP and one that’s a little closer to home for us at DeCare, Spring). He went on to outline the problems he sees in Rails that need to get fixed to enable Rails to make it in the main stream.

  • Data Integration — Data Integration needs take more advantage of the schema if it is to be truly DRY. This like auto validation and foreign key support
  • CRUD — Scaffold is not enough, it needs to be more AJAX.

    [scaffold] has to do better than the old 3270, ‘fill in the form, hit send, and get the result’

  • Deployment — should be a two phase process, to let developer do what they do best, and system admins do what they do best.

After a short break the days sessions began.

Mike Clark, author of Pragmatic Project Automation and contributor to Agile Web Development with Rails, introduced “Capistrano” by Jamis Buck. Interestingly, he started the session with

“Hi I’m Mike Clark and I have been Java free form 15 months and 16 days.”

These guys have left Java behind.

Capistrano is a tool for automating application deployment. It uses a single, simple (5 or 6 line) recipe file to describe your setup and everything after that is a done with single commands. Deploying to your running application on multiple servers,
cap deploy

This gets the latest code from your repository, puts it on the servers and restarts them where necesssary. Did something wrong?
cap rollback

Want to disable the website for a while and put up a message page for the users

cap web_disable

Developers regularly loose the afternoon to these type of task. In the rollback scenario, part of the evening/night too. Extendibility? You can define your own tasks (similar to make or rake) and roles on which they will run. There are before and after hooks for task as well (e.g. copying the passwords file from a secure location after a deploy).

“Capistrano, it’s shoes for the cobbler’s children.”

By the way, this is not limited to Rails, or even Ruby for that matter. There are already people using it for PHP deploys and it has been used to setup new machines being added to clusters (not exactly what it was made for, but it works). If you find yourself spending time on deployment this is worth a look.

The next three sessions I went to where not great. ‘Meanwhile, In the rest of the World…’ was basically about usability and the danger of alienating your users, who probably are not as web savvy as you expect. (What’s a tag/RSS feed?). ‘Monitoring Rails Apps in Production’ was basically a product demo, but they sponsored “Why the Lucky Stiff and the Thirsty Cups” so they can be forgiven. Finally Amy Hoy’s ‘Overcoming Scaffolding Addiction’ was a bit basic. She went over how to solve the initial problems you encounter when you first use Rails.

Next up was Martin Fowler.

“I haven’t used Ruby on Rails”

A strange way for a keynote speaker at RailsConf to start. He went over the things he likes about Rails:

* Opinionated Software — it has strong opinions on what it believes is right and makes this easy.
* ActiveRecord — A pattern he considered interesting, but not that important, has gone so much further that he expected

“… never imagined an Active Record implementation as good…”

* Agile — Because of its ease, developing software with a customer becomes more conversational.
* Quick and Clean — The choice “fast or well designed” is a false choice.

He talked about software development in general and how Rails was not a framework for everything. In fact one framework that will do everything is a disaster.

“Rail should be so simple that there is no point having a conference about it … Rails will have succeeded when RubyConf goes away”

The final Keynote speaker of the day Paul Gramham

“I’m going to contradict the Old Testament and Yoda”

he talked about working in the margins, about all the companies (Apple, Microsoft, HP) that came from the margins and the advantages of being on the outside. On his website he describes himself as an essayist. Everything there is both worthwhile and enjoyable to read. His keynote will be up there soon, so I’m not going to do it any more harm. In the meantime, there is a good essay on Web 2.0.

Finally, “Why the Luck Stiff and the Thirsty Cups”. This was probably the strangest thing I have seen in a conference, or a concert for that matter. Part ruby enthusiast, part musician, part comedian. I’m not sure I followed everything that was going on (it’s 4am Irish time) but I don’t think anyone else did either.

Noel

2 Comments

Convention over Configuration

Henry Ford, founder of the Ford Motor Company in 1903, had a great philosophy. Get the laziest man to do a job and he’ll find the quickest way to do it. It turns the negativity of laziness on it’s head and turns it into something positive.

Laziness is not a bad thing in Software Development either, it turns out. I say this because like most people, I am lazy. I don’t like to write excessive code and I don’t like too much of a configuration overhead in my frameworks. It slows my creative process. That’s why I am an advocate of [tag]Convention over Configuration[/tag].

Read the rest of this entry »

Leave a Comment

Follow

Get every new post delivered to your Inbox.