Abstraction in Node

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.

Next Lesson ➔

Mark Winteringham's photo
Author

Mark Winteringham

@2bittester

Mark Winteringham is a tester, toolsmith and the Ministry of Testing DojoBoss with over 10 years experience providing testing expertise on award-winning projects across a wide range of technology sectors including BBC, Barclays, UK Government and Thomson Reuters. He is an advocate for modern risk-based testing practices and trains teams in Automation in Testing, Behaviour Driven Development and Exploratory testing techniques. He is also the co-founder of Software Testing Clinic a community raising awareness of careers in testing and improving testing education. You can find him on Twitter @2bittester.

Comments