Zend certified PHP/Magento developer

Is every hard-coded class name against “inversion of control”?

How far would you go to make implicit dependencies explicit? I’m thinking if you’re hard-coding a class name in another class, you’re actually not using dependency injection. But can such a rule be applied sensibly? Or would it amount to intellectual masturbation with low real-world usage?

For example, I was moving a static function in an ORM class to a separate service class. The function used a query builder class. I could either leave it as-is, or supply the dependency with a factory class, or a lambda that returns a new query builder object. This would separate the framework from business logic.

I dont’ know. What mental heuristic are you using to make your dependencies explicit?

submitted by /u/usernameqwerty003
[link] [comments]