Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 3
    @Daniel B: Yep, it's the same thing why managers measure "hours of work" or "lines of code" or "number of bugs". Few of them really believe that such metrics are very meaningful, but it's easy to measure, so let's pretend it's better than nothing... Commented Dec 5, 2011 at 8:23
  • 21
    +1, very true. That's one of the things I like about Test Driven Design, it lets you know the state of coupling/cohesion. If you need to start each test with 10 lines of mocking/stubbing, you might have a problem with these things. Commented Dec 5, 2011 at 8:31
  • 3
    Coupling and cohesion are often thought of more easily with compartmentalization (but must be thought of as their own goals). Commented Dec 5, 2011 at 17:32
  • 6
    -1. Coupling and cohesion are extremely subjective and too much emphasis on them often leads to ravioli code, where the individual parts are trivial but it's almost impossible to see how they fit together. Commented Dec 6, 2011 at 19:53
  • 5
    I have to agree with @dsimcha. Loose coupling sounds like a good idea on paper, but in practice it turns your system into a maintainability nightmare once it grows past a certain size, for precisely the reason he stated: you have no clue how things fit together. For example, if you've got an object of class Foo, and you call Bar on it, you can tell your IDE to find Bar and you know exactly what's going on. But if you have a more loosely coupled IFoo reference, and you call Bar on that, it can require tons of searching to find which class you're dealing with so you can look up Bar. Commented Feb 19, 2013 at 17:00