Reuse Implies Coupling

From WikiContent

(Difference between revisions)
Jump to: navigation, search
(first version with some substance)
Line 1: Line 1:
-
Do not make your code depend on some file that is intended to change with project's progress.
+
Do not make your code depend on some file that is intended to change as the project progresses.
-
It is very convenient to have a global file that lists all error codes in the system. When starting the new component, you proudly add a handful: look, I am a part of this!
+
It is very convenient to have a global file that lists all error codes in the system. When starting the new component, you proudly add a handful: look, I am a part of this! Only to find you colleagues to mourn about the extra build time. How dare you change this file?
-
Only to find you colleagues to mourn about the extra build time. How dare you change this file?
+
Couldn't you just do what everybody does:
Couldn't you just do what everybody does:
-
* reuse some error codes that are already in there.
+
* reuse some error codes that are already in there.
-
* when existing codes don't match the intended meaning, document their specific meaning in your component documentation.
+
* when existing codes don't match the intended meaning, document their specific meaning in your component documentation.
-
The error.h file was intended to provide a great place to look for the meaning of codes. At the same time, it is a central component that is intended to change as the project proceeds. So it is your base, but it is quicksand.
+
The <code>error.h</code> file was intended to provide a great place to look for the meaning of codes. At the same time, it is a central component that is intended to change as the project proceeds. So it is your base, but it is quicksand.
How to get out? Consider this:
How to get out? Consider this:
-
* real generic error messages (in the style of stl exceptions)
+
* real generic error messages (in the style of STL exceptions)
-
* a distint error.h file per component
+
* a distinct <code>error.h</code> file per component

Revision as of 12:16, 15 October 2008

Do not make your code depend on some file that is intended to change as the project progresses.

It is very convenient to have a global file that lists all error codes in the system. When starting the new component, you proudly add a handful: look, I am a part of this! Only to find you colleagues to mourn about the extra build time. How dare you change this file?

Couldn't you just do what everybody does:

  • reuse some error codes that are already in there.
  • when existing codes don't match the intended meaning, document their specific meaning in your component documentation.

The error.h file was intended to provide a great place to look for the meaning of codes. At the same time, it is a central component that is intended to change as the project proceeds. So it is your base, but it is quicksand.

How to get out? Consider this:

  • real generic error messages (in the style of STL exceptions)
  • a distinct error.h file per component
Personal tools