Apprenticeship -- Day 3

November 28th, 2018

Goals for the day

My goals today were to complete the TryRuby tutorials, read another Sandi Metz chapter, and display a board using Ruby.

Pair programming

8th Light strongly encourages asking questions, contantly getting feedback, and pair programming, which makes room for questions, feedback, collaboration, and communication. My mentor said that we'd set up a pairing session for Friday. I don't know why I feel that something terrible will occur every time I think about pairing. I'm always happy to disclose that I don't know or understand something. I live by a "honesty is best" policy. Though, for me, pairing is different than simply admitting your ignorance. I'm comfortable discovering my weaknesses, but sometimes I don't feel like looking foolish in front of people. I've been getting better, or rather, I've been pushing myself to be better at communicating while pairing. Still, I can feel insecure with someone's eyes on my every key stroke and gesture, revealing all of my good and bad habits.

Why am I bringing this up??

Well basically, I had temporarily placed my pairing anxieties in a box labeled "don't worry about this until Friday". Then this morning, one of the crafters pulled me into his class to complete some type of ping-pong-pairing activity with two other people I'd never seen before. (What class? Who are these people? What language are they working on? Are these professionals or "students"? How clownish am I about to look? Aw shit!) I'm a little nervous, but I agree to briefly fill in for someone who didn't come to class today. Afterall, an experience is a learning experience even if (esp if?) it's mildly uncomfortable. So they were working on what seemed like a kata, but of course it included TDD which is THEE way of 8th Light.

Honestly, I'm still learning about TDD. People tell me all the time that testing is supposed to make coding easier. I still don't understand the benefits or possiblity of effectively writing code by writing tests before writing code. Normally I would write code, then I would write some tests that seemed appropriate. Then I would make tests pass by tweaking my tests to match my code (sounds terrible, right?). So I was worried about what was about to go down. They said that I had nothing to worry about, but I was still unsure.

So the activity was set up in vim (something I habitually avoid for now). There was an area for tests alongside an area for code. The test area was prefaced by some instructions in comments. I'm sure they were great, but they seemed vague to me. It was basically a JavaScript kata with a list of requirements to meet. We're passing around one laptop. The activity is timed. After a minute or so, any code that isn't complete or doesn't pass a test has to be deleted. The idea is to meet requirements but start very small, writing tests and passing them along the way. The laptop finally comes to me and I freeze. I'm supposed to pass a test without using "if" statements. Shit, that's my go-to solution. Time is running out and my fingers still won't move, so I try thinking aloud, but nothing I'm saying is helping me and probably isn't making sense to anyone else in the room. Someone suggests that I could simply return whatever it is I'm expecting as a result of my test. That seems like cheating to me. Before I can even understand the comment, the buzzer goes off. Oh my, everyone else is meeting the requirements effortlessly. I really need to dig into TDD. I'm saved by a meeting that I had scheduled with one of the directors, so I jump out of there feeling a bit defeated but motivated to make TDD a priority while learning Ruby and OOP.

Ruby, ruby, ruby

I completed the TryRuby tutorials and started Ruby Monk. I liked how these tutorials had built in input/output processors, so you could quickly work through problems while reading about concepts. I still had some questions around intialization methods within classes, curly braces, and hashes. Why not just call a hash a dictionary or collection? A hash reminds me of a long, unique string of characters. I guess syntax and naming conventions are none of my business.

Anyhow, one of my goals today, to get a feel for writing in Ruby in relation to my tic tac toe project, was to render a board to my console. I made a Board class. It housed a couple of methods that would either print vertical or horizontal lines. I managed to display a "board". It was pretty pathetic looking, but it was start. I wanted to get a feel for the syntax, and get used to creating and running files from the command line.

Sandi Metz

I felt more comfortable about OOP and using Ruby as I completed the tutorials and read Sandi Metz's POODR book. I started understanding why everyone recommended her materials. One of my first questions while reading was: What is object oriented programming?

I originally thought it meant using objects in your applications, for example, pushing data into objects, using JSON, grabbing data from objects by way of brackets or dots. To me, objects were a distinct type of data because it was a collection of things (functions, strings, integers, other objects). An integer or string would be other types of data. When thinking about an object, the first thing that came to my mind was a collection of key-value pairs, where the key was a property and the value was the value of that property.

However, Metz' description of OOP was totally different. Firstly, Metz described Ruby as a class-based object-oriented language, where everything was an object. WHAT? You mean to tell me that a string can be an object? I thought a string was simply a string. In Ruby, strings are objects, not simply data types. There are string objects. There are integer objects. (Insert Tiffani's mind being blown here). Basically these objects would differ in that they'd have their own personal data, but would have similar behaviors. I guess there are some inherent methods that you could have for all strings, for example, yet they could still have unique, personal data. Metz described Object Oriented applications being made up of objects and messages(??), where messages were passed between objects. OO applications would have objects that communicated with one another through functions. I found this to be interesting because it implies a certain sense of ownership among these objects, and communication would mean granting access. This seemed like a huge step above scope.


For the rest of the day, I worked on Ruby exercises, read POODR and other Ruby articles. That exercise this morning really motivated me to start learning more about TDD and proper usage. Reading POODR made me realize how little I actually knew about the SOLID principles and OOP and how important they are in software architecture. Tomorrow, there is a minimax workshop, I'm hoping to embarrass myself less. Also, I think I'm ready to start planning out this tic tac toe game.