Front End Certificate at Free Code Camp – Complete!!

Five months and one day after I discovered Free Code Camp, I’ve completed my Front End Certificate.

frontEndCert

It took a little longer than I had originally planned, but considering that in addition to learning HTML, CSS and JavaScript from scratch, I maintained a full time job and tried to spend (at least some) time with my family (including coaching a season of baseball), I’m pretty happy with the accomplishment.

A couple thoughts on the process….

When I discovered Free Code Camp, I rolled up my sleeves and began the front end development section with tunnel vision, focused only on completing the certificate.   Along the way, my focus broadened… I began to realize that this process isn’t just about completing a certificate, but becoming a strong developer.

To that end, I searched for additional resources to supplement the Free Code Camp curriculum.  I covered a lot of these resources in a previous post, but mostly it involved listening to podcasts, reading books, watching YouTube videos and practicing algorithms.

I also started this blog.  If you would have told me before I started this process that I would start a blog on learning to code, I would have labeled you crazy…

I’m an introverted guy and generally keep my thoughts to myself, so expressing myself in these posts isn’t exactly second nature. I think, however, that doing so has significantly enhanced what I’m getting from this process (and hopefully helped at least a couple others in return).

I’ve also found that trying to explain the solution to an algorithm is, in many ways, much harder than writing the solution itself!  I think this has certainly helped strengthen my coding skills and plan to continue working through the solutions to many of the freeCodeCamp algorithms and projects here at crookedCode.

So, if you find yourself getting frustrated with your progress in your own learning to code journey, take a step back and ask yourself what else you could be doing to broaden your learning experience.

And finally, I want to say – Learning to code is hard!  

This journey has been difficult in many ways I could not have predicted at the onset. First, of course, learning a new skill (any new skill) can be difficult.  Coding is certainly no exception, in fact, I’d argue just the opposite.  

I feel the difficulty is often overlooked in the many articles (at least the ones I’ve read) that proclaim everyone can learn to code.  Many of these articles fail to mention that it’s going to take a lot of work and a lot of extremely frustrating, trying moments, especially if you’re teaching yourself.  

I’m not arguing against the idea that people should learn to code…  If learning to code interests you, then by all means, let nothing stand in your way. Before you start, however, make sure that it’s something you really want to do and make sure you’re prepared to commit the time and mental energy to accomplish your goal.

In addition to the difficulty inherent to learning to code, many other aspects of the journey add to the difficulty…

Time management has been a big one for me.  Keeping a full time job, having a wife and two active sons and learning to code is a very full plate.  Through most of baseball season, I just coded whenever I could fit it in the schedule…

It seemed like there was something going on every night and throughout the weekend, so whenever there was a break, I would try to put some work in.  I’ve got to say though, that pace is unsustainable if you value your mental health and the happiness of your family.

Since baseball has finished, I have blocked off two evenings and one day on the weekend that I devote to learning to code.  Everything else (at least when I’m not at my full time job) can be spent with family or catching up with stuff around the house.

If you are learning to code and have other personal commitments, I highly recommend blocking off a schedule of when you plan to work. Otherwise, you always feel like you should be working and everything else in your life takes a back seat, and suffers because of it….

Of course, there are other things like maintaining self-confidence, battling impostor syndrome, deciding what to learn, setting up a development environment, etc., etc. but this post is already longer than I had planned.  Just know that if you are struggling in your journey to learn to code, you are not alone, there are plenty of us out there in the same boat.

So, if you’re still reading this, thank you and good luck on your own journey.  I’ll keep posting here at crookedCode to try to make things easier for those that actually read it.   As for right now, I’m off to start the back end development certificate at Free Code Camp…

-Jeremy

FCC Intermediate Algorithm Scripting Challenge – ‘DNA Pairing’

 

Today, we’ll cover freeCodeCamp’s Intermediate Scripting Challenge ‘DNA Pairing‘.  The challenge here is to write a function that accepts a string of characters and returns a 2D array of matched base pairs.

If you’re not caught up with your molecular biology, here’s a quick lesson…

Molecular Bio 101 (mostly not needed to solve algorithm)

By Zephyris at the English language Wikipedia, CC BY-SA 3.0
By Zephyris at the English language Wikipedia, CC BY-SA 3.0

DNA is the double stranded nucleic acid that carries your genetic information.  Each single strand is composed of units called nucleotides, of which, there are four – cytosine (C), guanine (G), adenine (A) and thymine (T).  In double stranded DNA, these nucleotides bond in specific base pairs, A with T and C with G.

DNA stores all kinds of biological information and make up our chromosomes, which, in turn, make you who you are…  Enough bio, let’s get back to solving the algorithm….

Bio Class Dismissed…

As we get into the intermediate and advanced algorithm challenges, each challenge will have multiple (even many) approaches to a solution.  My plan with Crooked Code is to explain the solution that I used, then search for solutions used by others in order to illustrate the various ways an algorithm can be written.

This is what freeCodeCamp gives us as a starting point for ‘DNA Pairing’:

The instructions provided for this challenge tell us that we’ll be getting a string as an argument and we must return a 2D array that matches up each element (letter) with it’s base pair counterpart.

Let’s get started working on a solution…

I started by ‘splitting’ the string argument into an array using string.split() method.  I covered string.split() in depth here.   I also created some variables that we’ll use later in the function.  My ‘pairElement’ function now looks like:

We now must scroll through ‘singleArr’ and pair up each element with it’s matching pair.  We can use a for loop to scroll through the array, but how can we match up the pairs?

A bunch of if/else statements would work but a switch statement is a better option here.  A switch statement will evaluate a given expression, then transfer control to the case that matches the outcome of the expression.

I’ve included the syntax of a switch statement written by mozilla in order to make the explanation easier.

In our case, the expression will be just a letter, as will each case value.  We can then write a statement to be executed for each individual case.

To sum up the logic for our algorithm…

  • split the given string into an array
  • loop through array and match each element with it’s pair
  • ‘push’ each new pair into 2D array
  • return 2D array

At this point, we’ve covered everything needed to solve the ‘pairElement’ function.  If you’re working through the freeCodeCamp curriculum you may want to go try to solve it on your own, otherwise, read on…

Spoilers_ahead

Here’s the solution to the ‘DNA Pairing’ challenge that I came up with:

The freeCodeCamp wiki page (written by @Rafase282 and @sabahang) provides 2 solutions to this algorithm challenge.  The first, ‘basic’, solution is very similar to mine, using a switch statement, so I won’t include it for the sake of redundancy.

The second, ‘intermediate’, solution uses an object, and we haven’t really covered objects in much detail here at Crooked Code.  I’ll include the code below so we can see a second, very different solution, but won’t provide an explanation, as objects are far too big of a topic to cover at the end of this post.

You can see an explanation to this solution at the wiki page.

That’s it for now, hopefully this helped straighten out the code…

-Jeremy