售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
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
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜