DEV Community

Discussion on: Seemingly clean code

Collapse
 
chrisza4 profile image
Chakrit Likitkhajorn • Edited

Thanks.

I think the God object cause this. But to look further, I believe the tendency to create a god object happened because we need to implement a change that require some information or variable that exists in other object/method.

And the easiest way to allow new change to access that information, is to put that information in the scope that is accessible from both current method and new method.

Hence: God object that includes every changes made, communicate by implicit dependency using private fields.

The better way to do this is to be mindful and put a thought into how should we pass this information around.

One thing I learned about software engineering in general is: Be mindful about communication flow between subsystems. Make it as simple and clear as it can be.

This apply to every level of architecture. This principle is valid from high level architecture such as 3rd-party integrations, Microservices, Event-Driven design - to granular level design such as Objects and Methods.