You have no context of my implementation to immediately assume ... that I am in fact creating spaghetti code.
Sorry. But when you said:
it is useful to know the action being executed to validate for certain parameters to execute that action.
you gave me that context.
A subroutine or method that needs to know where it is called from, in order to validate its arguments, *is* spaghetti code.
It means that each time you need to call that subroutine from a new piece of code, you have to modify the subroutine to handle the new caller. And that type of codependency-at-a-distance is the modern reincarnation of spaghetti coding.
And for the record, as anyone familiar with my writings here will confirm, I'm not at all religious about OO. Indeed, I'm kinda known for railing against the dogmatic overuse of OO.
Nor am I religious about any other particular coding methodology. OO, used appropriately and correctly, is just another tool in the coders toolbox. Along with FP, and procedural, and event driven and any other you care to name.
But there are certain fundamental principles in coding that hold true across all coding styles, and loose coupling is one such.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|