Monday, March 7, 2011

Crafting Rails Applications Review

Jose Valim is well known in the Rails community for writing a lot of code and being on the Rails core team. He's also to blame for Inherited Resources a plugin that I've seen be more horribly misused than any other. He's one of the most qualified people you could get talking about some of the more advanced tricks that are present in Rails these days and Crafting Rails Applications really does cover a lot of ground in intimate detail.

Crafting Rails Applications: Expert Practices for Everyday Rails Development

Crafting Rails Applications is a tough book to review, there's a lot of really good information in it that can't be found anywhere else short of reading through the Rails source and trying to work out what's happening. But, anyone who really is going to get a lot out of the book is going to end up reading a lot of the source anyway. A good deal of the information in it will be of more use to people creating plugins and engines than the general run of the mill development people involve themselves in. This may be a reflection of Rails maturing as a framework in that it's starting to really support expert level content being published as books rather than disparate blog posts.

The book covers a wide array of the new features in Rails 3, but unfortunately it isn't particularly well organised making it difficult to use as a reference book. Much of the book is spent examining the status of various features of the rails rendering stack, this is interesting information and there's use for it when building something like a CMS, but outside of that I can't see it being used for that very much. Indeed, of the topics that are explicitly addressed I have only needed one of them in the past(Building a translation module for kete using mongomapper)

On the other hand, throughout the book there are lots of little tidbits and functions of Rails that I did appreciate learning and will use in the future. The poor organisation makes this a book to read with a notebook or sticky notes at hand to keep track of things that interest you. And the section of creating custom responders in particular was an interest addition that I'd quite like to try for cleaning up code.

The book suggested layering custom responders on top of custom renders as a powerful way of tidying things up. That might have been the aim in tying things together but I think for most development shops that would lead to entirely too much magic and the code becoming quite opaque to less experienced developers. Worthwhile if you're writing a plugin that needs the powerful generic solution, but not something I want to see everyone using.

One particularly useful bit of coverage is Rails engines, they aren't covered in any section in a particularly focused fashion but are used a lot and the demonstration 'Enginex' gem helps with creating them. If you've been wanting to work with engines this is probably the best overview of them that has been published so far, although that is perhaps more of an indictment of current resources than anything else, hopefully some of the upcoming rails books will deal with them more explicitly.

Is it worth reading? Yes, but there are a lot of other books that you should definitely have read first before this gets to the top of the reading pile. If you're doing a lot of work with plugins or gems, or one of the chapter headings jumps out at you as something you need to do soon, then pick it up with haste. But if it's just on your reading list out of interest then in the Ruby world Metaprogramming Ruby is a more important "advanced" book and I'd also suggest reading more broadly in related technologies before hitting this book.

Sunday, February 20, 2011

Webstock 2011

Webstock is a weird kind of conference. I enjoy it a lot, but it isn't all that practical. I'm impressed by the number of people who convince their jobs to pay for them to go given that it mostly suggests quitting, starting a startup or becoming a musician. There are some more practical talks mixed in there though; they're the ones I enjoy least.

Frank Chimero opened the conference with a talk about the importance of story in content of any type. And the number of really good talks that were more story than collection of useful cool things really reinforced this message. Unfortunately he says his favourite book is Catcher in the Rye, so I can't approve of him as a person.

One of the major draws for me at the event this year was Jason Cohen as I've been reading his Smart Bear blog for a couple of years now. He didn't disappoint. Giving a humble tale of his experiences with learning how to do the non-geeky portions of a startup. From dealing with shark-like salesmen trying to join his company and take %50 for his troubles, to learning to sell himself and the misplaced feeling of being in a room where they say, "Hey did you see the big game last night", and know which game it was. Jason is one of the best examples of a successful solo founder who still comes across as completely geeky.

The best story of Webstock was probably Peter Sunde, the tales of the pirate bay would fit perfectly well in some kind of surrealist novel. Featuring lines such as, "There was a private investigator following Hans for 4 weeks. Saw him once. He doesn't go out much" and "We tried buying a country. It's a thing we do when we're bored". Sunde's story is completely insane and really shows how unique the pirate bay has been in it's place in internet history. Sunde's latest project, flattr is a very interesting answer to the problems that all the record labels raise regarding artists losing money.

Sunde being there to talk about flattr was particularly well timed as when I asked Amanda Palmer the day before about what she wanted on the internet as a musician, she responded by speaking about the need for some way to perform the equivalent of busking online. Even though her attempt at busking in Wellington only made her a dollar, perhaps not the best endorsement of the business model. She did manage to crowd surf in the middle of civic square though.

The other speakers were all very good and covered a wide array of information and good stories. With the final talk being Merlin Mann giving a very thoughtful talk about things people are scared of. A surprisingly downbeat talk to end on, but one that really rounded out webstock nicely and made it feel like the talks had been crafted to mesh together better than anyone had probably really intended. It was a good thing that it was to be follow with lots of free alcohol though.

Wrapping up Webstock with an Amanda Palmer and Jason Webley gig was very successful. They have a surprisingly large number of very geeky tunes that I don't really notice when I'm just listening to their albums at other times. And Amanda Palmer dedicating a performance of Pirate Jenny to Peter Sunde and the Pirate Bay is all kinds of badass.

Thursday, December 30, 2010

Goals for 2011

Release Rabid Tech's first app.

Contribute to more open source.

Have Rails Camp NZ go well and also make it to the Aussie ones again.

Start building up some more passive income streams, small weekend apps that actually monetize etc. I have a new todo app idea that I'll have a look at building sometime soonish(The todo app market is clearly not saturated enough).

Edit my Nanowrimo novel from this year and look at trying to actually finish it. We've got a decent bunch of people carrying on from nano this year so might be able to get some more momentum behind it this year. My writing has improved each year as well.

Read more and widely, particularly:
  • Some Proust
  • One of Chinese four great classic novels, probably Dream of the Red Chamber given I already have some familiarity with Romance of the Three Kingdoms and Water Margin
  • More History in the areas I'm unfamiliar with. Byzantine to start with.
  • Finish Structure and Interpretation of Computer Programs including most of the excercises.
  • More Steinbeck
  • Godel, Escher, Bach: An Eternal Golden Braid - I've been meaning to read this for ages.
  • A few more biographies - I really enjoyed Richard Branson's this year.
  • My usual mixture of Sci Fi and Fantasy.
Blog more - at least twice monthly.

Watch more good movies, with a minor focus on getting up to a convincingly large portion of the imdb top 250 list. I'm up to having watched 112 of them so far and I'm finding the more obscure or older films that place on the list to be particularly enjoyable.

Do some more teaching Rails to people, either mentoring or more workshops.

2010 Achievements

A few of the interesting things I did in 2010 in more or less chronological order.
  • Started off flat out for the initial release of Sponsafier. By far the highest traffic site I've worked on with peaks of 26000 hits per minute.
  • linux.conf.au ate up a week and had lots of interesting things, including the first time I came across Albany High school and their awesome open source infrastructure.
  • Had an intra-office showdown between myself and Mike Lowery on Agile Bob's agile question contest. Plenty of trash-talking was had. In the end I came out victorious on the basis of being more novel and/or crazy.
  • Attended Webstock, got a sweet bag. Rives was pretty awesome too.
  • Became a Certified Scrum Professional (Which, apparently, is better than a Certified Scrum Master even though it doesn't sound like it).
  • Started thinking about planning for Rails Camp NZ
  • Organised Rails Bootcamp
  • Attempted the Milford Track. It was slightly damp.
  • Made Technical Lead at 3months
  • Ran a Rails Workshop at Victoria University
  • Worked a lot and posted lots of overtime, outside stuff went down a bit though.
  • Settled on a location and started working on selling tickets for Rails Camp
  • Created a MUD in Node.js for the Node Knockout
  • Resigned from 3months to start Rabid Tech
  • Did the Rails Rumble and created a news aggregator
  • Did some contracting while getting going with Rabid Tech, unfortunately it took up a lot more time than I meant it to and delayed other things.
  • Attended the NZ Open Source Awards - I had code in three different finalists.
  • Gave a talk at Wellrailed on Rspec 2 and TDD - Unfortunately the videoing didn't work.
  • Wrote a novel for Nanowrimo - Lots of editing still to do.

Sunday, December 12, 2010

Rspec 2 at Wellrailed

I gave a talk to Wellrailed at the end of October on Rspec 2 which drew the largest crowd that Wellrailed has had in a while. I was hoping to put a shiny video of the event up here, but unfortunately the sound didn't come out. Here's a brief recap of what I said instead.

I had two distinct segments in my talk in that I started off talking about TDD for a while to try and convince people of it before moving on to the nitty gritty of Rspec 2. So that they could really understand some of the philosophical stuff that goes on in Rspec and how it's best to work with it. Using a tool right is by far the best way to avoid coming across difficult problems.

There was quite a spread of Rails and Rspec experience in the crowd from a couple of people who knew very little Rails all the way up to people with massive test suites that wanted just any useful extra things I could throw their way. I think I managed to give everyone something but it is one good point about larger gatherings like Rails camp (Tickets available now for Rails Camp NZ) that you have enough people to split up and focus on things a bit more.

One of the things that seems to be happening with Rspec is that it's getting a larger number of nuanced ways of matching things that make test failures easy to understand. It's much easier to see what's gone wrong if the error message is " should be valid but is not" rather than "false should == true" as would happen if you just asserted the result of valid. By having an intuitive error you'll start thinking about what might be wrong and the possible fix sooner which speeds development up. Unfortunately this plethora of options does make the system much more scary for someone just picking up the framework.

It was also a great opportunity for me to pick up some new shiny Rspec tricks. I'm particularly happy with the addition of importance filters for managing which groups of tests run when in Rspec. Being able to easily have you default autotest not run slow tests or ones that rely on some external resource is a vast improvement for anyone who has had to deal with the growth of their test suite on a larger project.

I continue to happily proselytise TDD. It's great that more and more people are open to it and joining in and I didn't have anyone loudly disagreeing with the concept for a change.

Well
(Yeah, the slides are pretty horrible. In my defense I mostly stayed on a couple of the more content free ones while I talked. Going to have to look at making better ones now that I've read Presentation Zen though)

Monday, October 18, 2010

Agragr - Rails Rumble 2010

Last weekend was my third Rails Rumble. Michelle, Kelly and I set out to build a social news aggregator aggregator. We called it Agragr.


Agragr is only really one page. We worked to pack in as much information as possible to give people a fast overview of news as it comes in. The simplicity and density of the information on the page along with the convenience of it polling for new news and notifying you in an non-obnoxious manner is nice. I can leave it open when I go out and when I come back I know exactly what new stuff popped up without trawling through links I've already read on a multitude of different sites.

This Rumble was much more pleasant and relaxed than the previous years. We had a smaller idea and didn't end up cutting features on Sunday like we have in the past, we even had time to do some testing and caught a few of the weird little bugs that snuck in. Delivering something that's complete and useful is a much better feeling than pushing out something with niggling bugs.

Having a team of three was also surprisingly convenient. With a designer, a javascript dev and a Rails dev we didn't end up stepping on anyones toes and always knew who to ask about something. Filling out the team might have let us broaden our target, but we've learned that that can be pretty dangerous when you only have 48 hours.

I've normally learned a lot from doing the Rumble. That was slightly less true this year, although there was a good deal of shiny new Rails 3 things that it was a good chance to use. The new scoping and Arel methods made writing all the filters much much easier and cleaner than filtering has been in the past.

This Rumble was fun and relaxed. For any future Rumbles I'll probably continue with the idea of building small functional utilities that I'll use instead of epic beginnings of larger projects. Less stress and you can sleep, so you don't lose the next few days of the week to recovery.


The following is a brief log of what I did during my waking periods of the competition:

Phase 1(First 13 hours)
Set up server, source control, base app and tell people where everything is to start putting layouts etc.
Wrote migrations and some simple models.
Generated seeds for default topics and sources.
Wrote RSS parser for HN, rake import tasks, and Json importer for Reddit.

Phase 2(Central 19 hours)
Fixed RVM and passenger issues.
Wrote all the front end stuff for spitting out links.
Worked out all the session details for storing filters and topics.
Sorted out cron tasks for server.
Worked on scoping all the filters with shiny new Rails 3 database methods and scoping.
Generecised importers so that we can easily add future RSS feeds and Reddits.
Fiddled with timestamps a whole bunch to get the right things popping out on the page when it's polled.

Phase 3(Final 4 hours)
Wrote a bunch more filters.
Sorted out some bugs with updating topics and filters.
Testing and helping with bits and pieces.
Tagged final release.

Thursday, September 30, 2010

10 Reasons You Should Go to Rails Camp

Rails Camp is an event where a bunch of Ruby hackers get together for a weekend out of reach of the Internet to hack, drink and be merry. I'm currently organising RailsCamp New Zealand for March 18th -21st 2011, but this list could apply to any Rails Camp. (side note: it would also be great if events like this sprang up for other languages as well)

10) Projects

Rails Camp is a great place to start a project, work on something or just help out on cool things. You know everyone else is a valid target to be recruited into your latest scheme to build an open source can opener and you can kick off quickly because everyone has at least one language in common. A weekend is plenty of time to get something cool built when there's a bunch of skilled people around and plenty of urge to build things. Depending on how much the organisers have chased up sponsors there might even be prizes for best thing.

9) Price

Rails Camps are cheaper than conferences. Lots cheaper. A bunk bed and decent quality food for three days does not need to cost much. So you can save money or spend that extra cash on visiting Rails Camps that are further away.

8) Hacking

At Rails Camp people write cool programs for fun. So even if you don't want to build a whole project there are plenty of little things you can do. Write an app to swing the vote on the shared music player toward the excellent Rick Astley or an AI for some kind of crazy Rails based game.

7) Time

Rails Camp just keeps going until the end of the weekend. You don't get kicked out of the auditorium and herded to dinner, you can keep doing whatever and run off to sleep when you want to. If you're in a talk and everyone gets really excited about TDD then that talk can go till 3AM if you want it to.

6) Fun

Rails Camp is fun. There's plenty of freedom and only the lightest of self-organised scheduling. So everyone can do what they want, which leads to more happiness. Nothing like a conference where you suddenly find you don't care about whatever the next event is and you find yourself stuck eating the leftover cookies from morning tea, instead you can wander over to someone building something, explore the countryside, play a game of werewolf or whatever.

5) No Internet

There is no internet. You get to escape for a while, you tell people you're going to be at Rails Camp and then you get to really focus on the event. Also, unlike a conference, you'll find that everyone starts talking to each other instead of liveblogging the event or tweeting about the weather.

4) Relaxation

It's an event with a lot of freedom. You're going to be in nice surroundings and out of the city. Stuff will be happening all through the weekend so there's no pressure to be up at a certain time. If you miss someone's talk you can just grab them and ask a couple of questions anyway, it's not like they're going to leave before the weekend is over.

3) Learn

There are lots of really good developers who come to Rails Camps and it's one place where they're all happily doing things and easy to access. Whether you go to talks, work with people on something or just ask a question. People there are knowledgeable, friendly and willing to talk about things that they might not be willing to share at a more public venue. With a centralized focus on one language there's going to be far more of direct interest and use to you than there might be at a broader event as well.

2) Drinking

You can drink, most people like drinking.

1) People

People who go to events like this are awesome and great to be around.

You want to be awesome too don't you?