Note:
1. Learn the video address
2.ppt Address
3. Personal Impressions:
Is my great master recommended me to see the shadow of the month big video, I feel for this small white, really is over and over again refresh knowledge. I feel like the Moon shadow greatly this big guy's train of thought, my contact after really benefited.
So I summed up not only my own notes, but also want to be a true front-end "engineer" front-end er.
Really cherish this knowledge is refreshed feeling-the more study, the more feel their ignorance, mutual encouragement.
Summary
1. The data abstraction is for the processing;
2. process abstraction (e.g. higher-order functions) is for function processing;
3. use higher-order functions to modify the interface of an existing API without affecting the internal content of the function.
Directory
One problem: Modifying the order of parameters in an existing API
1. Direct rewrite
2. New function call
3. Using higher-order functions
4. Summary
Body
problem: To change the order of parameters in an API:
1.
Direct Rewrite
function SetColor2 (el,color) { El.style.color=color;}
Disadvantages:
if the API is complex, rewriting costs are high
And it's a bad name.
2.
new function Call
function SetColor2 (el,color) { setcolor (color,el);}
No need to control API internal logic, but still not good naming and management
3.
create higher-order functions
Can reverse the order of all functions
function Reverseargs (FN) { returnfunction(... args) { args=args.reverse () ; return fn.apply (this, args) }}setcolor=reverseargs (setcolor);
Do not modify other people's code, do not care about the specific function, only the abstract process
Very High reusability
scalability is high, for example :
use timeout to make the function Execute after a few milliseconds, with bind after the function Milliseconds to execute output statements
(Changed the API's more interface information)
Summary:
1. The data abstraction is for the processing;
2. process abstraction (e.g. higher-order functions) is for function processing;
3. use higher-order functions to modify the interface of an existing API without affecting the internal content of the function.
Odd Dance JS Note--*--process abstraction, higher order function, function oriented programming