Josh Thompson     about     blog     projects

Turing Prep Chapter 3: Moar Mythical Creatures

Article Table of Contents


Preparing for Turing Series Index #

What follows is an eight-part series that will help you pick up useful information about a number of topics related to Ruby, specifically geared for students learning the Ruby programming language, as part of the Turing School’s Backend Software Development Program

It’s generally intended that you progress sequentially, but there’s no “right way” or “right order” to encounter these topics. You could convince me I have the order exactly backwards. I’d disagree, but only slightly.

I encourage you to skim around these chapters, get the “shape” of what’s to come, in your mind, and then dive in wherever you want. Good luck, and bug reports are welcome.


I’ve made a few more videos, focusing on the Mythical Creatures exercises.

Mythical Creatures: unicorn.rb #

Once you’ve finished the strings, arrays, hashes, etc… you may want to take a spin at the infamous Mythical Creatures!

These exercises will give you lots of practice with “object oriented” programming. You will define an object (like a Person object) and create instances of that object that have certain behaviors and methods of interaction.

This is a lot to wrap your head around, and “object oriented programming” is a topic that fills dozens of books, hundreds of conference talks, and you’ll spend the rest of your life building a better understanding of. So don’t feel any rush to grasp it all in the next ten minutes.

Block out an hour or two to work through through this guide: LaunchSchool: The Object Model

Read it carefully, but don’t worry that it all won’t make sense. Take notes, run the code examples, take your time.

When, and only when, you’ve read through the above set of articles about The Object Model may you start to tackle the first mythical creature.

Do not watch the following walk-through until you’ve read and run code from The Object Model linked above.

It can be tricky getting set up, so here’s another video of the very first mythical creature:

A quick aside - as you work through these exercises, and all of the exercises to come, you’ll perhaps notice a constant tension between “results” vs. “process”. Here’s what I mean by this, explained in a conversation with a Turing student, working through this exact guide:

They said:

[…] In other words, there is more than one way to achieve the result, so do I focus on process or product? I am not expecting there to be a single “right” answer, but I am curious as to how Turing is going to evaluate us. Are the steps used more important than the outcome?

I responded with:

Your intuition is leading you well - the steps and the outcome, are important.

I’d recommend de-emphasizing the Turing evaluations in your mind, though, and just focusing on building the right kind of skills that will serve you well for the rest of your career as a developer. And, from that lens, there will always be tension between the best I know how to do right now and the best that can be done, ever.

Obviously, as you grow your skill-set as a developer, you would be able to go back and improve prior bits of code you’ve written. It’s rare to crank out a “perfect” project, no matter how small.

So, optimize for learning, which basically means… when you find something that works, use it, but next time you come across a similar kind of challenge, you might use something slightly different.

I don’t know if any of this makes sense. It basically means don’t sweat not getting exposed to every single Ruby method, but be open to using new ones as situations arise, and you get more comfortable with the ones you know.

Or, in summary:

There may be multiple ways to achieve the required outcome; use what you now know; be on the lookout for other methods that achieve the same result.

Feel free to rely heavily on my solution here in the video, but when you’re done making it pass the first time, you must delete all the code (and the file containing the code), and do the exercise a second time, from scratch.

If you don’t, you will get maybe 10% of the learning out of this exercise that you should. I made this video not to give you the solution, but to help you get the shape of running the drills. Now that you know the shape (from the video) you can do the drills, but you must re-build unicorn.rb, if you made it pass while watching my guide.

Once you’ve re-built your own Unicorn class, re-read the Object-Oriented guide: https://launchschool.com/books/oo_ruby/read/the_object_model

Much more of it will make sense to you this time.

Mythical creatures, dragon.rb #

We’re doing another Mythical Creature - this time, dragon.rb. I’ll get a bit deeper into using Pry, as well as opening with a very minor (but very important!) Terminal modification.

We discuss:

  • Setting new tabs/windows in Terminal to open from current directory. (more on this)
  • Atom split panes (more)
  • Atom Autosave package: It’s in your editor by default. here’s how to turn it on
  • Atom package that shows current indentation: (vertical white lines) indent-guide-improved
  • Atom package that highlights beginning/end of method: ruby-block
  • Atom package that highlightes all instances of selected text: highlight-selected
  • How to run just a single test in Minitest: StackOverflow answer
  • how to run just a single test at a time from the command line
  • calling self inside of Pry, to see the current object under test.

Mythical creatures, hobbit.rb #

The hobbit mythical creature is a bit tricky. We have to start doing things with methods, without necessarily returning anything. Then we have to “interrogate” the object under test to see what has changed, and if some things have changed in a certain way, we do one thing, if not, another.

IF YOU HAVE QUESTIONS! Email me, or ping me in the Turing slack channel (I’m @josh_t). I’ll make sure to integrate answers to your questions into this guide.


When you’re done, move on to chapter 4!


Preparing for Turing Series Index #

What follows is an eight-part series that will help you pick up useful information about a number of topics related to Ruby, specifically geared for students learning the Ruby programming language, as part of the Turing School’s Backend Software Development Program

It’s generally intended that you progress sequentially, but there’s no “right way” or “right order” to encounter these topics. You could convince me I have the order exactly backwards. I’d disagree, but only slightly.

I encourage you to skim around these chapters, get the “shape” of what’s to come, in your mind, and then dive in wherever you want. Good luck, and bug reports are welcome.


Additional resources #