You are previewing Enterprise Web Development, one of over 35,000 titles on Safari
Enterprise Web Development

Book Description

If you want to build your organization’s next web application with HTML5, this practical book will help you sort through the various frameworks, libraries, and development options that populate this stack. You’ll learn several of these approaches hands-on by writing multiple versions of a sample web app throughout the book, so you can determine the right strategy for your enterprise.

Table of Contents

  1. Preface
    1. What’s an Enterprise Application?
    2. Why the Authors Wrote This Book
    3. Who This Book Is For
    4. What This Book Is and Why It’s Important
    5. Introducing the Save The Child Application
      1. Is This Even an Enterprise App?
      2. How We Are Going to Build This App
    6. The Goals of the Book
    7. Technologies Used in This Book
    8. How the Book Is Organized
    9. Conventions Used in This Book
    10. The Source Code for the Examples
    11. Safari® Books Online
    12. How to Contact Us
    13. Acknowledgments
  2. Introduction
    1. Moving from DHTML to HTML5
    2. Developing in HTML5
    3. Challenges of the Enterprise Developer
    4. Summary
  3. I. Building Your Application
    1. 1. Mocking Up the Save The Child Application
      1. Considering Mobile First
      2. Introducing Balsamiq Mockups
      3. The Project Owner Talks to a Web Designer
      4. Creating First Mockups
      5. Turning Mockups into a Prototype
        1. Single-Page Applications
        2. Running Code Examples from WebStorm
        3. Our First Prototype
        4. Our Main Page JavaScript
          1. Where to put JavaScript
          2. The CSS of our main page
        5. The Footer Section
        6. The Donate Section
          1. Assigning function handlers: take 1
          2. Assigning function handlers: take 2
      6. Adding Video
        1. Adding the HTML5 Video Element
        2. Embedding YouTube Videos
      7. Adding Geolocation Support
        1. Geolocation Basics
        2. Integration with Google Maps
        3. Browser Feature Detection with Modernizr
        4. Search and Multimarkers with Google Maps
          1. Adding multiple markers on the map
      8. Summary
    2. 2. Using Ajax and JSON
      1. Understanding Ajax
      2. Understanding JSON
      3. Working with Ajax
        1. Retrieving Data from the Server
        2. Ajax: Good and Bad
        3. Populating States and Countries from HTML Files
      4. Using JSON
        1. Populating States and Countries from JSON Files
        2. Using Arrays in JSON
        3. Loading Charity Events by Using Ajax and JSON
        4. Using JSON in CMS
      5. Handling JSON in Java
      6. Compressing JSON
      7. Adding Charts to Save The Child
        1. Adding a Chart with the Canvas Element
        2. Adding a Chart by Using SVG
      8. Loading Data from Other Servers by Using JSONP
        1. Beer and JSONP
      9. Summary
    3. 3. Introducing the jQuery Library
      1. Getting Started with jQuery
        1. Hello World
      2. Using Selectors and Filters
      3. Testing jQuery Code with JSFiddle
      4. Filtering Elements
      5. Handling Events
        1. Attaching Event Handlers and Elements by Using the Method on()
        2. Delegating Events
      6. Using Ajax with jQuery
        1. Handy Shorthand Methods
      7. Programming Save The Child by Using jQuery
        1. Login and Donate
        2. Loading HTML States and Countries by Using jQuery Ajax
        3. Loading JSON States and Countries by Using jQuery Ajax
        4. Submitting the Donate Form
          1. Manual form serialization
      8. Using jQuery Plug-ins
        1. Validating the Donate Form by Using a Plug-in
        2. Adding an Image Slider
      9. Summary
  4. II. Enterprise Considerations
    1. 4. Developing Web Applications in the Ext JS Framework
      1. Exploring JavaScript Frameworks
      2. Choosing to Use Ext JS
      3. Downloading and Installing Ext JS
      4. Becoming Familiar with Ext JS and Tooling
        1. Creating the First Version of Hello World
        2. Generating Applications with the Sencha CMD Tool
        3. Choosing Which Ext JS Distribution to Use
        4. Declaring, Loading, and Instantiating Classes
          1. xtype: An efficient way to create class instances
          2. Supporting multiple inheritance by uisng mixins
        5. Best Practice: MVC
          1. Models and stores
          2. Controllers and views
        6. Exploring a Component’s Life Cycle
          1. Components as containers
        7. Working with Events
        8. Specifying Layouts
          1. Setting proportional layouts by using the flex property
      5. Developing Save The Child with Ext JS
        1. Setting Up the Eclipse IDE and Apache Tomcat
          1. Apache Tomcat
          2. Dynamic web projects and Ext JS
        2. Running the Top Portion of the Save The Child UI
        3. Completing Save The Child
          1. Adding the login box
          2. Adding the video
          3. Adding the maps
          4. Adding the chart and table panels
          5. Adding a footer
          6. Building a production version of Save The Child
      6. Summary
    2. 5. Selected Productivity Tools for Enterprise Developers
      1. Using Node.js, V8, and npm
      2. Automating Everything with Grunt
      3. Exploring the Simplest Gruntfile
      4. Using Grunt to Run JSHint Checks
      5. Watching for the File Changes
      6. Using Bower
      7. Using Yeoman
      8. Using Ext JS and CDB for Productive Enterprise Web Development
        1. Ext JS MVC Application Scaffolding
        2. Generating a CRUD Application
        3. Data Pagination
      9. Summary
    3. 6. Modularizing Large-Scale JavaScript Projects
      1. Understanding Modularization Basics
      2. Exploring Roads to Modularization
        1. The Module Pattern
        2. CommonJS
        3. Asynchronous Module Definition
        4. Universal Module Definition
        5. ECMAScript 6 Modules
          1. ES6 Module Transpiler
      3. Dicing the Save The Child Application into Modules
        1. Inside the RequireJS Configuration: config.js
        2. Writing AMD Modules
        3. Loading Modules On Demand
        4. Using RequireJS Plug-ins
        5. Using RequireJS Optimizer
      4. Loosely Coupled InterModule Communications with Mediator
      5. Summary
    4. 7. Test-Driven Development with JavaScript
      1. Why Test?
      2. Testing Basics
        1. Unit Testing
        2. Integration Testing
        3. Functional Testing
        4. Load Testing
          1. Apache Benchmark
          2. jMeter
          3. PhantomJS
      3. Test-Driven Development
        1. Implementing TDD by Using QUnit
          1. Setting up Grunt with QUnit
        2. Behavior-Driven Development with Jasmine
          1. Setting up Grunt with Jasmine
          2. Exploring Jasmine basics
          3. Specification setup
          4. Custom matchers
          5. Spies
        3. Multibrowser Testing
          1. Installation
          2. Testem configuration file
          3. Running tests
        4. Testing the DOM
      4. Building Save The Child with TDD
        1. Harnessing the ExtJS Application
        2. Testing the Models
        3. Testing the Controllers
        4. Testing the Views
        5. Setting Up the IDE for TDD
      5. Summary
    5. 8. Upgrading HTTP to WebSocket
      1. Using HTTP for Near Real-Time Applications
        1. Polling
        2. Long Polling
        3. HTTP Streaming
      2. Implementing Server-Sent Events
      3. Introducing the WebSocket API
        1. The WebSocket Interface
        2. The Client-Side API
          1. WebSocket handshake
          2. WebSocket frame anatomy
          3. The heartbeats
          4. Data frames
          5. Closing the connection
      4. Using WebSocket Frameworks
        1. The Portal
        2. Atmosphere
      5. Choosing the Format for Application-Level Messages
        1. CSV
        2. XML
        3. JSON
        4. Google Protocol Buffers
      6. Using WebSocket with Proxies
      7. Adding an Auction to Save The Child
        1. Monitoring WebSocket Traffic by Using Chrome Developer Tools
        2. Sniffing WebSocket Frames by Using Wireshark
        3. Creating the Save The Child Auction Protocol
      8. Summary
    6. 9. Introduction to Web Application Security
      1. HTTP versus HTTPS
      2. Authentication and Passwords
        1. Basic and Digest Authentication
        2. Single Sign-on
          1. Save The Child and SSO
        3. Handling Passwords
      3. Authorization
        1. OAuth-Based Authentication and Authorization
        2. Federated Identity with OpenID Connect and JSON Web Tokens
        3. OAuth 2.0 Main Actors
        4. Save The Child and OAuth
          1. Public authorization servers
          2. Private authorization servers
      4. Top Security Risks
        1. Injection
        2. Cross-Site Scripting
      5. Regulatory Compliance and Enterprise Security
      6. Summary
  5. III. Responsive Web Design and Mobile Devices
    1. 10. Responsive Design: One Site Fits All
      1. One or Two Versions of Code?
        1. How Many User Agents Are There
      2. Back to Mockups
      3. CSS Media Queries
        1. How Many Breakpoints?
      4. Fluid Grids
        1. Moving Away from Absolute Sizing
        2. Window as a Grid
        3. Responsive CSS: The Good News
      5. Making Save The Child Responsive
        1. Fluid Media
      6. Summary
    2. 11. jQuery Mobile
      1. Obtaining jQuery Mobile
      2. Organizing the Code
      3. Seeing How It Looks on Mobile Devices
        1. Styling in jQuery Mobile
        2. Adding Page Navigation
          1. Multipage template
          2. Single-page template
          3. Multipage or single-page template
        3. Adding Persistent Toolbars
          1. Programmatic navigation
      4. Using jQuery Mobile for Save The Child
        1. Prototyping the Mobile Version
        2. Project Structure and Navigation
        3. Selected Code Fragments
          1. Grid layouts
          2. Control groups
          3. Drop-downs and collapsibles
          4. List views
          5. Adding JavaScript
      5. Summary
    3. 12. Sencha Touch
      1. Introducing Sencha Touch
        1. Performing Code Generation and Distribution
          1. Microloader and configurations
          2. The code of Hello World
        2. Constructing the UI
          1. Containers
          2. Layouts
          3. Events
      2. Using Sencha Touch for Save The Child
        1. Building the Application
        2. The Application Object
        3. The Main View
        4. Controller
        5. Other Views in Save The Child
          1. LoginForm
          2. DonateForm
          3. Charts
          4. Media
          5. Maps
        6. Stores and Models
        7. Working with Landscape Mode
      3. Comparing jQuery Mobile and Sencha Touch
    4. 13. Hybrid Mobile Applications
      1. Native Applications
      2. Native versus Web Applications
      3. Hybrid Applications
        1. Cordova and PhoneGap
        2. Titanium
      4. The Bottom Line
      5. Introduction to the PhoneGap Workflows
        1. Creating One More Hello World
        2. Testing Applications on iOS Devices
        3. Installing More Local SDKs
      6. Using the Adobe PhoneGap Build Service
        1. Distributing Mobile Applications
      7. Save The Child with PhoneGap
        1. Using PhoneGap to Package Any HTML5 Application
        2. Adding Camera Access to Save The Child
        3. Providing Sever-Side Support for Photo Images
      8. Summary
    5. 14. Epilogue
      1. HTML5 Is Not a Rosy Place
      2. Dart: A Promising Language
      3. HTML5 Is in Demand Today
    6. A. Selected HTML5 APIs
      1. Does Your Browser Support HTML5?
      2. Handling Differences in Browsers
      3. HTML5 Web Messaging API
        1. Sending and Receiving Messages
        2. Communicating with an iFrame
        3. Applying the Mediator Design Pattern
      4. Web Workers API
        1. Creating and Communicating with Workers
        2. Dedicated and Shared Workers
      5. The WebSocket API
      6. Offline Web Applications
        1. Prerequisites for Developing Offline Web Applications
        2. Application Cache API
        3. Is Your Application Offline?
        4. Options for Storing Data Locally
        5. Web Storage Specification APIs
          1. localStorage API
          2. sessionStorage API
          3. localStorage and sessionStorage commonalities
        6. Introduction to IndexedDB
          1. Object stores and versioning
          2. Transactions
          3. Modyfying the object store data
          4. Retrieving the data
          5. Runninng the sample code
      7. The History API
        1. Modifying the Browser’s History by Using pushState()
        2. Processing the popstate Event
      8. Summary
    7. B. Running Code Samples and IDE
      1. Choosing an IDE
      2. Running Code Samples in WebStorm
      3. Using Two IDEs: WebStorm and Eclipse
  6. Index
  7. Colophon
  8. Copyright