I've been talking to a colleague that comes from
AS3 to the
HTML world. He has created a small website (there are apparently no dynamic contents) following the no-flash rules for his very first time, and as if you own a hammer you tend to hammer everything, he decided to create a framework in
AS3 way", with frames, pure X-Y coordinates animation and so, to animate contents. The page would be fully loaded at first, load the vast amount of JS at first and then the page would be accessible without changing url.
Views would turn into class methods (where the class represents a section, and the method stands for a view) which append text to a variable that is then added to a div. He defends this situation with many reasons:
- Websites with a high amount of users do this to prevent server overloading.
- It is easier to create new sections.
- It is easier to translate, as translations, texts and almost everything is loaded from a
- You can expand more sections directly from a
- Everything is smooth, as you don't move to another page.
Now, here comes the PHP-loyal developer, which defends the opposite side. I say that views should be split into smaller files but contained in
.php or even
.html files, with the business logic in a controller and the view logic in these files. This releases the client, as it can disable
- You don't need to load the whole website at first. Webpages loaded faster.
- Your urls are always clean and (in case you did so) friendly, without plugins and working seamlessly in old browsers, as you move to another page.
- Views are kept in independent files, so it is easier to work with them in a team.
- Views are regular
htmlfiles, instead of calls to methods appending strings, so editing them is just natural.
- You still need
PHP(or any other language) to load data from a server (NodeJS not considered here)
And, of course, here comes the real question. Should views be rendered on client or server side?