« back

Black Box Abstraction

02 Nov 2012

Sometimes, I just want to know what's in that damn box!

What is "Black Box Abstraction"? It is a technique for controlling complexity and abstracting detail. The point of doing this is to allow you to to build bigger things. Hopefully bigger boxes. This is done all the time in methods or functions, in gems, in frameworks. Consider this from the book Structure and Interpretation of Computer Programs by Harold Abelson and Jay Sussman with Julie Sussman...

"So a procedure definition should be able to suppress detail. The users of the procedure may not have written the procedure themselves, but may have obtained it from another programmer as a black box. A user should not need to know how the procedure is implemented in order to use it.

This automatically makes me think of Ruby on Rails but this can be as simple as referring to a function. Something to keep in mind, is that a black box can contain a procedure who's value is another procedure. This can really allow you to build powerful things. I think the important part to keep in mind is that the abstraction is there to help you focus on making new things or bigger things. Sometimes, okay, maybe a lot of times, it is tempting to want to know what's inside that damn box! but you should ask yourself to what level you need to know that information and if knowing it at this point in time will truly help you with what you are working on. If the knowledge gained from opening the black box is not going to help you directly solve the problem you are working on, leave it closed until you need it or save peeking inside for a time when you are allowing yourself to just poke around with things but not when you have a deadline or are focused on finishing a certain task. Consider languages in general. You do not need to know how they compile to use them. Would this information be useful for a better understanding? Yes. And when you are at a point further along in your career or have some extra time, this may be information to help you solve a problem. Do you need to know that to write a simple program? No. You don't even need to know that to get a moderately complicated program constructed. The whole field of computer programming is possible because of these black boxes. Maybe, instead of being preoccupied with wanting to know what's inside the boxes, getting familiar with how to use them would be a better use of effort. Allow the details to be swept under the rug. Then, when you have time or you need to, as if a present given to you on Christmas, you can unwrap that black box and peek inside. The recursive part about that is that there will likely be more black boxes inside that box and you will be at a point to repeat the whole process again. So remember before you hate the abstraction, the sweeping under the rug of the details, and the magic, you can look at a black box not as a mystery, but as a lego, a tool, an assistant, that is there to aid you in building bigger things.

comments powered by Disqus