Sunday, September 20, 2009

c++ Insulation (IV)

So let's talk about good reasons to adopt insulation. Suppose you define a class; then you may want to modify it. For instance, you need to add a bool. Any client of that class is forced to recompile. Not a good thing when you need to manage a large project, distributed in many different locations.

Let's see other situations where you can have dependencies.
  • default arguments. If you use default arguments in your method, and then you decide to change them your clients will be forced to recompile.
  • enumerations. If you put your enumerations in your .cpp file they are hidden from the client. If you put your enumerations in your .h file, you will introduce a dependency

No comments:

Post a Comment