Book description
Build sophisticated web applications by mastering the art of Object-Oriented Javascript
About This Book
- Learn popular Object-Oriented programming (OOP) principles and design patterns to build robust apps
- Implement Object-Oriented concepts in a wide range of frontend architectures
- Capture objects from real-world elements and create object-oriented code that represents them
- Learn the latest ES6 features and how to test and debug issues with JavaScript code using various modern mechanisms
Who This Book Is For
JavaScript developers looking to enhance their web developments skills by learning object-oriented programming.
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
In Detail
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.
Style and approach
This course is a comprehensive guide where each chapter consists of best practices, constructive advice, and few easy-to-follow examples that will build up your skills as you advance through the book. Get object oriented with this course, which takes you on a journey to get acquainted with few useful hands-on tools, features, and ways to enhance your productivity using OOP techniques. The practice questions at the end of each chapter will help you to review what you have understood. It will also act as a reference guide with useful examples on resolving problems with object-oriented code in Python, JavaScript, and C#.
Table of contents
-
Javascript: Object-Oriented Programming
- Table of Contents
- Javascript: Object Oriented Programming
- Javascript: Object Oriented Programming
- Credits
- Preface
-
I. Module 1
-
1. JavaScript Primer
- A little bit of history
- How to use this book
- Hello World
- Summary
- 2. Functions, Closures, and Modules
- 3. Data Structures and Manipulation
- 4. Object-Oriented JavaScript
- 5. JavaScript Patterns
- 6. Testing and Debugging
- 7. ECMAScript 6
- 8. DOM Manipulation and Events
- 9. Server-Side JavaScript
-
1. JavaScript Primer
-
II. Module 2
- 1. Objects Everywhere
-
2. 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
- 3. Encapsulation of Data
-
4. 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
- 5. Interfaces, Multiple Inheritance, and Composition
-
6. Duck Typing and Generics
- Understanding parametric polymorphism and duck typing
- Working with duck typing in Python
-
Working with generics in C#
- Declaring an interface to be used as a constraint
- Declaring an abstract base class that implements two interfaces
- Declaring subclasses of an abstract base class
- Declaring a class that works with a constrained generic type
- Using a generic class for multiple types
- Declaring a class that works with two constrained generic types
- Using a generic class with two generic type parameters
- Working with duck typing in JavaScript
- Summary
- 7. Organization of Object-Oriented Code
- 8. Taking Full Advantage of Object-Oriented Programming
-
III. Module 3
- 1. Object-oriented JavaScript
- 2. Primitive Data Types, Arrays, Loops, and Conditions
- 3. Functions
-
4. Objects
-
From arrays to objects
- Elements, properties, methods, and members
- Hashes and associative arrays
- Accessing an object's properties
- Calling an object's methods
- Altering properties/methods
- Using the this value
- Constructor functions
- The global object
- The constructor property
- The instanceof operator
- Functions that return objects
- Passing objects
- Comparing objects
- Objects in the WebKit console
- Built-in objects
- Summary
- Exercises
-
From arrays to objects
- 5. Prototype
-
6. 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
-
7. The Browser Environment
- Including JavaScript in an HTML page
- BOM and DOM – an overview
-
BOM
- The window object revisited
- window.navigator
- Your console is a cheat sheet
- window.location
- window.history
- window.frames
- window.screen
- window.open()/close()
- window.moveTo() and window.resizeTo()
- window.alert(), window.prompt(), and window.confirm()
- window.setTimeout() and window.setInterval()
- window.document
- DOM
- Events
- XMLHttpRequest
- Summary
- Exercises
- 8. Coding and Design Patterns
- 9. Reserved Words
- 10. Built-in Functions
- 11. Built-in Objects
- 12. Regular Expressions
- A. Biblography
- Index
Product information
- Title: JavaScript : Object-Oriented Programming
- Author(s):
- Release date: August 2016
- Publisher(s): Packt Publishing
- ISBN: 9781787123595
You might also like
book
Mastering JavaScript Object-Oriented Programming
Unleash the true power of JavaScript by mastering Object-Oriented programming principles and patterns About This Book …
book
JavaScript: Functional Programming for JavaScript Developers
Unlock the powers of functional programming hidden within JavaScript to build smarter, cleaner, and more reliable …
book
Object-Oriented JavaScript - Third Edition
Learn everything you need to know about object-oriented JavaScript with this comprehensive guide. Enter the world …
book
JavaScript Next: Your Complete Guide to the New Features Introduced in JavaScript, Starting from ES6 to ES9
JavaScript has finally grown up. Armed with a slew of new features, JavaScript now makes writing …