Montag, 13. Februar 2012

Should I specify every interface?

In many discussions about iDocIt! people raise the question on the added value of specifying every interface (e.g. a Java Interface) in every project? This is a good and reasonable question. 

Personally I made the experience that it is quite helpful to reflect own thoughts, especially when writing software. To be honest, this is my motivation to specify an interface. Such reflections of own thoughts could be done by writing pseudocode on paper, writing unit tests or when specifying an interface in the code. But it costs time and, as we all know, this resource is strictly limited ;).

I think, that interface specification has an added value under one of these conditions:

  • The interface provides complex operations and one has to think about them carefully (for reasons see the above paragraph).
  • The interface is provided to developers in other organizations (e.g. another project, division or even another company). For two reasons: 
    1. The colleague who implemented the interface is not or rarely reachable.
    2. To avoid argues ("Who has to catch the null-reference and who pays for it? The implementing company or the invoking one?")
  • The system is going to be run a lot of years and one could assume that some colleagues will leave the team or even the company.

Keine Kommentare:

Kommentar veröffentlichen