Black Boxing in PHP

Nov 27, 2009 Author: Developer

Classes are most useful for black boxing concepts. Black boxing involves
hiding the inner workings of a concept and only requiring the programmer
to think about the higher-level results he is trying to produce.


IMPORTANT: Black boxing is also sometimes called encapsulation; the two terms are interchangeable.The important idea is that using black boxing will allow you to forget how you solved particular problems once you’ve coded and tested their solutions. You will be much less likely to become confused with a large program this way.


For example, the bank account class alone barely provides an advantage
over other approaches without classes. However, by adding error checking
and other features to the class, the class becomes the method of choice over
other methods for representing a bank account within the program.

Although error checking isn’t complex, hiding it within the class allows the
programmer to forget how the class works and merely rely on the fact that
it does. This is often referred to as black boxing.

Another usefulness of black boxing is that a complex task can overwhelm
even the best of programmers. To simplify matters, we divide things into
smaller pieces, ensuring that each smaller piece works as desired, and then
use the smaller pieces to make a larger piece.

For example, after we know that a bank account class works, we can create
another class to model a person’s financial assets as a whole. This requires
multiple accounts, so having the functionality of a single account figured
out and black-boxed allows the programmer to simply think of the accounts
as working objects, leaving him without worry about how the accounts
themselves work.

tags: black boxing

views 3317
  1. Add New Comment