Ruby Jam: Resource Roundup

Share on FacebookShare on Google+Email this to someoneShare on LinkedInPin on PinterestShare on TumblrTweet about this on TwitterShare on Reddit

I’m co-hosting a Ruby Jam with my friend Rachel this weekend, and I want to throw up some resources so people know where to start. A Code Jam is basically a gathering where people get together to code. Sometimes for the purpose of companionship while they work on individual projects, sometimes for the purpose of working on different parts of a project together, and sometimes just for the purpose of learning a language. This is how I learn almost all my languages and computer things: I sit down in my pajamas for a weekend with a stimulant and I DO NOTHING BUT CODE. Rachel likes calling it a Jam. I call it bootcamp.

In any case, that’s what we’re doing this weekend. A handful of Ruby n00bs are sitting down in Rachel’s living room to teach ourselves Ruby. At some point in the weekend we’re going to have a visiting Ruby Developer come help us out with Rails and Test Driven Development(TDD) if we are so inclined to learn those things.

Here are some resource links for everyone attending and those of you who would like to follow along at home:

INSTALL RUBY

This tutorial will run you through installing Ruby for your OS. Unless you are using Windows, I highly recommend using the package management tools to install everything from here on out. (The amount of knowledgeable advice I have about Windows could fit on a postage stamp, and mostly consists of the phrase “Are you sure you really need Java?”)

While you’re at it, make sure you have gems installed and updated. It comes pre-packaged with the newest version of Ruby, so you prpobably do, but now is a good time to check. Gems is Ruby’s own personal package management system and it allows you to pull down Ruby specific chunks of functionality as you find you need them. We’ll talk about it later, but for now just make sure it’s already there and if not install it.

 

RUN AND PLAY AROUND WITH IRB

IRB is an interactive Ruby environment that comes with the language. I’ll talk about text editors later, but while you’re in total n00b mode, just use IRB. That tutorial will run you through the usual “Hello, World!” routine, which seems juvenile but is a rite of passage for any programmer. You’re going to get a lot more nerdy programming jokes after you do this part. Isn’t that awesome?

 

CODE ACADEMY

Sign up for Codeacademy. Codeacademy is exactly what it sounds like: a collection of free interactive tutorials designed to help you teach yourself a variety of programming languages. Their Ruby Track is fantastic, so once you’ve signed up hit the first lesson in the Ruby Track and go! A lot of the stuff in the first part of the Ruby Track will be the same as the stuff from the Hello World tutorial you just did. Don’t skip it though. Repetition is good for recall. Instead, breeze through it like a boss and feel good about already knowing things, because it’s the last time you’ll feel that way this weekend.

 

RUBY QUIZ

You can go as far as you like on codeacademy, but at some point you’re going to want to test your knowledge and see if you can actually solve problems yourself. It’s time to hit Ruby Quiz. That link is to the old Ruby Quiz, which has since moved to the Ruby Talk Mailing List, which you should sign up for if you plan to make Ruby part of your life. For now, stick with the old Ruby quiz site because it’s much easier to navigate and most of the problems have attached solutions and explanations. (Don’t look at them though. Try to figure it out yourself first or what’s the point?) A lot of the problems on Ruby Quiz are very hard and your meager learning from the tutorials above is not going to be nearly enough to solve the problems. This is just the way I prefer to work: get a decent grounding in a language and then throw myself in the deep end and dig my way out by learning to solve the specific task in front of me. Your mileage may vary. As always, google is your friend and you should also avail yourselves of the resources in the Resources section below. Also, check out this list of classical programming exercises.

Remember, we’re n00bs; if we can find a solution that Just Works(tm) then that’s a win. You can take a look at some of the submitted solutions later and figure out how to write more elegant code, but right now if your solution works then that’s a major win and you should be proud of yourself. It doesn’t matter if you wrote 200 lines of code and more experienced programmers solved it in 20. Did it work? You’re doing great!

Here are links to a few specific quizzes and exercises I think are particularly useful for us:

  • The Solitaire Cypher: Don’t let the cypher put you off. Take a few minutes to run through it and allow yourself to understand how it works. I think Bruce Schneier, the guy who invented it, explains it better. This quiz is great for practicing string handling and basic operations. Additionally, the skills you learned in the tutorials above are actually enough to GET IT DONE.
  • Countdown: I think this is one of the easiest quizzes in terms of actual programming knowledge, but if you like math puzzles you’ll like figuring this one out.
  • Object Browser: This quiz examines Object relationships and is a good refresher on those. It also asks you to hack together a quick and dirty user interface to display and interact with your objects, which is my personal achilles heel, but is an important thing to learn how to do.
  • Animal Quiz: The first time I did this exercise it was in BASIC! (And I tried and failed to do it in PROLOG once, but I’m a slacker and didn’t try real hard.) I’ve never done it in Ruby, but we all should, because it’s a really great way to practice using Classes and methods and passing information in and out of them. If you are only going to do one quiz on this list, pick this one! There, I bolded it.
  • Roman Numerals: An easy problem that gives you an opportunity to use a hash. There, I gave you a hint. Now go, this one is quick and easy!
  • Madlibs: These seem like a fun and easy thing to lob at each other during a RubyJam!
  • Inference Engine: Does classical logic get you all hot and bothered? Have you ever wanted to tell your philosophy professor that you can boil down his entire class into a few hundred lines of code? Do you like Lewis Carroll style logic puzzles? Want to study for your LSATs while also learning to program? This quiz is for you!
  • Sampling: The actual task here is pretty easy, but provides a good opportunity to try your hand at optimizing and writing elegant code. You can expand from integers into a string array and use your solution as the main process for a random phrase generator like this ridiculous one I wrote in php a million years ago. (The reload button is no longer working in firefox so just hit reload in your browser. Sigh.) Maybe I’ll write something similar in Ruby as an exercise.
  • MUD Client: This is probably beyond the scope of this course, but it is good practice using Ruby to communicate with a server and learning to use the networking libraries available. I think it will probably take too much time for this weekend Jam, but it’s the best quiz on the old quiz site for server/client communication practice.
  • Index and Query: This is one of those quizzes you’ll want to save because you’ll use this code later. Probably the most useful-later quiz on this list.
  • Dice Roller: Hey nerds! We all need one of these, right? (I think this is a great first Rails project too, when we get to that. Second verse, same as the first, except web-page-ified with Rails.)
  • Current Temperature: This quiz will force you to learn how to harvest and use data from the internet.
  • Markov Chains: Here’s another fun little thing to pass the time in a silly way! (Also another good intro Rails project to throw up on the web with a Project Gutenberg library selection.)

Alright I’m tired of digging through Ruby Quiz now. That’s a good start. You can dig around the quizzes and the programming exercises and find ones you like.

 

RUBY RESOURCES ONLINE

Programming Ruby: The Pragmatic Programmers Guide
This is the book Ruby Programmers generally refer to as “The Pickaxe” because it has a pickaxe on the cover. It’s a behemoth of a resource but contains pretty much everything you need to get started coding in Ruby. I’ll have a hardcopy at the Ruby Jam, but the online version is more up to date and searchable!

The Little Book of Ruby
A much more concise introduction to Ruby. I don’t think this really offers much that code academy doesn’t, but YMMV.

Why’s Poignant Guide to Ruby
I like my information presented in the most efficient, concise, and usable manner possible. Therefore, I hate the rambling narrative nature of Why’s Poignant Guide. All that being said, it’s a very popular reference especially for non-programmers, so if the overly dry and technical nature of the resources I happen to like are bugging the shit out of you, give Why’s Poignant Guide a shot instead! At least it’s moderately entertaining, which is more than I can say for most programming books. Also, cartoon foxes!

I’ll be adding to this list as people on facebook and in the comments yell at me for forgetting important resources.

 

RAILS AND TEST DRIVEN DEVELOPMENT

I’ll be spending the first half of Saturday brushing up on my Ruby with the rest of you, but I’m hoping to take horrible advantage of Marlin, our local expert, to push me in a more professional TDD and web development direction using Rails and a variety of TDD tools.

Before I tell you what Marlin told me to install for that, I want to link to Ruby Koans, which I like and is my only experience so far with TDD. I worked my way through it years ago and have forgotten everything, but I remember thinking “Oh, this is pretty great and makes a lot of sense.” So if you don’t have a Marlin of your own, try Ruby Koans instead as a starting point.

Anyway, if you’re coming to the Ruby Jam and want to learn about Rails and TDD, Marlin would like you to install the following gems:

  • rails
  • mysql
  • shoulda
  • factory_girl
  • haml
  • mocha
  • faker

Don’t worry if you’re having trouble installing those. We’ll help you at the Ruby Jam. I’m just providing this list in case you want to get a jump on it. I have no idea what most of these do. Forget how to install a gem? Here you go!

 

TEXT EDITORS

When you move on from IRB it’s time to find a text editor to build bigger projects. Text editors are nice because they color code and properly indent your code and just generally keep it nice and clean so you can tell quickly if you’ve made a typo. They also help with tracking down errors and managing multiple files in a project, usually via handy tabs for each file in your project. Basically, if you’re serious about building Ruby projects, a Text editor will just make your life easier. n00bs, ignore the old-school trolls telling you emacs is the holy grail. It has it’s upsides in terms of customizability, but it also has a very steep learning curve and you want to focus your energy this weekend on learning Ruby, not emacs. Some of the things recommended are both Text Editors and complete IDEs. Just ignore the latter for now and take advantage of the text editors.

Here are my recommendations:

Windows: Marlin says Visual Studio is just fine for Windows. As I mentioned, my knowledge of Windows can fit on a postage stamp. So go with that.

OSX: You are welcome to have opinions, but unless your opinion is that TextMate is the best text editor of all time, then your opinion is wrong. Yes. pay for it. I know, I know, we want free stuff. I promise TextMate is worth paying for. I miss very little about OSX, but I will mourn the loss of TextMate 5EVAR.

LINUX: Sublime Text is the closest thing I’ve found to a replacement for TextMate, so it’s what I’ve been using for all my programming/web design needs on Linux. Aptana Studio has integrated the previously independent Rad Rails, a popular Rails development tool, so I’ve installed it on the off chance it might be a better fit for Rails projects. I’ll let you know.

 

 

Aaaaand, I think that’s all I have for now. I should really eat something. See everyone tomorrow at the jam!

 

 

Share on FacebookShare on Google+Email this to someoneShare on LinkedInPin on PinterestShare on TumblrTweet about this on TwitterShare on Reddit

Get involved:

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>