Day 42 – Finally Finished TDD

It feels good to be finally out of the TDD section. TDD is a huge thing in Rails, and I think the reasons for that are in part due to the availability of awesome Gems like RSpec, Capybara, and Factory Girl. This post will be a recap of the few non-TDD related happenings at the Dojo over the past week up to day 42, but then hopefully tomorrow I’ll be able to set aside a little extra time to put together a dedicated post about the above-mentioned three gems.

Algorithms

There were a few cool algorithm challenges in the past week, and the most memorable by far was the algorithm that introduced me to arrow functions. The challenge was this: Given a binary string with digits missing at locations shown by underscores as placeholders, return an array of the resulting strings after filling the blanks with all possible combinations. For example, given '010_1_', the algorithm should return the following:[ '010010', '010011', '010110', '010111' ]. After learning about recursion, this problem was fairly easy to solve. Simply check if the input string has any underscores- if it doesn’t, then return an array containing the input string- if it does, then recurse twice after replacing the first underscore with each possibility (in the case of binary, 0 or 1), and concatenate the results together. Here’s my original solution:

It’s a little clunky but it gets the job done. I didn’t know about the String.replace() function at the time, so I used a for loop to iterate through the string until I found the first placeholder, and then recursed with new strings built out of slices based on the x location. I can’t help but facepalm after seeing this implementation after instructor David showed me this:

IT’S SO BEAUTIFUL!! At first I was like “Uh… wut?” but after a quick explanation of how arrow functions work it made such beautiful sense. Basically an arrow function has two parts, the paramaters on the left side of the arrow, and the body of the function on the other. The arrow function will take in whatever is passed to the parameters, use them to run the body, and then automatically return the result. So, in this example, an arrow function is being assigned to the constant binaryStringExpansion and it will take in one parameter, str. The body of the function is making use of the ternary operator. The ternary operator is another cool tool I’ve been using more recently. The way the ternary operator works is like so:

<condition> ? <value if true> : <value if false>

So, in this function the condition is checking to see if the index of ‘_’ in str is -1 (String.indexOf() will return the index of the first occurrence or -1 if the string doesn’t contain the character). If it is, that means the string doesn’t have any placeholders. Since the condition evaluates to true, the ternary operator returns [str]. If str.indexOf('_') is not -1, then that means there is a placeholder and the ternary operator returns the necessary recursive calls concatenated together. Whew! That’s a cool little algorithm. Btw, if the arrow function is blowing your mind, and it definitely blew mine, check out this link for more in-depth examples on how to use them.

Tech Talks + Job Hunt

We had two tech talks and a seminar by the new career advisor in the past week, and all were very enlightening. The earlier tech talk was last Thursday and the speaker was a developer from Solstice, Ryan Phillips. He told us his story and gave plenty of tips on how to really break in to the development scene and get over imposter syndrome. He recently wrote a blog post on linkedin about beating imposter syndrome as well. It was cool to be able to get a bit of perspective from him about what it’s like to work in a consulting company. After hearing about how he’s worked on such a huge variety of projects since joining Solstice, I’m thinking consulting is going to be the way to go for me! I think the most important thing to have at my first job is the opportunity to keep learning new tech. Judging from Ryan’s experience, consulting firms like solstice are able to take on a variety of clients with projects of different shapes and sizes and move their developers around on projects as they’re needed. All in all, I got some valuable insight into what my future career might look like! Also, I didn’t mention this at the talk but Solstice was actually one of the companies I applied to before signing up for Coding Dojo. I had no experience and no apps on the app store to show off, so I didn’t even make it to a phone interview, lol. Maybe I’ll have better luck next time!

The same day as Ryan Phillips’ tech talk, Susan, the Dojo’s new career advisor, held a seminar on resume building and highlighting transferable skills. Seeing as most of Coding Dojo’s students are career switchers, most of them will have little or no professional tech experience to showcase on their resume. BUT, career switchers probably do have a wealth of transferable skills like client management, coordination, collaboration, etc.. The point Susan was trying to drill into our heads was that hiring managers want to see what you can bring to the table, tech or not. Career switchers like us usually have more diverse skillsets than CS majors fresh out of college, even though we may not have as much in depth technical knowledge, and that means we can definitely attract potential employers as long as we showcase our skills properly. After Susan’s talk, I realized that my current resume really sucks… lol. Unfortunately, I’d already been sending it out to a bunch of companies, but now that I know how bad it is I’ve kept the spamming to a minimum. At some point I’ll sit down with Susan and fix it up before continuing to apply to places.

The more recent tech talk was today and the speaker this time was Gregg Walrod, from the Nerdery. The Nerdery is another consulting company like solstice, and after Gregg’s talk I was convinced even further that I should be going into consulting rather than a larger corporation or startup. Gregg is actually head of software at the Nerdery and does a lot of hiring, so he was able to give us a lot of pointers about how to successfully make it through the tech hiring process. He stressed readability, documentation and continuation of style as important parts of coding challenges (besides completing the challenge successfully, of course), because how well you handle those three points can give a company hints to how well you’d be able to integrate into a team. He also mentioned (similarly to what Susan was talking about earlier) that he likes to see stuff other than tech experience on resumes. He basically told us not to forget about our old jobs and to include our cool skills we might not think are totally relevant because they might still impress potential employers. He gave an example of a guy who could speak/understand nine dead languages. Sure, that doesn’t really sound relevant to coding at first, but when you think about it, coding is just like learning a language too, and if this guy was able to figure out how to decode egyptian hieroglyphs then who says he can’t figure out C#? This example makes me think I should boast a bit more about my language skills on my resume too. I may not know nine dead languages, but I do know four not dead ones, lol, two of which are Asiatic!

Anyways, that’s about it for non-TDD things in the past week. I did learn to use a couple more cool gems, like BCrypt, for some new shortcuts in Rails, but I can just talk about that in tandem with the testing gems later. Ruby gems are pretty cool, btw. I kinda wanna make one. I also have some ideas brewing for a custom CSS framework. I really want a framework that would allow web styling to be done with constraints, like in Xcode’s Interface Builder, so I’m gonna make it myself with SASS and probably jQuery. I’ll keep ya posted!

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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