3 ms·
Could you offer some form of explanation as to why you find conditional includes so odious?
by knieveltech 14y ago
Could you offer some form of explanation as to why you find conditional includes so odious?
- mootothemax 14y agoCould you offer some form of explanation as to why you find conditional includes so odious? It boils down to sloppy thinking; your objects should be well defined enough that you're not having to include extra pieces of code in the middle of execution. You could argue code reuse - but why isn't that code either part of the object in the first place, or an object in its own right? If you know some examples of elegant code written with includes scattered throughout it, conditionally or otherwise, I'd love to see it. I will make exceptions for some parts of page rendering; it can sometimes be a good idea to put page elements into their own files and pull together when necessary. But for including code? No. Just no. Edit: I took exception in this case, as it's non-obvious what happens once the view file has been included, not to mention the lack of a base example handler class implies and encourages people to write code like this.