Bootcamp - No Joke

Written by Dominic V. Smith.

As a US Army veteran, I’ve been through bootcamp before.

Bootcamp for me was one of the first times in my life I really tested my limitations, both physically and emotionally. One week before bootcamp graduation, I fractured my leg and was given the choice of either repeating the last nine weeks over again (nine weeks of suck), or completing bootcamp (including a two mile run and a 15k ruck march) with a fractured leg.

I decided to chug painkillers, risk further injury, and finish bootcamp. The smartest idea? Probably not, but I learned some valuable information about myself and the limits I can push myself to.

We are only one week in to Galvanize’s full-stack bootcamp, and I already feel like this experience will live up to my previous experience with a bootcamp.

This weekend, I rebuilt part of a popular Javascript library called _.js (Underscore). This took me about twelve hours this weekend. Twelve hours to write about 140 lines of code. I wish I had something to compare it to for people that have never written code before… The only thing I can think of is writing an essay in Swahili, without knowing how to speak or write Swahili (although according to this Swahili is easy to learn…). I imagine that could take 12 hours to write 140 lines.

But there was a definite feeling of accomplishment once I finished the exercise, loaded up my new library in Node, and didn’t get any error messages. Is the code refactored and as pretty as it could possibly be? No. But does it work? For the most part.

So lets look at some code. The method sample in underscore produces a random sample from an array. It can also take a number as an argument, and return that many random elements from the passed array in a new array. If no number argument is passed through, than a single random index is returned.

To create this, I wrote:

JS Bin

Which gets the desired result, but unfortunately edits the original array with the splice method.

Trying to re-write this to not edit the original array, I came up with:

JS Bin
Both functions produce the same result/output. But how they do it is very different. I’m not sure how long it took me to write the code above… all of the exercises this weekend just kind of blured together. But I do know that the second block took significantly less time than the first.

I also know that I probably could have stopped after I finished the first block of code, because for the intents of the exercise, I completed that problem. But getting the output wasn’t enough. It had to be done “right” (which is a wierd concept because I’m often finding that there is no one “right way” to code something).

I learned something about myself this weekend. Sometimes getting the answer (or output you want) isn’t enough for me. Often it is what comes before the output that is really important. (I just re-read that and it sounds like a geeky version of “the road traveled, not the destination”…)

Did getting to this lesson suck (12 hours for 140 lines…)? Kind of. But I’m glad I got there. I imagine this is the first of many hard learned lessons i’ll encounter during my latest bootcamp experience. Lets hope this time I don’t break any bones.

Until next time.

Written by : Dominic V. Smith

Done At: May 4,2015
Categories: