Monday, 4 April 2011

Nested Types

The ideas behind encapsulation and abstraction, to a certain extent, are about you as a developer keeping control of your code and how others use your code. For example if there's an operation in your library that would have bad consequences, you make it difficult or impossible to do.

Developers being able to understand your code is also very important. Putting things in context makes understanding your code easier.

What's my point? Nested types, enums, constants etc, not only help you control the way your code is used, they also identify those nested things as belonging to the context of the class in which they are nested.

No comments:

Post a Comment