2 ms·
@MatthewPhillips maybe because the logic to generate JSON and HTML is very often quite different and having a tight coupling at this level might result in some
by mattetti 14y ago
@MatthewPhillips maybe because the logic to generate JSON and HTML is very often quite different and having a tight coupling at this level might result in some serious pains later on.
- MatthewPhillips 14y agoHow are they tightly coupled? You take the same data and either run it through a Json serializer or a view renderer.
- mattetti 14y ago> You take the same data and either run it through a Json serializer or a view renderer. My experience might be different than yours, but very often my html views quickly end up needed more than 1 resource to render and now I need to fetch data just for the html templates. The same data set isn't needed when returning json or xml and the API end points exposed for data consumption are often quite different. That said, in some cases, I agree that your approach would work.