Javascript: Object Oriented Programming

Build sophisticated web applications by mastering the art of Object-Oriented Javascript
Preview in Mapt

Javascript: Object Oriented Programming

Kumar Chetan Sharma et al.

Build sophisticated web applications by mastering the art of Object-Oriented Javascript

Quick links: > What will you learn?> Table of content

Mapt Subscription
FREE
$29.99/m after trial
eBook
$5.00
RRP $63.99
Save 92%
Print + eBook
$79.99
RRP $79.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$5.00
$79.99
$29.99 p/m after trial
RRP $63.99
RRP $79.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Javascript: Object Oriented Programming Book Cover
Javascript: Object Oriented Programming
$ 63.99
$ 5.00
JavaScript: Functional Programming for JavaScript Developers Book Cover
JavaScript: Functional Programming for JavaScript Developers
$ 63.99
$ 5.00
Buy 2 for $10.00
Save $117.98
Add to Cart

Book Details

ISBN 139781787123595
Paperback847 pages

Book Description

JavaScript is the behavior, the third pillar in today's paradigm that looks at web pages as something that consists of : content (HTML), presentation (CSS), and behavior (JavaScript). Using JavaScript, you can create interactive web pages along with desktop widgets, browser, and application extensions, and other pieces of software. Object-oriented programming, which is popularly known as OOP, is basically based on the concept of objects rather than actions.

The first module will help you master JavaScript and build futuristic web applications. You will start by getting acquainted with the language constructs and how to organize code easily. You develop concrete understanding of variable scoping, loops, and best practices on using types and data structures, as well as the coding style and recommended code organization patterns in JavaScript. The book will also teach you how to use arrays and objects as data structures. By the end of the book, you will understand how reactive JavaScript is going to be the new paradigm.

The second module is an easy-to-follow course, which includes hands-on examples of solutions to common problems with object-oriented code. It will help to identify objects from real-life scenarios, to protect and hide data with the data encapsulation features of Python, JavaScript, and C#. You will discover the advantage of duck typing in both Python and JavaScript, while you work with interfaces and generics in C#. With a fair understanding of interfaces, multiple inheritance, and composition, you will move on to refactor existing code and to organize your source for easy maintenance and extension.

The third module takes you through all the in-depth and exciting futures hidden behind the facade. You should read through this course if you want to be able to take your JavaScript skills to a new level of sophistication.

Table of Contents

Chapter 1: JavaScript Primer
A little bit of history
How to use this book
Hello World
Summary
Chapter 2: Functions, Closures, and Modules
A function literal
Functions as data
Scoping
Function declarations versus function expressions
The arguments parameter
Anonymous functions
Closures
Timers and callbacks
Private variables
Loops and closures
Modules
Summary
Chapter 3: Data Structures and Manipulation
Regular expressions
Exact match
Match from a class of characters
Repeated occurrences
Beginning and end
Backreferences
Greedy and lazy quantifiers
Arrays
Maps
Sets
A matter of style
Summary
Chapter 4: Object-Oriented JavaScript
Understanding objects
Instance properties versus prototype properties
Inheritance
Getters and setters
Summary
Chapter 5: JavaScript Patterns
Design patterns
The namespace pattern
The module pattern
The factory pattern
The mixin pattern
The decorator pattern
The observer pattern
JavaScript Model-View-* patterns
The Model-View-Presenter pattern
Model-View-ViewModel
Summary
Chapter 6: Testing and Debugging
Unit testing
JavaScript debugging
Summary
Chapter 7: ECMAScript 6
Shims or polyfills
Transpilers
ES6 syntax changes
Summary
Chapter 8: DOM Manipulation and Events
DOM
Chaining
Traversal and manipulation
Working with browser events
Propagation
jQuery event handling and propagation
Event delegation
The event object
Summary
Chapter 9: Server-Side JavaScript
An asynchronous evented-model in a browser
Callbacks
Timers
EventEmitters
Modules
npm
JavaScript performance
Summary
Chapter 10: Objects Everywhere
Recognizing objects from nouns
Generating blueprints for objects
Recognizing attributes/fields
Recognizing actions from verbs – methods
Organizing the blueprints – classes
Object-oriented approaches in Python, JavaScript, and C#
Summary
Chapter 11: Classes and Instances
Understanding classes and instances
Understanding constructors and destructors
Declaring classes in Python
Customizing constructors in Python
Customizing destructors in Python
Creating instances of classes in Python
Declaring classes in C#
Customizing constructors in C#
Customizing destructors in C#
Creating instances of classes in C#
Understanding that functions are objects in JavaScript
Working with constructor functions in JavaScript
Creating instances in JavaScript
Summary
Chapter 12: Encapsulation of Data
Understanding the different members of a class
Protecting and hiding data
Working with properties
Understanding the difference between mutability and immutability
Encapsulating data in Python
Encapsulating data in C#
Encapsulating data in JavaScript
Summary
Chapter 13: Inheritance and Specialization
Using classes to abstract behavior
Understanding inheritance
Understanding method overloading and overriding
Understanding operator overloading
Taking advantage of polymorphism
Working with simple inheritance in Python
Working with simple inheritance in C#
Working with the prototype-based inheritance in JavaScript
Summary
Chapter 14: Interfaces, Multiple Inheritance, and Composition
Understanding the requirement to work with multiple base classes
Working with multiple inheritance in Python
Interfaces and multiple inheritance in C#
Working with composition in JavaScript
Summary
Chapter 15: Duck Typing and Generics
Understanding parametric polymorphism and duck typing
Working with duck typing in Python
Working with generics in C#
Working with duck typing in JavaScript
Summary
Chapter 16: Organization of Object-Oriented Code
Thinking about the best ways to organize code
Organizing object-oriented code in Python
Organizing object-oriented code in C#
Organizing object-oriented code in JavaScript
Summary
Chapter 17: Taking Full Advantage of Object-Oriented Programming
Putting together all the pieces of the object-oriented puzzle
Refactoring existing code in Python
Refactoring existing code in C#
Refactoring existing code in JavaScript
Summary
Chapter 18: Object-oriented JavaScript
A bit of history
ECMAScript 5
Object-oriented programming
Setting up your training environment
Summary
Chapter 19: Primitive Data Types, Arrays, Loops, and Conditions
Variables
Operators
Primitive data types
Strings
Booleans
Logical operators
Comparison
Primitive data types recap
Arrays
Conditions and loops
Code blocks
Switch
Loops
Comments
Summary
Exercises
Chapter 20: Functions
What is a function?
Scope of variables
Functions are data
Closures
Summary
Exercises
Chapter 21: Objects
From arrays to objects
Built-in objects
Summary
Exercises
Chapter 22: Prototype
The prototype property
Using the prototype's methods and properties
Augmenting built-in objects
Summary
Exercises
Chapter 23: Inheritance
Prototype chaining
Inheriting the prototype only
Uber – access to the parent from a child object
Isolating the inheritance part into a function
Copying properties
Heads-up when copying by reference
Objects inherit from objects
Deep copy
object()
Using a mix of prototypal inheritance and copying properties
Multiple inheritance
Parasitic inheritance
Borrowing a constructor
Summary
Case study – drawing shapes
Exercises
Chapter 24: The Browser Environment
Including JavaScript in an HTML page
BOM and DOM – an overview
BOM
DOM
Events
XMLHttpRequest
Summary
Exercises
Chapter 25: Coding and Design Patterns
Coding patterns
Design patterns
Summary
Chapter 26: Reserved Words
Keywords
Future reserved words
Previously reserved words
Chapter 27: Built-in Functions
Chapter 28: Built-in Objects
Object
Array
Function
Boolean
Number
String
Date
Math
RegExp
Error objects
JSON
Chapter 29: Regular Expressions

What You Will Learn

  • Get acquainted with the basics of JavaScript language constructs along with object-oriented programming and its application.
  • Learn to build scalable server application in JavaScript using Node.js
  • Generate instances in three programming languages: Python, JavaScript, and C#
  • Work with a combination of access modifiers, prefixes, properties, fields, attributes, and local variables to encapsulate and hide data
  • Master DOM manipulation, cross-browser strategies, and ES6
  • Identify and apply the most common design patterns such as Singleton, Factory, Observer, Model-View-Controller, and Mediator Patterns
  • Design applications using a modular architecture based on SOLID principles

Authors

Table of Contents

Chapter 1: JavaScript Primer
A little bit of history
How to use this book
Hello World
Summary
Chapter 2: Functions, Closures, and Modules
A function literal
Functions as data
Scoping
Function declarations versus function expressions
The arguments parameter
Anonymous functions
Closures
Timers and callbacks
Private variables
Loops and closures
Modules
Summary
Chapter 3: Data Structures and Manipulation
Regular expressions
Exact match
Match from a class of characters
Repeated occurrences
Beginning and end
Backreferences
Greedy and lazy quantifiers
Arrays
Maps
Sets
A matter of style
Summary
Chapter 4: Object-Oriented JavaScript
Understanding objects
Instance properties versus prototype properties
Inheritance
Getters and setters
Summary
Chapter 5: JavaScript Patterns
Design patterns
The namespace pattern
The module pattern
The factory pattern
The mixin pattern
The decorator pattern
The observer pattern
JavaScript Model-View-* patterns
The Model-View-Presenter pattern
Model-View-ViewModel
Summary
Chapter 6: Testing and Debugging
Unit testing
JavaScript debugging
Summary
Chapter 7: ECMAScript 6
Shims or polyfills
Transpilers
ES6 syntax changes
Summary
Chapter 8: DOM Manipulation and Events
DOM
Chaining
Traversal and manipulation
Working with browser events
Propagation
jQuery event handling and propagation
Event delegation
The event object
Summary
Chapter 9: Server-Side JavaScript
An asynchronous evented-model in a browser
Callbacks
Timers
EventEmitters
Modules
npm
JavaScript performance
Summary
Chapter 10: Objects Everywhere
Recognizing objects from nouns
Generating blueprints for objects
Recognizing attributes/fields
Recognizing actions from verbs – methods
Organizing the blueprints – classes
Object-oriented approaches in Python, JavaScript, and C#
Summary
Chapter 11: Classes and Instances
Understanding classes and instances
Understanding constructors and destructors
Declaring classes in Python
Customizing constructors in Python
Customizing destructors in Python
Creating instances of classes in Python
Declaring classes in C#
Customizing constructors in C#
Customizing destructors in C#
Creating instances of classes in C#
Understanding that functions are objects in JavaScript
Working with constructor functions in JavaScript
Creating instances in JavaScript
Summary
Chapter 12: Encapsulation of Data
Understanding the different members of a class
Protecting and hiding data
Working with properties
Understanding the difference between mutability and immutability
Encapsulating data in Python
Encapsulating data in C#
Encapsulating data in JavaScript
Summary
Chapter 13: Inheritance and Specialization
Using classes to abstract behavior
Understanding inheritance
Understanding method overloading and overriding
Understanding operator overloading
Taking advantage of polymorphism
Working with simple inheritance in Python
Working with simple inheritance in C#
Working with the prototype-based inheritance in JavaScript
Summary
Chapter 14: Interfaces, Multiple Inheritance, and Composition
Understanding the requirement to work with multiple base classes
Working with multiple inheritance in Python
Interfaces and multiple inheritance in C#
Working with composition in JavaScript
Summary
Chapter 15: Duck Typing and Generics
Understanding parametric polymorphism and duck typing
Working with duck typing in Python
Working with generics in C#
Working with duck typing in JavaScript
Summary
Chapter 16: Organization of Object-Oriented Code
Thinking about the best ways to organize code
Organizing object-oriented code in Python
Organizing object-oriented code in C#
Organizing object-oriented code in JavaScript
Summary
Chapter 17: Taking Full Advantage of Object-Oriented Programming
Putting together all the pieces of the object-oriented puzzle
Refactoring existing code in Python
Refactoring existing code in C#
Refactoring existing code in JavaScript
Summary
Chapter 18: Object-oriented JavaScript
A bit of history
ECMAScript 5
Object-oriented programming
Setting up your training environment
Summary
Chapter 19: Primitive Data Types, Arrays, Loops, and Conditions
Variables
Operators
Primitive data types
Strings
Booleans
Logical operators
Comparison
Primitive data types recap
Arrays
Conditions and loops
Code blocks
Switch
Loops
Comments
Summary
Exercises
Chapter 20: Functions
What is a function?
Scope of variables
Functions are data
Closures
Summary
Exercises
Chapter 21: Objects
From arrays to objects
Built-in objects
Summary
Exercises
Chapter 22: Prototype
The prototype property
Using the prototype's methods and properties
Augmenting built-in objects
Summary
Exercises
Chapter 23: Inheritance
Prototype chaining
Inheriting the prototype only
Uber – access to the parent from a child object
Isolating the inheritance part into a function
Copying properties
Heads-up when copying by reference
Objects inherit from objects
Deep copy
object()
Using a mix of prototypal inheritance and copying properties
Multiple inheritance
Parasitic inheritance
Borrowing a constructor
Summary
Case study – drawing shapes
Exercises
Chapter 24: The Browser Environment
Including JavaScript in an HTML page
BOM and DOM – an overview
BOM
DOM
Events
XMLHttpRequest
Summary
Exercises
Chapter 25: Coding and Design Patterns
Coding patterns
Design patterns
Summary
Chapter 26: Reserved Words
Keywords
Future reserved words
Previously reserved words
Chapter 27: Built-in Functions
Chapter 28: Built-in Objects
Object
Array
Function
Boolean
Number
String
Date
Math
RegExp
Error objects
JSON
Chapter 29: Regular Expressions

Book Details

ISBN 139781787123595
Paperback847 pages
Read More

Read More Reviews

Recommended for You

JavaScript: Functional Programming for JavaScript Developers Book Cover
JavaScript: Functional Programming for JavaScript Developers
$ 63.99
$ 5.00
HTML5 and CSS3: Building Responsive Websites Book Cover
HTML5 and CSS3: Building Responsive Websites
$ 67.99
$ 5.00
Python: Master the Art of Design Patterns Book Cover
Python: Master the Art of Design Patterns
$ 67.99
$ 5.00
TypeScript: Modern JavaScript Development Book Cover
TypeScript: Modern JavaScript Development
$ 69.99
$ 5.00
Mobile Application Development: JavaScript Frameworks Book Cover
Mobile Application Development: JavaScript Frameworks
$ 59.99
$ 5.00
Object-Oriented JavaScript - Second Edition Book Cover
Object-Oriented JavaScript - Second Edition
$ 29.99
$ 5.00