Here are notes from our three hour review session of all the curriculum we’ve covered in boot camp. Well, not all the curriculum. Just some highlights/important parts/tricky parts.
The Four Principles of Object-Oriented Programming
Popular technical interview questions come from these four principles!
ABSTRACTION:
Create real world objects
POLYMORPHISM
Change (inherited) behavior of parent class
INHERITANCE
Cat inherits fur from mammal class
ENCAPSULATION
Data hiding; keeping parts of a class private
Use attr_accessor to make available to other classes
Modules allow for multiple inheritance. Keywords to make this happen:
include or extend (to turn them into class methods)
Ruby, blocs, prods, lambdas
Also a popular area of for interview questions and just plain important/useful to know for coding.
***Things You Will Google 1000 Times as a Pro Rubyist (according to Matt)***
ruby include vs extend ruby map vs collect
Testing:
Better to have a fat model and slim controller because it is harder to test the controller, always better to test the model.
Javascript:
Callback Functions:
-Super important to know, will see everywhere, especially with node.js
-They’re basically just events? because ‘click’ is a click event that is called on when the action takes place so I guess it’s a callback…what else makes up the callback group?
$(‘#div’).on(‘click’, function (e) {
alert (‘this is a callback’);
});
-It’s the part of a function that gets called on later. So a function can have multiple callbacks, that will run depending on when they get called back. Basically, it’s a way to refer to shit happening inside a function. It makes my life more confusing right now; but will probably make perfect sense once I work with Javascript more in an applied setting.
-Something about the function knowing in good faith that you will pass it a function…? a callback function?
-Ps: you can call callback functions into callback functions.