Learning Ruby – Day 10

Day 10 – Program organization, Part 2 of 3.

As an experienced information architect, I’m familiar with the challenges of declaring an organizational structure. Whether its for books, furniture, clothing, or software, every structure has it’s biases – somethings are easier, others more difficult. With this in mind, the goal is always to net a more sustainable, maintainable, self-evident state.

Ruby’s include (for modules) and require (for files) commands make organizing code into separate files for easier maintenance possible. The question is how.

Jen once quipped about working in retail, “I can’t sell it, if I can’t see it.”

The same is true in programming, Slagell reminds us, “…for Ruby to include a module, it has to be able to see that module.”

Therefore, the chunk of code to be included should either be in the same file as the include command or the appropriate file should be required. Otherwise, mixing metaphors, the product isn’t really on the floor.

In today’s exercises, Slagell asks us to think about how to organize a program that shuffles a deck of cards.

Here are my initial thoughts:

  • Both “deck” and “hand” are collections of “cards”, differing by the specific number of “cards” contained. Therefore, “deck” and “hand” should be subclasses of a larger “collection” class.
  • It maybe desirable to reorder both the “deck” and a “hand”. So, the action of “shuffle” should be applied at the “collection” level.
  • “Card” should be it’s own class with “suit” and “rank” properties.

This post documents my journey through Sam’s Teach Yourself Ruby in 21 days. I’ll be joining Al Abut in his effort to learn Ruby and blog along the way.


True Thai is Our New Thai Place.

Last night, Jen and I ate at True Thai down on the south side of Minneapolis.

This was our second attempt at dining there. Attempt #1 was trying to seat a party of 6 on a Saturday night, without calling ahead = bad idea.

I haven’t been real pleased with the Minneapolis’ Thai offerings. Sawatdee‘s offerings are fair and their locations are many, and their staff is sharp. Like Dunn Bros.

There’s a bad place just north of us. Bad. Awkward service, bland offerings, bizarre staff. Like bad milk, I don’t see a need to share. Anyway – that’s not True Thai.

The only odd thing about True Thai is, well:

“I am assuming he is the owner, but, I sometimes wonder what restaurant owners do. Well, at least, what was he doing at the front desk if he was incapable of seating us? Better off letting the staff, who knows what is going on, run the show while he plays with the books. Anyway, aside from the owner who rudely passed us off to a staff member, our time at True Thai was enjoyable.”

Scott McGerik wrote this back in November of 2003, Jen and I had the exact same experience – 18 months later. Something to be said for consistency.

My side of the table was their Spinach Curry in Peanut Sauce with Mock Duck. Yes, spicy – to 11. Initially, it was exactly what I was looking for. In the end, it was a little too sweet. Jen enjoyed her bite of it. On her side of the table was the Calamari Pad Thai. You can’t go wrong with that. Can’t.

Learning Ruby – Day 9

Day 9 – Program organization, Part 1 of 3.

Back in my review of The Object-Oriented Thought Process, I talked about the difference between is a and has a in programming world. Dave was then kind enough to clarify.

Today’s chapter was that. In practical, We’re-Writing-Code terms, rather than the abstract, This-is-How-To-Think-About-It way of the previous book.

Here’s a quick background in Object-Oriented Design for the non-programmer:

  • Methods are chunks of code that do Useful Things.
  • Classes are collections of, among other things, Methods.
  • Rather than rewriting a Method to reuse it in another class, it can be imported into both Classes – as a Module.
  • Multiple Modules can be imported into a single Class
  • If 2 Modules imported into the same Class contain 2 different Methods with the same name, Ruby says the last one imported is the default.

Sometimes, the only way to stay responsive and relevant is to process things on a ‘last in, first out’ manner. I’m glad Ruby feels the same way.


This post documents my journey through Sam’s Teach Yourself Ruby in 21 days. I’ll be joining Al Abut in his effort to learn Ruby and blog along the way.


Learning Ruby – Day 8

Day 8, What are regular expressions?

If you don’t know about regular expression matching, or regex, it’s basically a language to find the useful needles in haystacks of text and code. Think ‘find and replace’ turned to 11.

I do just enough regular expression matching to forget how it works. I always end up googling for a quick reference, not quit finding what I need. My text editor of choice, SubEthaEdit has a nicely-formatted pattern reference in the Help menu, though it lacks ‘How RegEx Works’ documentation.

Enter Day 8 of Teach Yourself Ruby in 21 days. Everything about regex is covered; groupings, greediness, repetition, alternators, everything. A while back, I was thinking of picking up one of the many books specifically covering Regex. Now, I’m sure this one chapter will serve me well as that reference.


This post documents my journey through Sam’s Teach Yourself Ruby in 21 days. I’ll be joining Al Abut in his effort to learn Ruby and blog along the way.


First Crack 35. Honey Wine Tasting with Christopher Hadden

We’re tasting honey wine, or mead, with homebrewer-extraordinaire Christopher Hadden. We taste the Dry Mead from White Winter Winery and discuss mead’s history, brewing process, where you can pick some up.

Listen to Honey Wine Tasting with Christopher Hadden [32 min]

Got questions about coffee or comments about the show? Call: 206-20-BEAN-1

Like the show? Support the First Crack Podcast

Learning Ruby – Day 7

Day 7, playing catch-up.

I’m continually impressed with how concise the Ruby language is. As I mentioned in Day 4, Ruby frowns upon loops. I’m getting the impression Ruby also frowns upon taking up 2 or more lines to describe an action. Slagell’s examples of doing something a traditional way take up multiple lines, his here’s-a-better-way examples are single line. If we compare writing code to writing words and say each a chunk of code is a paragraph and each line of code is a sentence. Writing Ruby is more like dialog than narrative.

Note to self:
In Ruby, double quotes acknowledges backslash-escaped characters, i.e. "n" = new line. Single quotes will not, i.e. 'n' = n. Same is true for evaluating expressions within #{...}

Two Cool Things in Ruby:

  1. Chained Assigment
    Want to give a number of variables the same value?
    DaveSpeaks = JoeSpeaks = KatSpeaks = FrankSpeaks = "English"
  2. Multiple Assignment
    Want to quickly set the values of multiple variables at the same time?
    DaveSpeaks, JoeSpeaks, KatSpeaks = "English", "Dutch", "German"

The start of the day has quite a bit on binary numbers. I’m not sure when binary arithmetic will come in handy (a position I also expressed regarding Jr. High Algebra) but it’s nice to know it’s here when the need arises. The example Slagell offers at the chapter end feels like a band-aid for a poorly designed system. If any of you following along can provide a comment on when it’s beneficial to use binary arithmetric, I’d be extremely grateful.

As I finished up today’s exercises, Bic Runga’s ‘Listening for the Weather’ came through my iTunes. What an excellent way to wrap up Day 7.


This post documents my journey through Sam’s Teach Yourself Ruby in 21 days. I’ll be joining Al Abut in his effort to learn Ruby and blog along the way.


Kayak and PinPoint Changing the Face of Online Travel

A couple years back, I helped Orbitz.com redesign their shopping process. During that time, if you wanted to book travel the major players were Expedia and Travelocity, with Orbitz aiming to be the more usable, better-looking alternative.

Today, those three players are equally mature and equally less than compelling. They don’t capture all airlines and have yet to offer the recreational traveler’s dream: give me the cheapest flight to Brussels, anytime, any day, in the next 1, 3, and 6 months.

Enter Kayak.com. Think of it as Froogle for travel. Just the bare-minimum needed to start a travel search. If you want something a little sexier, check out Pinpoint Travel. Pinpoint uses Kayak’s engine and leverages the new AJAX web application model making a very interesting and helpful interface – like Google Suggests. Also, by asking me questions about my personal preferences, Pinpoint does an excellent job of keeping me engaged while it’s searching.

On the downside, AJAX relies heavily on Javascript so Pinpoint isn’t accessible and for some odd reason neither is Kayak.

More Gets You to Better

As I mentioned in my interview at Podcast411.com, I had an art professor who believed everyone had 5,000 bad drawings in them. Five thousand drawings bad drawings before the good ones could come out.

This perspective is re-iterated in Throw More Pots over at Crossroads Dispatches.

In this same token, I’m a firm believer every organization needs a playground, a skunkworks, a sandbox. Whatever it’s called, it’s a mentality where people can develop a million small ideas to find the ones that work. Whether drawings or pots or business models.

With the relative low cost of website development, in comparison to traditional television marketing, there’s a huge opportunity to try a million different small (potentially better) campaigns and cumulatively get the same return – if not a greater return.