HR Week 2: Classes, Algorithms and D3

In week 2 we expanded on instantiation patterns to creating classes, got our hands dirty with algorithms and started using an open sourced charting library (d3). We are settling into a regulated pace where each week is broken down to 3 sprints. Each sprint covers an overarching theme and is tied to a project that we execute in pairs. In addition to sprints, we start off every morning with toy problems (these are typically common interview questions) and we start off every week with a self-assessment. These are a lot of fun and have been great for tracking personal progress even though we don’t get graded.

What we covered this week:

Sprint 1: Subclassing

A class is any construct that can produce a fleet of similar instances–objects that conform to the same interface. @mracus

Classes are blue prints from which objects are created. In addition to that, classes can be used to create hierarchies where a subclass inherits properties from a parent class. Kind of like biological classification: a polar bear shares all of the properties of a mammal plus additional properties of its own. This can be done using the techniques described in last week’s post. There is large debate in the JavaScript community on using prototypal versus pseudoclassical instantiation. By nature, JS is a prototype language (where relationships are created through delegation) but because people attributed JS to Java, the writers were pressured into creating a mask for JS to make it look more like Java, a class-based language. Thus pseudoclassical was born and to date, remains the industry standard. More on what prototype vs pseudoclassical instantiation is here and a visual representation here. Important note on pseudoclassical: This style utilizes the keyword “this”. You cannot assign anything to it because JS does this internally, but you can use it to reference a context in your code. Here are the 2 most important rules to keep in mind when you use or see “this”:

The keyword this generally refers to the object to the left of the dot AT CALL TIME of the function referencing ‘this’. The keyword ‘’this’ can’t possibly mean anything until the function it appears within is running. @mracus

Continue reading

Advertisements

HR Week 1: JavaScript Fundamentals

Week 1 went lightning fast! It feels as if we’ve covered an entire semester of a college CS program already. For the next few weeks, I’ll post all the topics we covered at Hack Reactor and go into depth on one that I find particularly interesting and important. No deep dive this time around due to the unique density of this week.

What we covered this week:

Soft skills

How to succeed at HR, pair programming effectively, what’s it like to be a developer Setting up your dev environment & shortcuts to make you more efficient (details on each of these topics to come in future posts)

Intro JavaScript Content

  • JS syntax and basic wiring: how JS assigns variables, types of objects, how to invoke functions etc. This was a very condensed version of what you would find in an intro JS book, a highly recommended one is JavaScript: The Good Parts by Douglas Crawford
  • Recursion: A function that calls on itself, see below for a brief definiton. Here is a great example.

A task can be solved recursively if, after a little bit of the processing is completed, the remainder of the problem has a structure that remains equivalent to the original problem.” @mracus, Head HR Instructor

  • Scopes and Closures: A scope is the context of a variable and a closure is a type of scope. More on that here – pay extra attention to problems that may arise from JS’s funny way of variable and function ‘hoisting’.
  • Underbar: This was pre-course work we did in preparation for HR and reviewed in our first week (very good for people looking to apply to HR). This is an exercise in rebuilding and understanding what goes on under the hood of the popular JS library Underscore. For finance/non-technical folks, I would think about this as rebuilding some of Excel’s functions such as sumifs and vlookup.
  • Function binding, call and apply: these are all ways you can invoke a function. Use bind(function, context) to guarantee that a function will always be invoked in the context listed. Use call when you want to pass in arguments to a function and you know how many arguments you have. If you don’t know, pass in an array of arguments (of any length) and use apply – a way to remember: “A is for array AND apply” @epic_science

Continue reading

Hello world: How to start programming

On Friday, I left my job at a burgeoning startup, LearnSprout, to focus the next 3 months learning Javascript at Hack Reactor. As a business major, I get asked a lot about how I started programming. This is the start of a blog series where I will share my experiences on the road to becoming a developer, starting with everything I’ve done to get to this current point (disclaimer, you certainly don’t have to do it this way, this is just the condensed story of how I’ve done it minus all the things I wish I hadn’t wasted time on).

Code-Baby

Learn to code! Because apparently programming is now so cool that parents want it to be a their baby’s first language

Step 1: Fundamentals of CS

I started by jumping into lots of online tutorials that promised to be the easy, quick way to learn programming. It was a complete waste of time and none of it made sense until I took the time to learn some basics about CS. There are many MOOCs out there that from elite universities and many different languages that can help you do this. I personally took and recommend Stanford’s CS106a: Introduction to Computer Science because the professor is hilarious and keeps you engaged but any intro class from a university will serve this purpose. Don’t spend too much time picking the language to learn in (I made this mistake and let me tell you, it matters very very little), you just need to know universal principles – what is a method, what is a class, how do I use if loops?

Note: if you choose the class above, it is now available as a Udemy course but I recommend going through the link above, downloading all the handouts and assignments, and following the syllabus. I made myself finish this in 3 months and treated it like night school afterwork – otherwise I don’t think I would’ve ever gotten through it.

Continue reading