January 4, 2009

Encapsulation

Posted by Sudhindra Rao

The idea of block structure originated with the programming language Algol 60. It appears in most advanced programming languages and is an important tool for helping to organize the construction of large programs. - SICP

* Block Structuring is a way for a procedure to have internal definitions that are local to that procedure. This prevents name collision at minimal and provides simplification. Along with this it also allows the user to unclutter their minds and think in terms of details they are interested in. Splitting a program into smaller procedures and internalising a lot of details leads to good *encapsulation* and better understanding of the overall program.

Inspite of it being such an old idea why do I still come across code that has 300 lines of if_else, case_switch statements in a single big method.

1 comments:

Vivek said...

because software development as an engineering practice is still applied very loosely and unlike other forms of engineering the impact is not readily visible.

Welcome