5

I have been reading up on the seminal and excellent book Code Complete. It discusses about the various kinds of couplings that can happen between modules(which may be classes as well as methods):

  1. Simple-data-parameter-coupling
  2. Simple-object-coupling
  3. Object-parameter-coupling
  4. Semantic coupling

The book has to say this about object-parameter coupling :

Two modules are object -parameter coupled to each other if Object1 requires Object2 to pass it an Object3. This kind of coupling is tighter than Object1 requiring Object2 to pass it only primitive data types because it requires Object2 to know about Object3.

What is the author trying to mean here?

yannis
  • 39,647
Geek
  • 5,217

1 Answers1

2

an example: imagine object1 requires object2 to pass it a time-stamp:

  1. case 1 (tightly coupled):
    object2 passes a custom Time-instance (object3):
    therefore object1 must know how to extract the necessary data form this object

  2. case 2 (less coupled):
    object2 passes seconds_since_epoch (integer), object does not have to know the internals of another object.

kr1
  • 1,053