Free Ruby QA session TODAY (Sunday)

Join me @ my codementor office hours


link to the office hours page

This morning at 12pm Central Time, I will be holding a Q/A session on Ruby and Rails idioms at The event is free and I invite you to join us.

The event will be live coded and record.

Do you:

  • have questions about how Ruby works?
  • find yourself using loops?
  • want to know how map, select, reject, or reduce work?
  • have questions on procs, blocks, lamda and yield?
  • find yourself stuck in rspec when you could be using minitest?
  • know how .tap works?
  • want to learn how to avoid NILs
  • want to learn to avoid conditionals?
  • have no idea what metaprogramming is?

Continue reading this article..

How to do leaderboard in Ruby

A solution for one of my students


I got an interesting request tonight on involving a leaderboard. Everything was pretty obvious until it came to solving ties.

Consider the following results:

  • Team A - 100 points
  • Team B - 98 points
  • Team C - 98 points
  • Team D - 70 points
  • Team E - 69 points
  • Team F - 69 points
  • Team G - 50 points

What we want displayed is:

  • 1) Team A - 100 points
  • 2) Team B - 98 points
  • 2) Team C - 98 points
  • 4) Team D - 70 points
  • 5) Team E - 69 points
  • 5) Team F - 69 points
  • 7) Team G - 50 points

Continue reading this article..

Where the hell did Jim go?

Building a sailboat!


I apologize. Without any warning, I allowed my blog to go silent a few months ago. I am an avid sailor and am in the process of rebuilding a 40 year old Westsail 32 from the hull up (after I tore it down to the hull).

I rented a new place with a huge yard for the work and I have been eeking by a meager existence thanks to, where I put in enough hours to pay for my obsession and rent.

Continue reading this article..

Passing lispy code as data in Ruby

exploration of Ruby's parentage to discover powerful techniques


You have probably heard that Ruby has multiple parentages.

  • LISP for it’s syntax tree and functional enumerators
  • Smalltalk for it’s object orientation
  • Eiffel for it’s blocks
  • Perl for it’s regular expressions

Ruby has four parents, and it takes Matz’s favorite aspect of that language and blends them together into a hybrid, multi-paradigm, utility language that would do everything he wanted to do, and to say it with less ceremony.

Now Ruby certainly gets more ideas from each of these parents as listed above, but for a moment let’s focus on the most mind-blowing, language specific aspects of at least 3 of them.

In this chapter we will explore the first if them, LISP

Please note - for the experts in these languages

I am attempting to limit scope to what is important to the subject at hand. I am not an expert at these other languages by ANY means. I am a Rubyist with a bit of exposure to a few of these.

LISP is essentially boiled down into this for the Rubyist: you have lists, which can contain not just data, but code (functions), and to do that, sometimes a function can become a piece of data, be added to a list, queried as code again when the time calls for it. All in a lazy manner. Let me try to illustrate this for you in Ruby.

Continue reading this article..

As a new Rubyist what can I do?

what should I do to become a GREAT developer?


I get asked this question a lot from developers I coach. Or I get the question in it’s other form, “So how do you learn to write clean, uncoupled ruby?” Or the other question, the one I tend to hear from people who disagree with me… “Why do you have such strong opinions? How did you choose your opinions?”

The 3rd form of the question I will answer like this. I did not choose my opinions… They chose me. Every single one of them was either me losing an evidence and reason based contest of opinion, and the other was experiencing developer pain but not having the solution. The solution was this list below for the most part.

A path to becoming a great Ruby programmer

Continue reading this article..

Why I can TDD and why DHH Can't

coupling, conditionals, and state are making your life hard


I have been writing Ruby for a long time, and Rails for almost as long. However MOST of my work has been Rails, something that I am VERY grateful to DHH for. His excellent ideas that became Rails changed my life, so:

“Thank you David, you can say what you want and write coupled code and not test first, you will always be a hero of mine for making it possible for me and all my geek friends to play with Ruby every day and make a living doing it!”

At first, I HATED TESTING. I fought it’s adoption arguing the position DHH has returned to, browser testing by humans. I hated it because I sucked at it. But I always have a mentor, and I ended up with one who was a XP’er and an old small talker. That changed my life.

But I was still testing too much, testing the wrong things, mocking too much and in the wrong place. I didn’t apparently REALLY know what a unit test was. I was using RSpec and everything I wrote was highly coupled to Rails and the database.

And these are the reasons why I hated testing and thought it sucked. I had code to write.

Why DHH cant TDD

Coupling is the amount of internal knowledge that “leaks” out of the objects you write. When objects start knowing about each other to the extent that you cannot change one without changing the other, or you can’t swap one out without changing the other. There are many other forms of coupling.

I am not the only who thinks this, and case in point, here is the GREAT Jim Weirich DECOUPLING his logic from Rails, something that DHH would have left alone or put into a concern: Decoupling Rails

Isolation is when your object has NO external dependencies. Isolation is where you want to be. Class A may know that it needs another class, but it doesn’t know it is Class B. If Class C follows the same interface as Class B, then Class A doesn’t care which it gets.

Continue reading this article..

TDD isn't dead because DHH doesn't do it

coupled, stateful, complicated code is ruining your TDD experience


DHH’s original post is here tdd-is-dead

My response: Why I CAN TDD why DHH sucks at it

A better much less ranty post with INFORMATION on how to learn to write amazing Ruby can be found As a new Rubyist What can I do?

There used to be a shitty rant here about being banned from a forum over my heated defense of code craftsmanship, xp, and tdd. It has been deleted because I am a shitty writer and it doesn’t reflect the message I care about, Ruby and Coupling and Demeter and Abstractions, SOLID etc. The kind of shit that I am much better suited speaking about.

What follows is the sliver of what wasn’t shitty, which is shitty. So here it is. You want the original crap? Google it.

I hear the argument time and time again, and I heard it on RR Parley several times. It goes like this:

“My code is awesome without TDDing it. I don’t TDD it because TDDing my code is hard.”

Continue reading this article..

Free Ruby TDD Weekend Workshop

google hangout and - sunday 12pm-2pm central time


So I am in the middle of a lot of planning for “Ruby Workshops in the Tropics” this summer, where myself and a few other advanced programmers will be holding sessions to help you write tests, more concise, idiomatic ruby, and more….

It got me thinking I should just do some group pair programming on a weekly schedule. I already do several hours of consulting pair programming via CodeMentor and it has been a lot of fun.

So here we go! This Sunday, the 27th from 12pm to 2pm Central Time I will be holding a Ruby TDD session where I answer your questions and do some live coding for you. To participate in the session, you will need to have the Google Hangout plugin installed in the browser of your choice, and know how to open your terminal and ssh.

Continue reading this article..