Stuck, Stuck, Loose

It’s almost like they did it on purpose.

The first core challenge today seemed designed to hurt people’s feelings. It involved lots of pattern matching, finicky attention to detail, and a totally-not-obvious approach to building Ruby methods. Oh, and we didn’t learn how to implement the best solution until after lunch. And yet it was exhilarating to grind away at a single thing for 6 hours with no solution in sight. In the process, my pair and I got very familiar (way too familiar, actually) with nested loops and string manipulation.

But then we learned about regular expressions and it was like a switch turned on.

But that was in the afternoon. This morning all my fellow Bobolinks had an Engineering Empathy session in the Room of Requirement, because we’re new enough to need two in two days and because all the rooms are named after Harry Potter stuff. In the EE session, we discussed programming, oppression, and empathy, and how they all might be related. Though we didn’t arrive at a consensus, we all left the room a little more hopeful that we could actually be change agents in the world we were entering, adding to and maybe even elevating the cultures of the places where we’d eventually work.

After EE, everyone got pizza. I don’t know where this pizza was from, but it had eggplant and figs and blue cheese and it would have been the best part of the week so far if the coding wasn’t so challenging and amazing and cheesy and seasoned to perfection. For real, people, I still can’t stop thinking about that pizza. 

And then we dove into regular expressions, also known as regex’s, or regexps (if you’re into impossible-to-pronounce consonant strings). Regex’s look at stuff and try to find coder-defined patterns in it. If someone wrote you an email with a ten-digit phone number, I could use a regex to isolate just the number. In plain English, my method would be to look for three digits, then an optional single character (like a parenthesis, comma, period, or dash, or nothing at all…that’s why it’s optional), then another three digits, then another optional single character, and then four digits. I won’t go into more detail here because I know future boots are reading this and I don’t want to spoil the fun of figuring this stuff out. I will say this, though: STOP BEING AFRAID OF REGULAR EXPRESSIONS. I was, and I shouldn’t have been. They don’t look at all like plain English and that’s literally the only hard thing about them. There’s this fun site called Rubular where you can enter in whatever text you want and then see what happens when you run regex’s on it, in real time. 

With such a powerful tool, you’d think our day-long pairing session would have gotten easier. And it did, but we still felt rusty. So we tabled our challenge to revisit later, during my Pairing is Caring session. Pairing is Caring is an onsite mentorship program where really good teachers use the Socratic method to help you pull your best work out of yourself. After closing the 8-5 “workday” (almost no one leaves before 7 unless it’s for a quick dinner) we met up with our mentor, who patiently and firmly hammered home the principle of single responsibility. That’s when we got unstuck.

Single responsibility means that each method we write in Ruby should do exactly one thing. You wouldn’t want the person handling the money at the restaurant touching your food in the kitchen, so why would you want to get input and return a result in the same method? Following the SRP meant our code was not only cleaner and more elegant, but also less vulnerable against the kind of bugs that render programs unusable all at once. When we broke stuff during coding, we only broke one set of stuff at a time. We finished the challenge on our own shortly after our mentor wrapped up the hour.

Throughout the whole process, we were assured that we were doing a great job, even when we didn’t feel like we were. This assurance was coupled with an expectation that we solve the problem all on our own, so we never got any more than the vaguest of hints to keep us on the right track. We spent at least as much time doing our own research as we spent asking questions, and the balance was empowering in retrospect. In the moment, though, I occasionally found myself irritated that we weren’t just given the right answer when we felt stuck; my childhood traditional education lasted long enough to create plenty of bad habits, and they’re dying hard.

There were eight core challenges today, all of them based on algorithms. That’s kind of the theme for Week 1. I haven’t touched any of the stretch challenges so far, but that doesn’t bug me too much, because our final result on that first beast of a challenge worked cleanly and handled a lot of different types of input with ease. I’d rather understand three things very well than fly through six exercises without pausing to reflect.

Once again, this blog has taken me a half hour past my healthiest bedtime, which means I’ll either have to start truncating my posts, writing more on the subway, or finding a way to get out earlier each day. Not blogging is not an option. When I wake up tomorrow, I know I’ll remember more about today because I wrote about it

It’s not like I’ll need too much sleep tonight anyway. I’m already feeling performance adrenaline starting to bubble up. See, there’s gonna be a talent show tomorrow, and I brought my guitar in this morning. Once again, tomorrow is coming sooner than I expected, and I can’t wait. 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s