Hacker News new | ask | show | jobs
by delambo 4710 days ago
Here's a trivial example:

I have a Modal class which depends on some utilities in a Utility class, but the Utility class depends on the Modal class because there are some utilities that show Modals.

This is not a broken architecture and is handled just fine by other programming languages/dependency handlers.

2 comments

You want to use inversion of control in your Utility class. Just pass function, which will operate on Modal class instance (not Modal class instance itself but function) as argument to its utilities that show Modals.
The concept of a "Utility Class" is normally a sign that there is something else going on!

What are the utilities contained in this module?