3 Must-Know Concepts Before Day 1 at a Coding Bootcamp
Inside This Article
By Imogen Crispe
Last Updated March 10, 2017
Top 3 Concepts to Learn Before Day One
Higher Order Functions
DEFINITION: Combining simple functions to build more complicated ones
Your code should be broken up into small functions, each of which does one thing well. Then, string these functions along. The output from one function becomes the input to another function
SUMMARY: Learning how to write functions which chain together is an approach which tends to make the code easier to reason about. This works best when functions are pure, i.e. they don’t rely on or use anything except their inputs.
Higher Order Functions
DEFINITION: functions which take other functions as input, and/or return functions as output
Example: suppose we have a simple function “add” which adds one to a number: n => n + 1. A higher order function could take in that simple function, and give us back an enhanced version. This new function behaves similarly to “add”, but also keeps track of how many times it is called.
SUMMARY: Higher order functions make for really interesting programming techniques, where functions can be transformed, enhanced, and used in abstract ways.
Prototypal inheritance is similar to class-based inheritance from object-oriented languages
Classes are a blueprint; you can spawn multiple instances with properties copied from that blueprint
Prototypes are a source; you can spawn multiple instances that share properties on the prototype
However, prototypal inheritance actually differs from class-based inheritance in an important way
With classes, properties are copied down into the instances, but are then separate
With prototypes, instances point back to their prototype; changing a prototype property changes all the child instances
SUMMARY: The differences between prototypal inheritance and classes are:
classes: the instances are copies of the blueprint
prototypal inheritance: new objects are just pointing back to a prototype object. Objects delegate to other objects.
Imogen is a writer and content producer who loves writing about technology and education. Her background is in journalism, writing for newspapers and news websites. She grew up in England, Dubai and New Zealand, and now lives in Brooklyn, NY.