ieugen commented on PR #837: URL: https://github.com/apache/ofbiz-framework/pull/837#issuecomment-2411049774
Hi @OmarAbdullwahhab , Thanks for the suggestions. The case for Debug is an example. The same issues - circular dependencies are systemic to OFBiz. Look at UtilProperties and UtilCache relationship . Look for uses of Entity* classes in some of the utility classes - Entity being high level layer and Utility being a low level layer (IMO) . There is a pattern where some classes (UtilProperties + UtilCache is one example) initialize state as static fields. > private static final UtilCache<String, Properties> URL_CACHE = UtilCache.createUtilCache("properties.UtilPropertiesUrlCache"); These initialization bind the two classes in a circular dependency : UtilProperties depends on UtilCache that depends on Debug that depends on UtilProperties. In some cases we can avoid duplication if we pull out the initialization and move it into Main class for example. So when the app starts, we can create the cache and assign it to UtilProperties. This is a solution that should be less invasive. The pattern here is the one described by Dependency Injection / Inversion of Control. OFBiz does not use any dependency injection framework/ library. Using such a dependency injection framework would make these kind of issues more visible. We can do without an IoC framework, but it requires a bit of discipline and an eye for the patterns. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ofbiz.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org