What’s it all about?
Week 2 is all about Ruby. If you don’t know what Ruby is, see my previous post by clicking here. This post is all about what I did in week 2, my highlights and how I felt!
What did I have to do?
This week I had to:
1. Complete “Ruby Kickstart”, sessions 1 and 2: “Ruby Kickstart” is a series of interactive explanatory notes and challenges created by Josh Cheek. These materials can be found for free online via GitHub by clicking here, and via the accompanying video tutorials on Vimeo by clicking here. Each challenge encapsulates one or more pieces of key Ruby syntax and/or coding concepts.
2. Get started on Codewars and earn at least 40-50 points: If you don’t know what Codewars is it’s essentially a collaborative interactive “gamified” learning platform for completing coding challenges, earning points and levelling up your skills in one or more programming languages.
If you want some more info on Codewars and how to use it to practise your coding skills and solve challenges, check out the below videos by Makers Academy on how to do just that:
Signing up to Codewars
Solving your first Kata (i.e. coding challenge)
What did I achieve this week?
Well I achieved a hell of a lot.
The Ruby I learnt
I learnt a huge amount of core Ruby syntax and coding concepts, including but not limited to:
- Ruby conventions
- Object-oriented programming concepts
- Numbers and arithmetic operations
- Strings (creation, interpolation, operators)
- Variables (single and multiple assignment, types (local, instance, global etc), attr_accessor etc)
- Arrays (creating, iterating, filtering, sorting, deletion, substitution and manipulation)
- Methods (creating, calling, manipulating, scope)
- Booleans (i.e. things that check if something is true or false)
- Returns, puts, prints, gets, gets.chomp
- Logic and Control flow (if, else, elsif, while, unless, until etc, etc)
My highlights are as follows:
1. Building my nan in code: what I mean is that I expanded upon the “Deaf Grandma” exercise in Ruby Kickstart, which Josh Cheek openly acknowledges and credits as being borrowed from Chris Pine’s excellent “Learn to Program“, so that the program I created actually speaks.
I did this by accidentally triggering the command line speech function when running some code in my terminal. Curious about why my computer started reciting my Ruby code, I did some Googling and found out how to build that into my app so the deaf grandma in my app talks to you rather than simply print the user prompts to the screen. Below is a video showing it in action, but click here if you want my code.
2. Figuring out how to convert integers to English words (without cheating and using Ruby gems!): another great brainteaser from Ruby Kickstart and Learn to Program challenges you to write a program that translates any given integer input, e.g. 1234, into English words, i.e. “one thousand two-hundred and thirty-four”. Sounds simple right? Uh-uh. It required quite a lot of thinking (at least for me) and some googling and StackOverflow mining to figure out how to break this down into simple steps and then how to use the best Ruby syntax to achieve this goal.
3. Writing a program that sings “99 Bottles of Beer on the Wall”: like the above, it sounds super simple, but again required some thinking. What was cool is that one way of doing it is to “require” the code from the above problem and then implement that in a new Ruby method to “wordify” each unit of beers on the wall in the lyrics. I also did it another way (shown below). Another challenge was building in some code to have the computer know when to sing “bottle” or “bottles” depending on how many bottles were relevant in each stanza of the song. Of course, if you don’t drink booze you always remake it as “99 Bottles of Milk on the Wall“.
How did I feel during and after week 2?
During week 2 I felt pretty miserable, especially at the start as everything was taking me FOREVER to understand and apply. It took me the whole of Monday and Tuesday to complete the reading and first 2-3 challenges from session 1 of Ruby Kickstart.
It wasn’t for want of effort: I’d been getting up at 6am and working constantly from 6:30am until 9pm each day with breaks here and there to eat and gym.
I felt massively disheartened, frustrated and began to regret having left the safe, salaried and stready cocoon of my law job. I quickly slipped into self-pity, venting my predictions of doom and gloom and self chastisement via a barrage of whiny Whatsapp messages to my girlfriend throughout the working day, and then again later in conversation after she returned home from work.
Mid-week: “I can do this!”
Feeling low I heeded the advice given to us via the Pre-course launch night (see this earlier post on that): pair program. Work together = work better.
Funnily enough this coincided with some chatter on Slack (see this post on Slack: what it is, why and how Makers Academy students use it), about meeting up at Google Campus in London to pair up and/or just hang out and work through the challenges together. By the way, Google Campus is a co-working space in London run by Google – there’s also a variety of talks and events held there, usually centred on business, entrepreneurship and tech. It’s free to become a member – just pop along, sign-up and get busy!
So a bunch of us met up at Google Campus. This was great for me as I got to meet some of my cohort face to face for the first time, having missed the Pre-course launch night. Sure enough, getting out of the house, interacting with other people on the same mission with many of the same fears (self-doubt about coding ability and anxiety about leaving their jobs etc) raised my spirits. By the end of the day, and with some mentoring from my more advanced peers, I had smashed through about 5-6 of the Ruby Kickstart challenges from sessions 1 and 2.
It worked so well I repeated the process again the next day, rocketing through almost all of the remaining Ruby Kickstart challenges.
End of week: Codewars, Lab Brats and well deserved sleep!
So I finished all the Ruby Kickstart challenges by Friday morning and submitted them to the Makers Academy GitHub repo of the same for checking. That left me with the remainder of Friday and the weekend to win 40-50 points on Codewars. Easy right? NO!
A final snag…
… The only snag was that I was meant to be filming most of Sunday… long story short, the director of the short film, “Parker’s Son” (a film I co-produced with some mates for the Sci-Fi London 48 Hour Film Challenge) had received interest in our film, which led us to decide we’d shoot a comedy webisode series, entitled “Lab Brats“, focussing instead on the minor characters from our film. Left to right, here’s Bogart, Eddie and Charlotta mid-shoot.
We had an awesome day shooting on Sunday – check out the Facebook page and Twitter account for production stills and updates on the episodes – but it didn’t leave me with much time to score my remaining points on Codewars!
Luckily, post-filming, I managed to smash through another 35 or so points Sunday evening, much to the annoyance of my girlfriend who was quickly becoming a “Code widow”. Once I hit 40+ points I sighed a huge sigh of relief, got into bed and fell asleep instantly.
Week 1 was over and I’ve achieved an incredible amount – I’d gone from a very rudimentary understanding of Ruby to being able to write fairly complicated mini programs and completing progressively harder challenges on Codewars. All in all a single week: WOW!