Course Home | What is Abstraction? | Code Example(s)
So as discussed in the Programming Basics course, abstraction is the process of hiding specific code and moving it away while ensuring the function still gets the values it needs.
A useful heuristic when thinking about abstraction is DRY. Don’t Repeat Yourself. If you’ve written the same code twice, it can’t be that specific, therefore could potentially be moved away. A great benefit of abstraction is having single functions that do something specific really well, that many other functions can call. This means they get the info they want, but not the specifics. Then if the specifics change, we change it in a single place, and all the code utilising it, gets updated. They still get the value they wanted, even though the specifics have changed. They would never know because they don’t need to know.
Please use the link about to see some examples in Node.
Comments