Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few things that spring to mind:</p> <p><strong>Code Separation</strong></p> <p>Although embedded JavaScript within an HTML page is widespread, many consider the practice of code separation to be good. In this respect I am referring to the placement of the JavaScript in a separate file. This is part of a broader concept known as <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript" rel="nofollow noreferrer">Unobtrusive JavaScript</a></p> <p>As web developers, we are required to know many different technologies, e.g. some of:</p> <ul> <li>Server Script (PHP, ASP, Ruby, etc)</li> <li>JavaScript (and framework)</li> <li>XML</li> <li>HTML</li> <li>XSLT, XPATH</li> <li>CSS</li> <li>SQL</li> </ul> <p>Imaging a code file that contained all of these! It would be chaotic!</p> <p>Outputting JavaScript from the server precludes the separation of JavaScript into a separate file. If we separate these out then our code becomes more modular, reusable, readable and testable, which leads me to...</p> <p><strong>Unit testing</strong></p> <p>You may not personally be using a unit testing framework, however the modularisation of JavaScript is essential for creating independant testable (and reusable-testable) modules.</p> <p>Script that is output on the server is not modularised, but more importantly is not static, so is difficult to fit into any unit testing framework.</p> <p><strong><a href="http://en.wikipedia.org/wiki/Tag_soup" rel="nofollow noreferrer">Tag Soup</a></strong></p> <p>Although it is possible to code against this, mixing of client and server script has a tendency to produce <a href="http://en.wikipedia.org/wiki/Tag_soup" rel="nofollow noreferrer">tag soup</a>, making it hard to read and maintain.</p> <p><strong>Debugging</strong></p> <p>I'm not sure what IDE you are using, but mine allows me to step through the JavaScript that I have written. Outputting it from the server mean's I can't do this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload