Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • "most of them have just one method" "This looks smelly even in statically checked, object oriented languages such as Java or C#" actually PHP, also in combination with phpDoc, has moved a lot towards "statically checked". This memo has not been received by all PHP developers yet. But it is the way I intend to use it. Commented May 13, 2016 at 21:16
  • "An interface and two classes for just a string? Seems like too much architecture and not much KISS.", "use a IAppConfiguration interface" - At least in one case, the string can come from a config container or from elsewhere. There is some conditional lookup logic going on. So the string itself is simple, but the way to retrieve it not so much. Commented May 13, 2016 at 21:20
  • "Lazy<T>" (or Lazy<string>): In PHP this would mean adding a "callable" parameter to the constructor. This works, but it is not as self-explaining as an interface, and also not type-checked. If you have multiple such parameters, it is easy to inject the wrong callback in the wrong parameter. Commented May 13, 2016 at 21:26
  • "Inject information just-in-time" This makes the object mutable, which is often undesirable. It is like the toaster that starts out at level 2, then one user sets it to level 5, and the next user has burnt toast. Also, currently some usage contexts expect that the component can retrieve this information by itself. Commented May 13, 2016 at 21:29
  • "DAL shouldn't even know anything about the aspect of application configuration or even application per se." yes this was also my thought, yet another reason i did not want to pass a IAppConfiguration object. In this case, the component is not meant to be used outside the application, but it feels cleaner if it does not have to know where the info comes from. Commented May 13, 2016 at 21:34