My words:
Abstraction is the concept of exposing only the required handles to the user, and hiding the undesired details. Eg: handle of gearbox, user only cares about the movement of the handle, and the number to which it points rest all is abstracted from the driver.
Encapsulation: it is binding the code and the data it manipulates into one reusable, real-life entity.
Eg: gearbox, it knows the intricacies needed to change the spears, chain etc on movement of the lever.
//Read it somewhere, but still not sure about it.
Encapsulation is the deliverables of Abstraction. Encapsulation barely talks about grouping up your abstraction to suit the developer needs. Abstraction solves the problem in the design side while encapsulation is the implementation.
No comments:
Post a Comment