Learn Java for Web Development

(Tina Meador) #1

38 CHAPTER 1: Introducing Java Web Development


Here are some important definitions in the responsive world:


   Unobtrusive JavaScript^24 : Unobtrusive JavaScript is a means of separation of
concerns, that is, separating the look and feel from behavior concerns. This
results in a pure markup, and the JavaScript (behavior) works unobtrusively
across different browsers and devices. jQuery is a popular library that helps in
writing unobtrusive JavaScript. CoffeeScript compiles into JavaScript. It is used
as an alternative to JavaScript and considerably reduces code.
 CSS3 media queries: Media queries are the primary means of making web
applications responsive. Media queries use media features such as device-
width, device-height, orientation, and device-aspect-ratio in a CSS file to
develop a responsive web application.
 LESS: LESS is the CSS preprocessor that is used when a CSS3 stylesheet gets
unmanageable. LESS extends CSS with dynamic behavior such as mixins and
functions.
 Polyfills: Polyfills are JavaScript, used to make a browser HTML5-enabled. The
polyfills provide missing functionality in the browser and provide a fallback.
 Modernizr: Modernizr is a JavaScript library that detects HTML5 and CSS3
features in the browser and conditionally loads polyfills.

Single-Page Web Application (SPA)

Another trend in web application development is a single-page web application (SPA).


   The client-side code—such as HTML, JavaScript, and CSS—is retrieved with a
single page load; the page does not reload at any point in the process, and the
control is not transferred to another page.
 The resources, such as images, are dynamically loaded and added to the page
in response to events.

SPAs are built using Node.js^25 as the web server. AngularJS is a full-featured SPA framework.


Real-Time Web Application

A real-time web application delivers responses to events in a measurable and acceptable
time period, depending on the nature of the event, by means of asynchronous, bidirectional
communication between the client and the server. WebSocket is the core technology employed
for developing real-time web applications. WebSocket provides a full-duplex and bidirectional
communication protocol over a single TCP connection. That is, a client and a server can send
messages to each other and independent of each other.


(^24) http://www.w3.org/wiki/The_principles_of_unobtrusive_JavaScript
(^25) http://nodejs.org/

Free download pdf