Top 3 Concepts to Learn Before Day One:
- Functional Composition
- Higher Order Functions
- Prototypal Inheritance
- 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.
Resources for learning these concepts:
- Fullstack Academy prep courses
- Free online materials
- YouTube Channel - Fun Fun Function
- Paid online materials
Can a Full Stack Developer Exist?
Understanding the Web Application Stack from Front End to Back End
Python: What Beginners Need to Know
What is Python? Is it easy to learn Python? Hackbright Academy instructor Meggie Mahnken explains.