Blog

Eureka! Two a-ha Moments in One Awesome Week

Placeholder Avatar
Rachelle LeQuesne
February 2, 2015

My Adventures as an Apprentice Developer

Since I attended Rails Girls in May 2013, I have been on a quest. There is so much to learn. It’s not just Rails; one must also gain competency in Ruby, Javascript, Git, RSpec, HTML, CSS, and all things web. That’s no mean feat!

There are a few concepts I have struggled to grasp. I have read books, watched online tutorials, read discussions on Stack Overflow, and even asked real people. I got closer to understanding each time but nothing quite clicked. It can be frustrating, but it is all part of the adventure.

This week, in five short days, I had not one, but two a-ha! moments.

The first came to me while I was watching a Code School video. The difference between a mock and a stub. Simple, but for me it has been a very elusive concept. They explained it so eloquently: a stub fakes a call to a method, whereas a mock creates an implicit stub and also checks that the method would have been called. Wow! So easy when they put it like that.

Even better, I had the opportunity this week to create some stubs in a test suite. I was tasked with the job of fixing a couple of failing specs. It was simulating a customer on a website filling out an enquiry form and, in turn, generating an email. I ran those tests so many times that I got labelled a spammer and had my IP address blocked! My manager even got a call from the Business Development Manager asking if he knew why so many emails from joe@example.com were coming in. Oops! So out came the stubs. Instead of actually sending the email, I simply replaced those calls with stubs and viola! Problem solved.

The second came from a YouTube video: Ruby Class & Instance Methods. I come from a procedural programming background. It’s a whole different way of thinking. I have understood intellectually the difference between a Class method and an Instance method, but it is something I have to pause and remind myself about before I can continue. As soon as people use it in conversation, I am lost. It was never there in RAM. But when I was watching this video it suddenly all fell into place. At this exact moment:

screen shot 2015-01-11 at 11 52 43 am

I have read this description of the difference before. It never gelled, but this time, it finally made sense.

So, yeah, it’s been an awesome week. Amongst all the confusion and all the new knowledge I have been trying to cram into my head over the past 18 months, one or two pieces are starting to fall into place. And it feels good.