Module Design

Structuring codes can be very subjective. The module design provide an agnostic interface to organize codes in a way that would make sense for other people and for yourself 4 months after you wrote your codes. Failing to well organize your code, will take you and people using your code more time to understand.

Any code organization can be reshaped if one puts much thoughts to it. this to mean that there is no must follow ultimate single truth when it comes to code organization. the more you organize your codes into different projects the better your skill of code organization will be.

Circular dependency

Circular dependency, occurs when module A depends on module B while B somehow, directly or indirectly depends on module A. This is usually forbidden, as for it can lead to unpredictability. cause you can not be sure whether module a Dependencies are fully loaded for B to use yet B is awaiting Module A to be loaded.

Cyclic dependency should be avoided at all cost, usually they occur when poor design pattern is used in a project. There are different ways one can fix circular dependencies inclusing:

  • Applying a good design patter: This is by avoiding tight coupling between components, use better separation of concern when it comes to code organization etc..
  • Use linters that can help one resolve circular dependency
  • Follow best practice with when using framework that supports dependency injection etc.