Developing Large Web Applications Producing Code That Can Grow and Thrive 1st Edition Kyle Loudonpdf download
Developing Large Web Applications Producing Code That Can Grow and Thrive 1st Edition Kyle Loudonpdf download
or textbooks at https://ebookultra.com
https://ebookultra.com/download/developing-large-web-
applications-producing-code-that-can-grow-and-thrive-1st-
edition-kyle-loudon/
https://ebookultra.com/download/flask-web-development-developing-web-
applications-with-python-2nd-edition-miguel-grinberg/
https://ebookultra.com/download/developing-responsive-web-
applications-with-ajax-and-jquery-1st-edition-sandeep-kumar-patel/
https://ebookultra.com/download/producing-flash-cs3-video-techniques-
for-video-pros-and-web-designers-john-skidgel/
https://ebookultra.com/download/saltwater-aquarium-models-recipes-for-
creating-beautiful-aquariums-that-thrive-1st-edition-john-h-tullock/
Server Driven Web Apps with htmx Any Language Less Code
Simpler Code 1st Edition R. Mark Volkmann
https://ebookultra.com/download/server-driven-web-apps-with-htmx-any-
language-less-code-simpler-code-1st-edition-r-mark-volkmann/
https://ebookultra.com/download/developing-web-apps-with-haskell-and-
yesod-2nd-edition-michael-snoyman/
https://ebookultra.com/download/c-pocket-reference-1st-edition-loudon/
Developing Large Web Applications Producing Code
That Can Grow and Thrive 1st Edition Kyle Loudon
Digital Instant Download
Author(s): Kyle Loudon
ISBN(s): 9780596803025, 0596803028
Edition: 1
File Details: PDF, 2.46 MB
Year: 2010
Language: english
Developing Large Web Applications
Developing Large Web Applications
Kyle Loudon
foreword by Nate Koechley
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com.
Printing History:
March 2010: First Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Developing Large Web Applications, the image of a Newfoundland, and related trade
dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
TM
ISBN: 978-0-596-80302-5
[M]
1267035305
Table of Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
1. The Tenets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Managing Complexity 1
Modular Components 3
Achieving Modularity 3
Benefits of Modularity 4
Ten Tenets for Large Web Applications 4
2. Object Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
The Fundamentals of OOP 8
Why Object Orientation? 9
UML Class Diagrams 9
Generalization 10
Association 10
Modeling a Web Page 11
Defining Page Types 11
Defining Module Types 11
Writing the Code 12
Achieving Modularity 14
Object-Oriented PHP 15
Classes and Interfaces 15
Inheritance in PHP 19
Object-Oriented JavaScript 22
Objects 22
Inheritance in JavaScript 25
3. Large-Scale HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Modular HTML 28
v
A Bad Example: Using a Table and Presentation Markup 28
A Better Example: Using CSS 30
The Best Example: Semantically Meaningful HTML 31
Benefits of Good HTML 35
HTML Tags 37
Bad HTML Tags 37
Good HTML Tags 38
IDs, Classes, and Names 40
Conventions for Naming 41
XHTML 41
Benefits of XHTML 41
XHTML Guidelines 42
RDFa 45
RDFa Triples 45
Applying RDFa 46
HTML 5 49
4. Large-Scale CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Modular CSS 52
Including CSS 52
Applying CSS 55
Specificity and Importance 57
Scoping with CSS 58
Standard Module Formats 63
Positioning Techniques 65
CSS Box Model 66
Document Flow 67
Relative Positioning 68
Absolute Positioning 68
Floating 70
Layouts and Containers 71
Example Layouts 72
Example Containers 80
Other Practices 82
Browser Reset CSS 83
Font Normalization 85
5. Large-Scale JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Modular JavaScript 88
Including JavaScript 88
Scoping with JavaScript 90
Working with the DOM 92
Common DOM Methods 92
vi | Table of Contents
Popular DOM Libraries 93
Working with Events 98
Event Handling Normalization 99
A Bad Example: Global Data in Event Handlers 99
A Good Example: Object Data in Event Handlers 100
Event-Driven Applications 101
Working with Animation 102
Motion Animation 102
Sizing Animation 103
Color Transition 104
An Example: Chained Selection Lists 105
9. Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Caching Opportunities 222
Caching CSS and JavaScript 222
Caching Modules 227
Caching for Pages 231
Caching with Ajax 231
Using Expires Headers 233
Managing JavaScript 234
JavaScript Placement 234
JavaScript Minification 234
Removing Duplicates 235
Distribution of Assets 237
Content Delivery Networks 237
Minimizing DNS Lookups 237
Minimizing HTTP Requests 238
Control Over Site Metrics 241
Modular Testing 243
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Table of Contents | ix
Foreword
As a little kid, I wondered if I would be big and strong when I grew up. There were a
lot of aspects to growing well. Would I be healthy? Useful? Productive? Successful?
Websites start out small, too. But these humble sites share my childhood dreams. They
want to help more people in more ways; they want to be durable and reliable; they want
to be indispensable and to live forever. In short: they want to be large and successful.
But growing up is hard to do. Challenges accumulate and complexity snowballs.
Expansion means complexity and complexity decay.
—C. Northcote Parkinson
I’ve seen it. The inevitable challenges of growth in websites—data management,
performance—become crippling if mishandled. Things you thought were straightfor-
ward, like HTML, start giving you headaches. From front to back, JavaScript to PHP,
harmony is displaced by dissonance.
Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it.
—Alan Perlis
I’ve worked hand-in-hand with Kyle on some of the Web’s largest applications. I’ve
watched him craft CSS systems to make sprawling sites skinable and design Ajax ar-
chitectures that adapt to and enhance the sites. He emerges from the trenches on top
every time. He’s a perpetual teacher, and, like the best in any discipline, also a perpetual
student. We all benefit from his expertise.
Kyle shares his genius and hard-won expertise in this valuable book that will prepare
you and your application for scale and success. The book is well structured and read-
able, with memorable tenets supported by savvy insights, sound philosophy, and fully
functioning code examples. Complexity is inevitable, but success rewards the prepared.
The way to build a complex system that works is to build it from very simple systems
that work.
—Kevin Kelly
xi
During this book’s deft tour of the complete web application stack, Kyle, the perfect
guide, converts lines of explanatory code from one context into insightful tips in
another. Build big by thinking small. Build new by thinking old. Manage scope. Boost
signal and reduce noise. Resist breakage...these things are easy to rattle off, but it takes
an author like Kyle, and a book like this, to make them practical and real.
If you’re ready to build a finely crafted large site, this is the book for you. Learn what
it takes, because today’s compromise is tomorrow’s constraint. Start today, because
the world is waiting for your application.
Grow large and prosper.
—Nate Koechley
San Francisco, January 2010
xii | Foreword
Preface
It’s been a while since I first worked on a book with O’Reilly in 1997. That book was
a practical guide to data structures and algorithms, a subject that, for the most part,
had been defined many years before by some of the early giants of computer science
(Dijkstra, Hoare, Knuth, to name a few). By comparison, I’ve been able to witness the
rapid evolution of the subject of this book from the front lines, and I have had the good
fortune to help refine it myself while working as a web developer at one of the largest
web applications in the world, Yahoo!.
Web developers have a fascinating role. We work just as closely with user experience
designers as with engineers, and sometimes we’re the designers, too. In many ways, we
are guardians of the user experience as a web design goes from its mockup to its im-
plementation. But we also have to write exceptionally good code that performs well in
the challenging environment of web browsers. Today, more than ever, engineers rec-
ognize that web development must be carried out with the same rigor as other types of
software development.
This book presents a number of techniques for applying established practices of good
software engineering to web development—that is, development primarily using the
disparate technologies of HTML, CSS, JavaScript, and server-side scripting languages.
Whereas there are many books on how to use languages, how to use libraries, and how
to approach software engineering, this is the first book to codify many of the techniques
it presents. These techniques will make the components of your own web applications
more reusable, maintainable, and reliable.
Audience
The primary audience for this book is software developers and managers interested in
large web applications; however, you’ll find that the techniques in this book are equally
useful for web applications of any size. Although it’s especially important to follow
good development practices in large web applications, smaller web applications benefit
from many of the same techniques, too.
xiii
Exploring the Variety of Random
Documents with Different Content
THE OLD PARLIAMENT HOUSE, EDINBURGH.
Strafford, on the previous Tuesday, hearing of the king's extreme
agitation and trouble on his account, had sent him a letter which
was full of magnanimity. He informed him that the hearing of the
king's unwillingness to pass the Bill, on the ground that he did not
believe him guilty, and of the excitement of the people against him
on that account, had brought him into a great strait; that the ruin of
his family on the one side, and fear of injury to the king on the
other, had greatly troubled him; that to say that there had not been
a great strife in him, would be to say that he was not made of flesh
and blood; yet considering that the chief thing was the prosperity of
the realm and the king, he had, with a natural sadness, come to the
conclusion to desire the king to let matters take their course rather
than incur the ill that refusing to sign the Bill might bring on his
sacred majesty. Whitelock assures us that the king sent Carleton to
him, to inform him that he had been compelled to pass the Bill, and
adding that he had been the more reconciled to it by his willingness
to die. On hearing this, Strafford started up from his chair, lifted up
his eyes to heaven, laid his hand upon his heart, and said, "Put not
your trust in princes, nor in the sons of men, for in them there is no
salvation."
The night before the day fixed for his execution, Archbishop Ussher
visited the prisoner, who begged him to go to his fellow-prisoner,
Archbishop Laud, and beg his prayers for him that night, and his
blessing when he should go forth in the morning. He had in vain
endeavoured to persuade the Lieutenant Balfour to permit him to
have an interview with the fallen prelate. In the morning, when led
out to the scaffold, on approaching the window of the archbishop's
prison, he begged the lieutenant to allow him to make his obeisance
towards the prelate's room, though he could not see him himself.
Colonies, 395.
Commerce, 16th century, 394.
"Complaints of the Commons of Kent," 2.
Congregationalists, 356.
Costumes, 16th century, 388.
Courtenay, Earl of Devon, plot to marry Elizabeth and dethrone
Mary, 238.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com