(2 days – RAT802)
While JavaScript lacks many
features found in more powerful languages, and escapes the heavy demands that
they experience, the complexity of modern web sites and their functionality
means that the serious JavaScript developer benefits from acquiring as many
advanced approaches and techniques as possible.
This two-day course establishes
fundamental aspects of design theory, and from there, develops powerful
principles; including the use of the Strategy pattern to circumvent
cross-browser coding headaches, the use of object decoration in performing
complex processing of user input, and 'AJAX' or Asynchronous JavaScript and
XML.
AJAX – a moniker for the use of
XMLHTTPRequest objects in web-page scripting – is an approach to client-server
communication, wherein a given transaction channels server-side data into a
client-side script object. Using established scripting and Document Object
Model techniques, this data can then be used to update elements of the page
dynamically, without causing the page to be refreshed entirely.
The core technique is relatively
simple, and gives developers great latitude in site design, while obviating the
use of less elegant approaches such as hidden frames or browser plug-ins, which
may not be available on all platforms. This allows web applications that were
previously impracticable, and that are more flexible, intuitive and easier to
use, thus providing a more rewarding user experience. Moreover, the continuing
integration of the desktop, local file-systems and the Internet – a pillar of
the next version of Windows – places AJAX techniques at the centre of client-server
development.
All technologies however, including
XMLHTTPRequest, carry choices, caveats, and considerations. For example, AJAX
does not mandate the use of XML as a data format, as plain text, binary data,
and newer encodings such as JSON, can all be employed. Moreover, HTTP
connections, for which XMLHTTPRequest is a wrapper, are capable of more than
simple data-transfer, plus there are wider design implications, all of which
figure in the application of this technique.
This course provides comprehensive
tuition in advanced JavaScript and implementing AJAX-based functionality in web
application development, and goes beyond technology essentials, to take in user
interface, cross-browser and concurrency issues, as well as progressive
applications of the approach, and the implications these carry.
This course is appropriate to
client and server-side developers alike. Advanced knowledge and experience of
JavaScript and HTML is not essential, although some basic understanding of
these languages is assumed.
On completion of
this course delegates will be able to:
Client-server
programming overview
Basic JavaScript Recap
Built-in types, operators
Flow control, functions and object scope
Advanced JavaScript
Objects and classes
Object and class extension, prototype
properties
The global object and predefined classes
User-defined classes
Hard-coded class methods
Parameterised methods – polymorphism and
the strategy pattern
Exception handling
Client-side JavaScript
XML in brief, the XML DOM
Browser objects and the HTML DOM
CSS and the HTML DOM
Events and timers
Using the Decorator pattern to implement complex functionality
Using the Strategy pattern to resolve browser incompatibilities
AJAX
Client to server connection-alternatives
XMLHTTPRequest basics
Object instantiation, sending and
receiving data
HTTP in depth
Synchronous and asynchronous requests
Accessing third-party feeds
Caching and latency considerations
Avoiding race conditions
Binary streams
User interface considerations
Usage-pattern and error-logging techniques
Data transfer formats – plain text, JSON,
XML, HTML
Further uses of XMLHTTPRequest (URL detection, ‘last modified’
detection etc.)