Published in WordPress
avatar
2 minutes read

WordPress Plugin: How do I avoid "tight coupling"?

I am working on a WordPress Plugin and am trying to ensure best practices. I have two classes, my plugin class "Jargonaut" which is required and then another class called "Dictionary" which is included with require_once() into my main plugin file.

Most of the code in the Jargonaut class addresses initialization and provides controller-like functionality but much of it is highly dependent upon using the Dictionary object (i.e. tightly coupled from my understanding of the term). I wish to keep the Dictionary class separated as it is acting more like a model (in MVC architecture) and interfaces with my database.

I see a lot of gray area in the tight vs. loose coupling and am having a hard time deciding how much is too much?

  • php
  • wordpress
  • oop

Comments