JavaScript Object Programming
معرفی کتاب «JavaScript Object Programming» نوشتهٔ Martin Rinehart (auth.)، منتشرشده توسط نشر Apress Distributed to the Book trade worldwide by Springer در سال 2015. این کتاب در 8 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است. «JavaScript Object Programming» در دستهٔ بدون دستهبندی قرار دارد.
This brief book explains the advantages of the object model, inheritance, both classical and prototypical, and shows how these concepts can be implemented in JavaScript. It also shows how object programming (OP) opens a new world of design possibilities that go far beyond inheritance.This book will help the intermediate JavaScript programmer learn to use both types of inheritance. For classical inheritance, it is accompanied by a substantial online system (a windowing UI library) that shows classical inheritance at its best. The same system shows how OP "capabilities" can eliminate much of the need for inheritance. For experienced JavaScript programmers, this book shows why most of the old views of JavaScript's inheritance have not done it justice. JavaScript classes inherit from JavaScript's prototypes, a fact that makes JavaScript's prototypes, when used correctly, functional equivalents to C++ classes (not to prototypes in true prototypical languages, like Self). JavaScript's object programming (not inheritance) is what separates it from classical OOP languages like C++ and Java. Most important, basing inheritance on JavaScript's prototypal chain is possible, but is not the best choice for prototypal inheritance or classical inheritance.What You'll Learn * What are objects, JavaScript objects and object programming * What is and how to use inheritance and JavaScript inheritance as well as inheritance alternatives * How to design for JavaScript * What are and how to use OO principles in JavaScript * How to use Constructors with JavaScript and more AudienceThis book is for both intermediate and advanced JavaScript and Web development programmers. However, any programmer will understand the concepts and any JavaScript programmer should understand all of the concepts in this book. The code there is shows examples of the concepts discussed. Contents at a Glance 6 Contents 7 About the Author 14 A Note for the Implementers 15 Introduction 16 Chapter 1: Creating Objects 17 Reasons for Objects 17 Objects Do Methods 17 Event-Driven Programming 18 Taming Exponential Complexity 18 Class-Based vs. Prototypal 18 Simula 18 Smalltalk 18 C++ and Java 19 Self and JavaScript 19 Objects Up Close 20 Data Properties 20 Methods (Code Properties) 20 Ex Nihilo Object Creation 21 The Object Constructor 21 Object Literals 22 More Ex Nihilo Objects 23 OOP-Style Object Creation 24 Constructors 24 Assigning Initial Property Values 24 Creating Instance Methods 25 Creating Class Statics 25 Getters and Setters 25 Default Values 26 Prototypal Object Creation 26 Object Prototypes 26 The Prototype Chain 28 Object Prototype Cloning 28 Summary 30 Chapter 2: Object Programming 31 JSWindows Sample System 31 OP Removes Restrictions 31 OP Defined 32 Programming with Properties 32 Dot Notation 32 Subscript Notation 33 Object Programming Examples 33 Object Sum 33 OP for Inheriting Prototypes 35 OP in the JSWindows Library 35 DOM Related 35 Utility 37 Summary 40 Chapter 3: Inheritance Theory 41 Classes 41 Constructors 42 Instance Methods 42 Class (Family-Wide) Properties 43 Data 43 Methods 43 Class-Based Inheritance 43 Property Sets 44 Constructing an Extending Instance 45 Overriding Properties 45 Inheritance Chains 46 Prototypal Inheritance 47 Inheritance vs. Composition 48 Composition in Theory 48 Composition in JSWindows 48 Complex Properties 49 Behaviors 50 Summary 51 Chapter 4: Inheritance Practice 52 Cascading init() Methods for Data 52 A Theoretical Example 54 The call() and apply() Methods 56 Extending an Extending Family 56 A Practical Example 57 Discrete Defaults 58 Implementing Capabilities 59 Prototypes for Methods 59 Theory 60 Prototypal Inheritance 60 Prototype Inheritance Alternatives 61 Prototype Alternatives 63 Library Functions 63 Prototype Lookups and Performance 63 Class (Family-Wide) Methods 64 JSWindows Inheritance 64 Summary 64 Chapter 5: On OOP Principles 65 Ranking OOP Principles 65 Inheritance 66 Encapsulation 66 Access Specifiers 66 Closures 67 Polymorphism 67 Subtype Polymorphism 67 Parametric Polymorphism 68 Ad Hoc and Other Polymorphism 69 JavaScript and Polymorphism 69 Classes, Abstraction, and Interfaces 70 Classes 70 Abstraction 71 Interfaces 71 Other OOP Principles 72 Summary 72 Chapter 6: More Ex Nihilo Objects 73 The Ex Nihilo Namespace Object 73 The Ex Nihilo Class 74 Returning Ex Nihilo Objects 75 The Function as an Ex Nihilo Class 75 Summary 76 Chapter 7: Inheritance Alternatives 78 Multiple Inheritance 78 Interfaces 80 Capabilities 81 The Window[_M[_BS]] Problem 81 Mixins 83 Calling Capability Methods 84 Capabilities as Constructor Properties 84 Capabilities as Single Properties 84 Capability Prototype Methods 85 Examples 85 Closable 86 Maskable 87 Button_sizable 89 The Button_sizable Constructor 90 The Click Functions 90 Choosable Buttons 91 The Button_sizable.Button Family 92 The Button_sizable.panel Family 93 The Click and Draw Functions 93 Summary 94 Chapter 8: Designing for JavaScript 96 Use Ex Nihilo Constantly 96 Array Literals 96 Styles Objects 97 Other Objects 97 Use Composition Liberally 97 Original Pos_size 98 Mature Pos_size 98 Use Capabilities Liberally 99 Use Inheritance Conservatively 100 Summary 101 Chapter 9: On Constructors 102 Constructor Magic 102 The new Operator 102 The this Parameter 103 The constructor.prototype 103 The “[[prototype]]” Property 104 The Prototype’s Prototype 105 “[[prototype]]” Implies 105 The Dynamic Prototype 106 A Bit More Magic 106 The Constructor Returns this 106 The “Magic” Summarized 107 Constructors Are Not for Inheritance 107 Summary 108 Chapter 10: Appendices 109 A Surveyed Pages, OOP Principles 109 B Selected Books 110 C++ 110 Java 111 JavaScript 111 Python 111 Visual Basic 111 C Selected Websites 111 Wikipedia on Object-Oriented Programming, Class-Based Inheritance and Prototypal Inheritance 111 The Author’s Web Site on Class-Based Inheritance and JavaScript Programming 112 Other Web Sites on Class-Based Inheritance and Prototypal Inheritance 112 Object-Oriented Programming: 112 Prototype-Based Programming 112 Classes 113 Instances 113 Methods 113 Inheritance 113 Composition 114 D Defined Terms 114 E Support for Selected Statements 114 F Simple Closure 115 G Sealing and Freezing Objects 116 H Configuring Properties 117 I Dynamic Properties and Me 118 Index 119 This brief book explains the advantages of the object model, inheritance, both classical and prototypical, and shows how these concepts can be implemented in JavaScript. It also shows how object programming (OP) opens a new world of design possibilities that go far beyond inheritance. This book will help the intermediate JavaScript programmer learn to use both types of inheritance. For classical inheritance, it is accompanied by a substantial online system (a windowing UI library) that shows classical inheritance at its best. The same system shows how OP "capabilities" can eliminate much of the need for inheritance. For experienced JavaScript programmers, this book shows why most of the old views of JavaScript's inheritance have not done it justice. JavaScript classes inherit from JavaScript's prototypes, a fact that makes JavaScript's prototypes, when used correctly, functional equivalents to C classes (not to prototypes in true prototypical languages, like Self). JavaScript's object programming (not inheritance) is what separates it from classical OOP languages like C and Java. Most important, basing inheritance on JavaScript's prototypal chain is possible, but is not the best choice for prototypal inheritance or classical inheritance. What You'll Learn What are objects, JavaScript objects and object programming What is and how to use inheritance and JavaScript inheritance as well as inheritance alternatives How to design for JavaScript What are and how to use OO principles in JavaScript How to use Constructors with JavaScript and more Audience This book is for both intermediate and advanced JavaScript and Web development programmers. However, any programmer will understand the concepts and any JavaScript programmer should understand all of the concepts in this book. The code there is shows examples of the concepts discussed. This book covers the critical as well as the less obvious aspects of managing Microsoft Team Foundation Server 2015 in a variety of development and test environments. Coverage includes basic installation, initial configuration, maintenance, and common trouble shooting techniques, sizing, and performance considerations. Essentials of Administering Team Foundation Server 2015 explains how TFS can help you incorporate source control in your development environment. You'll learn how to set up TFS to match how you develop software. The book covers using TFS in the whole development process, along with practical advice on how to use its features effectively to get up to speed quickly. In addition, the author dives into using TFS in your team covering subjects like setting up accounts for different roles, manage users, and groups--plus what you need to know about TFS security and running a secure team. No discussion of a centralized system like TFS would be complete without learning how to back up and restore it, and the author covers what you will need to know to maintain your TFS including the backup and restore details required to properly plan for disaster recovery. The book details what you need to know about TFS functionality in creating and setting up collections and projects, how to manage the build process with Team Build (including setting it up and deploying build server and agents), using templates to speed up the creation of builds, building multi-platform solutions, and testing. In this book, youĺlll learn how to: Plan, install, and configure TFS Secure your TFS environment Plan and manage source control with TFS Manage the development process with TFS Manage the build process Test with TFS This book will help the intermediate JavaScript programmer learn to use both types of inheritance. For classical inheritance, it is accompanied by a substantial online system (a windowing UI library) that shows classical inheritance at its best. The same system shows how OP "capabilities" can elminate much of the need for inheritance. For experienced JavaScript programmers, this book shows why most of the old views of JavaScript's inheritance have not done it justice. JavaScript classes inherit from JavaScript's prototypes, a fact that makes JavaScript's prototypes, when used correctly, functional equivalents to C++ classes (not to prototypes in true prototypal languages, like Self). In this book, you'll learn the following: What are objects, JavaScript objects and object programming What is and how to use inheritance and JavaScript inheritance as well as inheritance alternativesHow to design for JavaScript What are and how to use OO principles in JavaScript How to use Constructors with JavaScript and more Front Matter....Pages i-xix Creating Objects....Pages 1-14 Object Programming....Pages 15-24 Inheritance Theory....Pages 25-35 Inheritance Practice....Pages 37-49 On OOP Principles....Pages 51-58 More Ex Nihilo Objects....Pages 59-63 Inheritance Alternatives....Pages 65-82 Designing for JavaScript....Pages 83-88 On Constructors....Pages 89-95 Appendices....Pages 97-106 Back Matter....Pages 107-109
دانلود کتاب JavaScript Object Programming