I don't have a very strong grasp of coupling, but I understand that it refers to something that has a high amount of dependencies, but I don't exactly know what that looks so it's hard to point out what the dependencies are or if they even are any. I believe a basic example of coupling would this:
class ObjectB {
public:
Object() : objectA(...) {}
private:
ObjectA objectA;
};
ObjectB
is dependent on ObjectA
if I were to change the constructor or something I would then need to update ObjectB
and I believe I can improve this through methods like dependency injection although I'm not entirely sure how that helps since wouldn't it still depend on the class meaning changes made would still require changes in the other? Here is an example from my own project and I'm curious if this also counts as coupling? if so how?
enum class EditorAction {
ADD_SCRIPT,
ADD_PART,
ADD_MODEL,
NONE
};
void Editor::update(Scene& scene) {
if (m_editorContext.action == EditorAction::ADD_SCRIPT) {
}
else if (m_editorContext.action == EditorAction::ADD_PART) {
}
else if (m_editorContext.action == EditorAction::ADD_MODEL) {
}
}