My Adventures as an Apprentice Developer
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 email@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:
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.
Five UX Tips for Better Dashboards
Dissecting Code With Ruby's caller Method
Handling deletes with Null Object Pattern in Ruby
reinteractive is Australia’s largest dedicated Ruby on Rails development company. We don’t cut corners and we know what we are doing.
We are an organisation made up of amazing individuals and we take pride in our team. We are 100% remote work enabling us to choose the best talent no matter which part of the country they live in. reinteractive is dedicated to making it a great place for any developer to work.
Webinars are our online portal for tips, tricks and lessons learned in everything we do. Make the most of this free resource to help you become a better developer.
The Ruby on Rails Installfest includes a full setup of your development environment and step-by-step instructions on how to build your first app hosted on Heroku. Over 1,800 attendees to date and counting.
The Ruby on Rails Development Hub is a monthly event where you will get the chance to spend time with our team and others in the community to improve and hone your Ruby on Rails skills.