万本电子书0元读

万本电子书0元读

顶部广告

Mastering JavaScript Object-Oriented Programming电子书

售       价:¥

1人正在读 | 0人评论 9.8

作       者:Andrea Chiarelli

出  版  社:Packt Publishing

出版时间:2016-06-01

字       数:149.2万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Unleash the true power of JavaScript by mastering Object-Oriented programming principles and patterns About This Book Covering all the new Object-Oriented features introduced in ES6, this book shows you how to build large-scale web apps Build apps that promote scalability, maintainability, and reusability Learn popular Object-Oriented programming (OOP) principles and design patterns to build robust apps Implement Object-Oriented concepts in a wide range of front-end architectures Who This Book Is For This book is ideal for you if you are a JavaScript developers who wants to gain expertise in OOP with JavaScript to improve your web development skills and build professional quality web applications. What You Will Learn Master JavaScript's OOP features, including the one's provided by ES6 specification Identify and apply the most common design patterns such as Singleton, Factory, Observer, Model-View-Controller, and Mediator Patterns Understand the SOLID principles and their benefits Use the acquired OOP knowledge to build robust and maintainable code Design applications using a modular architecture based on SOLID principles In Detail ECMAScript 6 introduces several new Object-Oriented features that drastically change the way developers structure their projects. Web developers now have some advanced OOP functionality at their disposal to build large-scale applications in JavaScript. With this book, we'll provide you with a comprehensive overview of OOP principles in JavaScript and how they can be implemented to build sophisticated web applications. Kicking off with a subtle refresher on objects, we'll show you how easy it is to define objects with the new ES6 classes. From there, we'll fly you through some essential OOP principles, forming a base for you to get hands-on with encapsulation. You'll get to work with the different methods of inheritance and we'll show you how to avoid using inheritance with Duck Typing. From there, we'll move on to some advanced patterns for object creation and you'll get a strong idea of how to use interesting patterns to present data to users and to bind data. We'll use the famous promises to work with asynchronous processes and will give you some tips on how to organize your code effectively. You'll find out how to create robust code using SOLID principles and finally, we'll show you how to clearly define the goals of your application architecture to get better, smarter, and more effective coding. This book is your one-way ticket to becoming a JavaScript Jedi who can be counted on to deliver flexible and maintainable code. Style and approach This comprehensive guide on advanced OOP principles and patterns in JavaScript is packed with real-world use cases, and shows you how to implement advanced OOP features to build sophisticated web applications that promote scalability and reusability.
目录展开

Mastering JavaScript Object-Oriented Programming

Mastering JavaScript Object-Oriented Programming

Credits

About the Author

About the Reviewer

www.PacktPub.com

eBooks, discount offers, and more

Why subscribe?

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. A Refresher of Objects

Object literals

Properties

Methods

Object constructors

The Object() constructor

Object prototypes

Using classes

Summary

2. Diving into OOP Principles

OOP principles

Is JavaScript Object Oriented?

Abstraction and modeling support

Association

Aggregation

Composition

OOP principles support

Encapsulation

Inheritance

Polymorphism

JavaScript OOP versus classical OOP

Summary

3. Working with Encapsulation and Information Hiding

Encapsulation and information hiding

Convention-based approach

Privacy levels using closure

Scope and closure

Privacy levels

Benefits and drawbacks

A meta-closure approach

Immediately invoked function expressions

Creating a meta-closure with an IIFE

Managing isolated private members

A definitive solution with WeakMaps

Property descriptors

Controlling access to public properties

Using getters and setters

Describing properties

Properties with internal state

Information hiding in ES6 classes

Summary

4. Inheriting and Creating Mixins

Why inheritance?

Objects and prototypes

What is a prototype?

Creating objects

Prototype chaining

Inheritance and constructors

ES6 inheritance

Controlling inheritance

Overriding methods

Overriding properties

Protected members

Preventing extensions

Implementing multiple inheritance

Creating and using mixins

Mixing prototypes

Mixing classes

Summary

5. Defining Contracts with Duck Typing

Managing dynamic typing

Dynamic data types

Data typing and objects

From data type to instance type

Beyond the instance type

Contracts and interfaces

Duck typing

A basic approach

A general solution

Emulating Interfaces with duck typing

Multiple interface implementation

Duck typing and polymorphism

Summary

6. Advanced Object Creation

Creating objects

Design patterns and object creation

Creating a singleton

The mysterious behavior of constructors

Singletons

When to use singletons?

An object factory

Understanding factories

Factory with constructor registration

The abstract factory

The builder pattern

When to use the builder pattern?

Comparing factory and builder patterns

Recycling objects with an object pool

Summary

7. Presenting Data to the User

Managing user interfaces

The user interface problems

User interfaces and JavaScript

Presentation patterns

Model, View, and Controller

The Model-View-Controller pattern

The Model-View-Presenter pattern

The Model-View-ViewModel pattern

A MV* pattern comparison

Summary

8. Data Binding

What is data binding?

Data binding elements

Data binding directions

Implementing data binding

Manual data binding

Monitoring changes

Hacking properties

Defining a binder

The publish/subscribe pattern

The observer pattern

The publisher/subscriber pattern

Implementing observables

Using proxies

The proxy class

Data binding with proxies

Summary

9. Asynchronous Programming and Promises

Is JavaScript asynchronous?

Event loop and asynchronous code

Events, Ajax, and other asynchronous stuff

Writing asynchronous code

Using events properties

Using callbacks

Callbacks and this

The callback hell

Organizing callbacks

The issues of asynchronous code

Introducing Promises

What are Promises?

The Promise terminology

Creating Promises

Consuming Promises

Catching failures

Composing Promises

Using Generators

Introducing Generators

Using Generators for asynchronous tasks

ES7 async/await

Summary

10. Organizing Code

The global scope

Global definitions

Creating namespaces

Namespaces as object literals

Defining namespaces with IIFE

The module pattern

Modules versus namespaces

Using anonymous closures

Importing modules

Augmenting modules

Loose augmentation

Overriding a module's methods

Tight augmentation

Composing modules

Submodules

Module loading

Modules, scripts, and files

A simple module loader

CommonJS modules

Asynchronous Module Definition

Merging the module pattern with AMD

Universal Module Definition

UMD

Dependency management

ECMAScript 6 modules

ES6 module loading

Summary

11. SOLID Principles

Principle of OOP design

The Single Responsibility Principle

The Open/Closed Principle

The Liskov Substitution Principle

The Interface Segregation Principle

The Dependency Inversion Principle

Dependency inversion, inversion of control, and dependency injection

Dependency injection approaches

Summary

12. Modern Application Architectures

From scripts to applications

What is a large-scale application?

What is an application architecture?

Goals of an architecture design

From old-style to Single Page Applications

Old-style web applications

Single Page Applications

The server role

View composition

Navigation and routing

The remote data

The Zakas/Osmani architecture

The overall architecture

The modules

The Sandbox

The facade pattern

The application core

The mediator pattern

The base library

Cross-cutting features and AOP

The log management example

Using inheritance

The Aspect-Oriented Programming approach

Isomorphic applications

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部