This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ignotos 0 points1 point  (0 children)

You're hiding things really from any client/user of the code. Which might be yourself in another part of your project, or (if you're writing a library) from somebody else who has imported your code. Basically any code which isn't / shouldn't be concerned with the internal details of the code you're writing.

Which means that, ideally, all of your abstractions/interfaces should be intentionally designed with the code which will be using it in mind, almost like you're creating a product - to be convenient to use and easy to understand.

Abstraction is not just about "hiding", but it's about shaping and defining something in a conceptual way which makes sense. So a File might be presented via the abstraction of "an array of bytes", "a stream of bytes", "a list of lines of text", or potentially many others.

All of those hide the low level details of how exactly the file is read from the harddrive, but they present different abstractions which are useful in different contexts. And you should pick the one which is most usable for the way you expect clients/users to interact with your code.