Cover image for Developing Large Web Applications

Book description

As web applications get more complex, so do the challenges. These applications need to meet demanding performance requirements, and be reliable 24/7, without exception. And they also need to withstand frequent modifications by many different programmers. If you're building a mission-critical site, this book will help you achieve the same rigor in web application development that has traditionally applied to other types of software. Written by a manager at Yahoo! with substantial experience working with the techniques presented in this book, Developing Large Web Applications provides practical steps for building sites that remain effective as you add features, functions, and users.

  • Avoid common coding and maintenance headaches when small websites evolve, adding more pages, more code, and more programmers

  • Embrace the virtues of modularity, encapsulation, abstraction, and loosely coupled components

  • Get comprehensive coverage of issues involving HTML, CSS, PHP, JavaScript and Ajax, and database interaction

  • Learn solid techniques in code management and software engineering that are often unknown or forgotten by web developers

This book is in progress, but you can still get started with this development approach through our Rough Cuts edition, which lets you read the manuscript as it's being written, either online or via PDF.

Table of Contents

  1. Special Upgrade Offer
  2. A Note Regarding Supplemental Files
  3. Foreword
  4. Preface
    1. Audience
    2. Organization of This Book
    3. Conventions Used in This Book
    4. Using Code Examples
    5. We’d Like to Hear From You
    6. Safari® Books Online
    7. Acknowledgments
  5. 1. The Tenets
    1. Managing Complexity
    2. Modular Components
      1. Achieving Modularity
        1. Encapsulation
        2. Abstraction
        3. Loose coupling
      2. Benefits of Modularity
    3. Ten Tenets for Large Web Applications
  6. 2. Object Orientation
    1. The Fundamentals of OOP
    2. Why Object Orientation?
    3. UML Class Diagrams
      1. Generalization
      2. Association
    4. Modeling a Web Page
      1. Defining Page Types
      2. Defining Module Types
    5. Writing the Code
    6. Achieving Modularity
    7. Object-Oriented PHP
      1. Classes and Interfaces
        1. Declaring a class
        2. Using objects
        3. Constructors
        4. Information hiding
        5. Class data members
        6. Class methods
        7. Declaring an interface
      2. Inheritance in PHP
        1. Extending classes
        2. Implementing interfaces
        3. Abstract classes
        4. Final methods
    8. Object-Oriented JavaScript
      1. Objects
        1. Creating an object
        2. Using objects
        3. Constructors
        4. Information hiding
        5. Class data members
        6. Class methods
      2. Inheritance in JavaScript
        1. Prototype-based inheritance
  7. 3. Large-Scale HTML
    1. Modular HTML
      1. A Bad Example: Using a Table and Presentation Markup
      2. A Better Example: Using CSS
      3. The Best Example: Semantically Meaningful HTML
      4. Benefits of Good HTML
    2. HTML Tags
      1. Bad HTML Tags
      2. Good HTML Tags
      3. IDs, Classes, and Names
      4. Conventions for Naming
    3. XHTML
      1. Benefits of XHTML
      2. XHTML Guidelines
        1. Proper nesting of tags
        2. End tags and empty tags
        3. Case sensitivity
        4. Attribute values
        5. JavaScript, CSS, and special characters
    4. RDFa
      1. RDFa Triples
      2. Applying RDFa
    5. HTML 5
  8. 4. Large-Scale CSS
    1. Modular CSS
      1. Including CSS
        1. Linking
        2. Embedding
        3. Inlining
      2. Applying CSS
        1. IDs
        2. Classes
        3. Descendants
        4. Elements
        5. Grouping
      3. Specificity and Importance
      4. Scoping with CSS
        1. Scoping within a module
        2. Scoping at the page level
        3. Presentation switching
      5. Standard Module Formats
    2. Positioning Techniques
      1. CSS Box Model
      2. Document Flow
      3. Relative Positioning
      4. Absolute Positioning
      5. Floating
    3. Layouts and Containers
      1. Example Layouts
      2. Example Containers
    4. Other Practices
      1. Browser Reset CSS
      2. Font Normalization
  9. 5. Large-Scale JavaScript
    1. Modular JavaScript
      1. Including JavaScript
        1. Linking
        2. Embedding
        3. Inlining
      2. Scoping with JavaScript
        1. Namespaces with JavaScript
        2. Accessing a module by ID
    2. Working with the DOM
      1. Common DOM Methods
        1. Accessing elements by tag name
        2. Creating an element
        3. Inserting or removing an element
        4. Changing the text in an element
      2. Popular DOM Libraries
        1. DOM methods in Dojo
        2. DOM methods in jQuery
        3. DOM methods in Prototype
        4. DOM methods in YUI
    3. Working with Events
      1. Event Handling Normalization
      2. A Bad Example: Global Data in Event Handlers
      3. A Good Example: Object Data in Event Handlers
      4. Event-Driven Applications
    4. Working with Animation
      1. Motion Animation
      2. Sizing Animation
      3. Color Transition
    5. An Example: Chained Selection Lists
  10. 6. Data Management
    1. Dynamic Modules
    2. Data Managers
      1. Creating Data Managers
        1. Defining get_data
        2. Defining set_data
      2. Extending Data Managers
        1. Extending via inheritance
        2. Extending via aggregation
    3. Data Using SQL As a Source
      1. An SQL Example
    4. Data Using XML As a Source
      1. An XML Example
    5. Data from Web Services
    6. Data in the JSON Format
    7. Cookies and Forms
      1. Managing Data in Cookies
      2. Managing Data from Forms
  11. 7. Large-Scale PHP
    1. Modular Web Pages
      1. Generating Pages in PHP
    2. Working with Pages
      1. Public Interface for the Page Class
        1. Structure and assembly
        2. CSS management
        3. JavaScript management
      2. Abstract Interface for the Page Class
        1. CSS management
        2. JavaScript management
        3. Dynamic data management
        4. Headers, footers, and content
        5. General page information
      3. Implementation of the Page Class
      4. Extending the Page Class
        1. Defining a sitewide page class
        2. Defining sectional page classes
        3. Defining page-specific classes
    3. Working with Modules
      1. Public Interface for the Module Class
      2. Abstract Interface for the Module Class
        1. CSS management
        2. JavaScript management
        3. Content for the module
      3. Implementation of the Module Class
      4. Extending the Module Class
      5. An Example Module: Slideshow
    4. Layouts and Containers
    5. Special Considerations
      1. Handling Module Variations
      2. Multiple Instances of a Module
      3. Dynamic JavaScript and CSS
      4. Implementing Nested Modules
  12. 8. Large-Scale Ajax
    1. In the Browser
      1. Managing Connections
      2. Using Ajax Libraries
        1. Ajax with Dojo
        2. Ajax with jQuery
        3. Ajax with Prototype
        4. Ajax with YUI
    2. On the Server
      1. Exchange Formats
        1. Plain text
        2. XML
        3. JSON
      2. Server Proxies
      3. Modular Ajax
    3. MVC and Ajax
      1. Using Ajax with MVC
      2. Public Interface for the Model Object
      3. Implementation of the Model Object
      4. Public Interface for the View Object
      5. Abstract Interface for the View Object
      6. View Object Implementation
      7. Public Interface for the Connect Object
      8. Abstract Interface for the Connect Object
      9. Implementation of the Connect Object
      10. Controllers
      11. An Example of Ajax with MVC: Accordion Lists
  13. 9. Performance
    1. Caching Opportunities
      1. Caching CSS and JavaScript
        1. Versioning CSS and JavaScript files
        2. Combining CSS and JavaScript files
      2. Caching Modules
      3. Caching for Pages
      4. Caching with Ajax
      5. Using Expires Headers
    2. Managing JavaScript
      1. JavaScript Placement
      2. JavaScript Minification
      3. Removing Duplicates
    3. Distribution of Assets
      1. Content Delivery Networks
      2. Minimizing DNS Lookups
      3. Minimizing HTTP Requests
        1. Guidelines for CSS files
        2. Guidelines for JavaScript files
        3. Guidelines for image files
    4. Control Over Site Metrics
    5. Modular Testing
      1. Using Test Data
      2. Creating Test Data
  14. 10. Application Architecture
    1. Thinking Modularly
    2. Organizing Components
      1. Sitewide Architecture
        1. Pages and modules
        2. Layouts and containers
        3. CSS and JavaScript
        4. Data management
        5. Images and other resources
      2. Section Architecture
        1. Pages specific to one section
        2. Other types of section files
      3. Architecture for Pages
        1. Files for implementing pages
        2. Page-specific modules
        3. Modules on multiple pages
        4. Pages of a similar type
    3. Architecture and Maintenance
      1. Reorganizing Module Uses
      2. Adding Module Variations
      3. Making Widespread Changes
      4. Changes in Data Sources
      5. Exposing Modules Externally
  15. Index
  16. About the Author
  17. Colophon
  18. Special Upgrade Offer
  19. Copyright