Archive for the ‘Books’ Category

Quiet Day of Reading

Tuesday, April 27th, 2010

Been a bit busy the last couple of days, I have a great post on Rails podcasts sitting chambered and ready to be formatted and have images added, and I’ll post that tonight.  The last couple of lunch hours I’ve taken a bit of my own advice and have been hiding in the lunch room and reading through The Pickaxe Book and 4 chapters in I’m glad I am.  It’s nice to get back to basics and go back and examine some of the principles that I’m using in more detail, as a lot of the time when I’m doing rails coding I really don’t know what’s going on down in the core of Ruby that may have to do with inheritance, class methods, and so on.

Quick Way To Experiment With ActiveRecord

Tuesday, April 13th, 2010

A while back I spent a fair amount of time with the Pro Active Record book, learning all about dynamic finders, associations, validations, and all the other magic it has, sometimes it was a bit of a pain to set everything up by hand, typing out the .rb model files, creating the databases, etc.  I figured, why do all that work (yea yea, I know it’s just typing out some text) when you have the power of rails, generators and rake at your disposal.  So what I’d do is simply use the rails generators.

$ rails test && cd test
[...]
$ script/generate model User name:string age:integer
[...]
$ rake db:create && rake db:migrate
$ vi app/models/user.rb # optional
$ script/console

Voila!  Four commands and you’re in an interactive shell that will let you manipulate your models, add data, run finds, etc.  No need to deal with anything other than an already set up database and model file, and you have a nice interactive shell to boot.

Best part?  Just do an “rm -rf <directory>” when you’re done to nuke the directory and either start again or try out the next experiment.

Ruby Best Practices Full Book Available For Free

Wednesday, March 17th, 2010

Ruby Best Practices – Full Book Now Available For Free!

That about says it all! Kudos to the author for doing this, and please donate and support him!

Three Book Recommendations From Mountain West Ruby Conf

Friday, March 12th, 2010

My buddy @milesforrest recommended the three following books (which I’ll have on my “tobuy” list in Evernote by the time this is posted):

Design Patterns in Ruby (which I’d seen before but been unable to get).

Refactoring Ruby.

Smalltalk Best Practice Patterns.

I’m looking forward to hearing the talk in which these were recommended, or borrowing them from the FV.rb when/if the club gets them.

Discovering Ruby With Ruby Warrior

Thursday, May 14th, 2009
Code from Level 6

Code from Level 6

Thanks to the FV.rb last night I discovered Ruby Warrior, a neat and fun way of learning ruby.  It goes like this….

First, head to http://github.com/ryanb/ruby-warrior/tree/master and download the tree by using “git clone“, then simply run “bin/rubywarrior” out of the main ruby-warrior directory that the git clone command creates.  The first run will create a profile and set up the initial part of the “game”.

The “game” is a bit like the old adventure text games, with a simple ASCII “dungeon” that you see your guy move through, and as the levels progress you will encounter monsters, harder monsters, captives to rescue, and so on as you move from one side of the dungeon to the stairs on the other side.  The system is turn based, so you are basically creating yourself a little state machine.  You basically check to see if there’s something in front of you and if not walk, if it’s an enemy, attack, etc.

To do this you end up doing something like this:

  1. You look at the README file in the ruby-warrior/beginner-tower/level-001/ directory.  You may have “intermediate-tower” instead of beginner depending on the level you chose during the initial setup.
  2. Follow what the README file says and edit the file ruby-warrior/beginner-tower/level-001/player.rb adding code to make your warrior move and fight.
  3. Run bin/rubywarrior and see how well your warrior moves and fights.  It will either succeed and allow you to continue to the next level (in which case go to step 1, substituting the right number in the “level-00N” directory), or you will fail, in which case, re-edit the warrior.rb file and try again.

The game isn’t for complete and total programming n00bs, but might be a bit simple for people who know programming, but not ruby :)   It starts out with simple commands and simple if/then/else control structures.  However, it does make it cool and interesting enough that it has kept my interest for at least until now.

Bought 2 Rails Books

Monday, May 11th, 2009

Got a couple of Ruby on Rails books out at the local Chapters today. After hearing a bunch of reviews, I picked up “Head First Rails”. This has a very unique way of teaching, obvious not only from the front page of the book (which immediately said to me “get rid of this and go onto the next book, this is crap”) to the inside and first chapter I’m going through. However, give it a shot and read through the introduction chapter and give it a shot. It’s different for sure, but in a good way.  One of the biggest things for me was the first chapter wasn’t a “how to install rails” section.  It really gets right down to business, which is a nice change.

Also, on a whim I grabbed “Advanced Rails Recipes”. The latter one I had seen before, but the idea of just having a book full of “how to do random thing X” was fairly appealing.  I don’t technically need this just yet, but it’ll be nice to have a paper copy for when I do reach that stage :)