I don't see how it breaks MVC. It does not. It's just a template engine directly integrated into the language just like LINQ is SQL directly integrated into the language. This adds type safety and other safeguards that would usually be missing with an external template engine / ORM without language support. Neither XHP nor LINQ break solid architectural patterns. Adhering to those is up to the developer, not the tools he uses.
This is not how we use it internally; I'm not sure if it was at the time, or if this example was just structured like this to be more approachable in the context of a blog post.
TL;DR: we feel that encapsulation of a logical component is more important in some situations, and it can have performance benefits due do reducing over-fetching.
4
u/Schmittfried Sep 19 '17
I don't see how it breaks MVC. It does not. It's just a template engine directly integrated into the language just like LINQ is SQL directly integrated into the language. This adds type safety and other safeguards that would usually be missing with an external template engine / ORM without language support. Neither XHP nor LINQ break solid architectural patterns. Adhering to those is up to the developer, not the tools he uses.