Showing posts from 2015

Semantic coupling

Code Complete is one of those books every developer should read. There is a section in chapter 5 of this book which talks about coupling. Although coupling between software entities is not totally avoidable in all of its flavours in even very simple programs, there is a special kind of coupling that we developers should all condemn: Semantic coupling. According to Code Complete:
"The most insidious kind of coupling occurs when one module makes use, not of some syntactic element of another module, but of some semantic knowledge of another module's inner workings" I have wrote some semantically coupled code, I must confess. Not a very shocking confession though. I have found out that pretty much all the developers I have worked with, have semantic coupling in their criminal records. With the aim of making the programming world a bit more lawful, let me show you two basic examples of semantic coupling I found in my own code:

Disclaimer: Class and method's names have been…