JavaScript at Scale
eBook - ePub

JavaScript at Scale

Adam Boduch

Share book
  1. 266 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

JavaScript at Scale

Adam Boduch

Book details
Book preview
Table of contents
Citations

About This Book

Have you ever come up against an application that felt like it was built on sand? Maybe you've been tasked with creating an application that needs to last longer than a year before a complete re-write? If so, JavaScript at Scale is your missing documentation for maintaining scalable architectures.

There's no prerequisite framework knowledge required for this book, however, most concepts presented throughout are adaptations of components found in frameworks such as Backbone, AngularJS, or Ember.

All code examples are presented using ECMAScript 6 syntax, to make sure your applications are ready for next generation browsers.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is JavaScript at Scale an online PDF/ePUB?
Yes, you can access JavaScript at Scale by Adam Boduch in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione in JavaScript. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785282157

JavaScript at Scale


Table of Contents

JavaScript at Scale
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Scale from a JavaScript Perspective
Scaling influencers
The need for scale
Growing user base
Building new features
Hiring more developers
Architectural perspectives
The browser is a unique environment
Component design
Component communication
Load time
Responsiveness
Addressability
Configurability
Making architectural trade-offs
Defining your constants
Performance for ease of development
Configurability for performance
Performance for substitutability
Ease of development for addressability
Maintainability for performance
Less features for maintainability
Leveraging frameworks
Frameworks versus libraries
Implementing patterns consistently
Performance is built in
Leverage community wisdom
Frameworks don't scale out-of-the-box
Summary
2. Influencers of Scale
Scaling users
License fees
Subscription fees
Consumption fees
Ad-supported
Open source
Communicating users
Support mechanisms
Feedback mechanisms
Notifying users
User metrics
Scaling users example
Scaling features
Application value
Killer features versus features that kill
Data-driven features
Competing with other products
Modifying existing features
Supporting user groups and roles
Introducing new services
Consuming real-time data
Scaling features example
Scaling development
Finding development resources
Development responsibilities
Too many resources
Scaling development example
Influencer checklist
User checklist
What's the business model of our software?
Does our application have different user roles?
Do our users communicate with each other using our software?
How do we support our application?
How do we collect feedback from users?
How do we notify users with relevant information?
What type of user metrics should we collect?
Feature checklist
What's the core value proposition of our software?
How do we determine the feasibility of a feature?
Can we make informed decisions about our features?
Who's our competition?
How do we make what we have better?
How do we integrate user management into our features?
Are our features tightly coupled to backend services?
How does the frontend stay synchronized with backend data?
Developer checklist
How do we find the right development resources?
How do we allocate development responsibilities?
Can we avoid hiring too many resources?
Summary
3. Component Composition
Generic component types
Modules
Routers
Models/Collections
Controllers/Views
Templates
Application-specific components
Extending generic components
Identifying common data and functionality
Extending router components
Extending models/collections
Extending controllers/views
Mapping features to components
Generic features
Specific features
Decomposing components
Maintaining and debugging components
Re-factoring complex components
Pluggable business logic
Extending versus configuring
Stateless business logic
Organizing component code
Summary
4. Component Communication and Responsibilities
Communication models
Message-passing models
Event models
Communication data schema
Naming conventions
Data format
Common data
Traceable component communication
Subscribing to events
Globally-logging events
Event lifecycle
Communication overhead
Event frequency
Callback execution time
Callback complexity
Areas of communication responsibility
Backend API
Web socket updates
DOM updates
Loosely-coupled communication
Substituting components
Handling unexpected events
Component layers
Event flow direction
Mapping to developer responsibilities
Mentally mapping the code
Summary
5. Addressability and Navigation
Approaches to routing
Hash URIs
Traditional URIs
How routers work
Router responsibilities
Router events
URI parts and patterns
Encoding information
Designing URIs
Mapping resources to URIs
Building URIs manually
Automating resource URIs
Triggering routes
User actions
Redirecting users
Router configuration
Static route declarations
Registration events
Deactivating routes
Troubleshooting routers
Conflicting routes
Logging initial configuration
Logging route events
Handling invalid resource states
Summary
6. User Preferences and Defaults
Preference types
Locales
Behavior
Appearance
Supporting locales
Deciding on locales to support
Maintaining locales
Setting the locale
Choosing locales
Storing locale preferences
Locales in URIs
Generic component configuration
Deciding on configuration values
Stored and hard-coded default values
Backend implications
Loading configuration values
Configuring behavior
Enabling and disabling components
Changing quantities
Changing order
Configuring notifications
Inline options
Changing the look and feel
Theme tools
Selecting a theme
Individual style preferences
Performance implications
Configurable locale performance
Configurable behavior performance
Configurable theme performance
Summary
7. Load Time and Responsiveness
Component artifacts
Component dependencies
Building components
Loading components
Loading modules
Lazy module loading
Module load latency
Communication bottlenecks
Reducing indirection
Profiling code
Component optimization
Components that maintain state
Dealing with side-effects
DOM rendering techniques
API data
Load latency
Working with large data sets
Optimizing components at runtime
Summary
8. Portability and Testing
Decoupling the backend
Mocking the backend API
Frontend entry points
Mocking tools
Generating mock data sets
Performing actions
Feature design process
Designing the API
Implementing the mock
Implementing the feature
Reconciling mock data with API data
Unit testing tools
Tools built into frameworks
Standalone unit testing tools
Toolchains and automation
Testing mock scenarios
Mock APIs and test fixtures
Scenario generation tools
End-to-end tests and continuous integration
Summary
9. Scaling Down
Scaling constraints
JavaScript artifact size
Network bandwidth
Memory consumption
CPU consumption
Backend capabilities
Conflicting features
Overlapping functionality
Irrelevant features
Customer demand
Design failures
Unnecessary components
Inefficient data processing
Excessively creative markup
Application composition
Feature enablement
New feature impact
Essential libraries
Summary
10. Coping with Failure
Failing fast
Using quality constraints
Providing meaningful feedback
When we can't fail fast...
Fault tolerance
Classifying critical behavior
Detecting and containing errant behavior
Disabling defective components
Gracefully degrading functionality
Failure recovery
Retrying failed operations
Restarting components
Manual user intervention
When we can't recover from failures...
Performance and complexity
Exception handling
State checking
Notifying other components
Logging and debugging
Meaningful error logs
Warning about potential failures
Informing and instructing users
Improving the architecture
Documenting failure scenarios
Improving component classification
Complexity promotes failure
Summary
Index

JavaScript at Scale

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2015
Production reference: 1270715
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-215-7
www.packtpub.com

Credits

Author
Adam Boduch
Reviewers
August N. Marcello III
Yogesh Singh
Nikolay Sokolov
Serkan Yersen
Commissioning Editor
Edward Gordon
Acquisition Editors
Kevin Colaco
Owen Roberts
Content Development Editor
Divij Kotian
Technical Editor
Ryan Kochery
Copy Editor
Angad Singh
Project Coordinator
Nikhil Nair
Proofreader
Safis Editing
Indexer
Rekha Nair
Graphics
Jason Monteiro
Production Coordinator
Melwyn Dsa
Cover Work
Melwyn Dsa

About the Author

Adam Boduch has been involved with large-scale JavaScript development for nearly 10 years. Before moving to the frontend, he worked on several large-scale cloud computing products using Python and Linux. No stranger to complexity, Adam has practical experience with real-world software systems and the scaling challenges they pose. He is the author of several JavaScript books, including Lo-Dash Essentials, and is passionate about innovative user experiences and high performance.
Adam lives in Toronto and is a senior software engineer at Virtustream.

About the Reviewers

August N. Marcello III is a highly passionate software engineer with nearly 2 decades of experience in the design, implementation, and deployment of modern client-side web application architectures in the enterprise. An exclusive focus on delivering compelling SaaS based user experiences throughout the web ecosystem has proven both personally and professionally rewarding for him. His passion for emerging techno...

Table of contents