Two Different Views of What Decoupled Code Means

I had a discussion with a coworker the other day on the design of a certain piece of code. My goal was to add a new sub-service to a piece of software that this coworker had been the main architect of, and which I was not particularly familiar with. My initial proposal was to add a class with a specified API, and then instantiate and use an instance somewhere else in the code – about as simple as I could get. Their response was that instead we should have a class which itself calls N different functions which will allow it to register various error-handling routines and the methods it exposes into some calling class. This calling class would then call the registered functions depending on what specification we register with it. The kicker was at the end of describing this approach they said:

This keeps the code decoupled.

Read in full here:

https://www.worldofbs.com/decoupled-software/

This thread was posted by one of our members via one of our news source trackers.

Corresponding tweet for this thread:

Share link for this tweet.