• Complain

Zakas N.C. - Principles of Object-Oriented Programming in JavaScript

Here you can read online Zakas N.C. - Principles of Object-Oriented Programming in JavaScript full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Principles of Object-Oriented Programming in JavaScript
  • Author:
  • Genre:
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Principles of Object-Oriented Programming in JavaScript: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Principles of Object-Oriented Programming in JavaScript" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Leanpub, 2014. 93 p.
If youre coming from a more traditional object-oriented language such as C++ or Java, JavaScript might seem like its not object-oriented at all. After all, JavaScript has no concept of classes, and you dont even need to define any objects in order to write code. JavaScript can look just as much like C as it can an object-oriented language depending on how you decide to write it. But dont be fooled, JavaScript is an incredibly powerful and expressive object-oriented language that puts many design decisions in the hands of you, the developer.This book is an exploration of the object-oriented nature of JavaScript. It is not specific to a particular JavaScript environment, so its equally useful for web developers and Node.js developers. The book includes information about ECMAScript 5 and its new capabilities that have changed how you can work with objects in JavaScript.What youll learn:
The differences between primitive and reference values;
What makes JavaScript functions so unique;
The various ways of creating an object;
The difference between data properties and accessor properties using ECMAScript 5;
How to define your own constructors;
How to work with and understand prototypes;
Various inheritance patterns for types and objects;
How to create private and privileged object members;
How to prevent modification of objects using ECMAScript 5 functionality. iPAD Amazon Kindle, PC , Cool Reader (EPUB), Calibre (EPUB, MOBI, AZW3), Adobe Digital Editions (EPUB), FBReader (EPUB, MOBI, AZW3).

Zakas N.C.: author's other books


Who wrote Principles of Object-Oriented Programming in JavaScript? Find out the surname, the name of the author of the book and a list of all author's works by series.

Principles of Object-Oriented Programming in JavaScript — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Principles of Object-Oriented Programming in JavaScript" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Principles of Object-Oriented Programming in JavaScript Nicholas C Zakas This - photo 1
Principles of Object-Oriented Programming in JavaScript
Nicholas C. Zakas

This book is for sale at http://leanpub.com/oopinjavascript

This version was published on 2014-06-18

This is a Leanpub book Leanpub empowers authors and publishers with - photo 2

* * * * *

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do.

* * * * *

2012 - 2014 Nicholas C. Zakas
Introduction

Most developers associate object-oriented programming with languages that are typically taught in school, like C++ and Java, which base object-oriented programming around classes. Before you can do anything in these languages, you need to create a class, even if youre just writing a simple command-line program. Common design patterns in the industry reinforce class-based concepts as well. But JavaScript doesnt use classes, and this is part of the reason people get confused when they try learning it after C++ or Java. Object-oriented languages have several characteristics:

  • Encapsulation - Data can be grouped together with functionality that operates on that data. This, quite simply, is the definition of an object.
  • Aggregation - One object can reference another object.
  • Inheritance - A newly created object has the same characteristics as another object without explicitly duplicating its functionality.
  • Polymorphism One interface may be implemented by multiple objects.

JavaScript has all these characteristics, though because the language has no concept of classes, some arent implemented in quite the way you might expect. At first glance, a JavaScript program might even look like a procedural program you would write in C. If you can write a function and pass it some variables, you have a working script that seemingly has no objects. A closer look at the language, however, reveals the existence of objects through the use of dot notation.

Many object-oriented languages use dot notation to access properties and methods on objects, and JavaScript is syntactically the same. But in JavaScript, you never need to write a class definition, import a package, or include a header file. You just start coding with the data types that you want, and you can group those together in any number of ways. You could certainly write JavaScript in a procedural way, but its true power emerges when you take advantage of its object-oriented nature. Thats what this book is about.

Make no mistake: A lot of the concepts you may have learned in more traditional object-oriented programming languages dont necessarily apply to JavaScript. While that often confuses beginners, as you read, youll quickly find that JavaScripts weakly typed nature allows you to write less code to accomplish the same tasks as other languages. You can just start coding without planning the classes that you need ahead of time. Need an object with specific fields? Just create an ad hoc object wherever you want. Did you forget to add a method to that object? No problem - just add it later.

Inside these pages, youll learn the unique way that JavaScript approaches object-oriented programming. Leave behind the notions of classes and class-based inheritance and learn about prototype-based inheritance and constructor functions that behave similarly. Youll learn how to create objects, define your own types, use inheritance, and otherwise manipulate objects to get the most out of them. In short, youll learn everything you need to know to understand and write JavaScript professionally. Enjoy!

Who This Book Is for

This book is intended as a guide for those who already understand object-oriented programming but want to know exactly how the concept works in JavaScript. Familiarity with Java, C#, or object-oriented programming inother languages is a strong indicator that this book is for you. In particular, this book is aimed at three groups of readers:

  • Developers who are familiar with object-oriented programming concepts and want to apply them to JavaScript
  • Web application and Node.js developers trying to structure their code more effectively
  • Novice JavaScript developers trying to gain a deeper understanding of the language

This book is not for beginners who have never written JavaScript. You will need a good understanding of how to write and execute JavaScript code to follow along.

Overview

Chapter 1: Primitive and Reference Types introduces the two different value types in JavaScript: primitive and reference. Youll learn what distinguishes them from each other and how understanding their differences is important to an overall understanding of JavaScript.

Chapter 2: Functions explains the ins and outs of functions in JavaScript. First-class functions are what makes JavaScript such an interesting language.

Chapter 3: Understanding Objects details the makeup of objects in JavaScript. JavaScript objects behave differently than objects in other languages, so a deep understanding of how objects work is vital to mastering the language.

Chapter 4: Constructors and Prototypes expands on the previous discussion of functions by looking more specifically at constructors. All constructors are functions, but they are used a little bit differently. This chapter explores the differences while also talking about creating your own custom types.

Chapter 5: Inheritance explains how inheritance is accomplished in JavaScript. Though there are no classes in JavaScript, that doesnt mean inheritance isnt possible. In this chapter, youll learn about prototypal inheritance and how it differs from class-based inheritance.

Chapter 6: Object Patterns walks through common object patterns. There are many different ways to build and compose objects in JavaScript, and this chapter introduces you to the most popular patterns for doing so.

Acknowledgments

Id like to thank Kate Matsudaira for convincing me that self-publishing an ebook was the best way to get this information out. Without her advice, Id probably still be trying to figure out what I should do with the information contained in this book.

Thanks to Rob Friesel for once again providing excellent feedback on an early copy of this book, and Cody Lindley for his suggestions. Additional thanks to Angus Croll for his technical review of the finished version his nitpicking made this book much better.

Thanks as well to Bill Pollock, whom I met at a conference and who started the ball rolling on publishing this book with No Starch Press.

Help and Support

If you have questions, comments, or other feedback about this book, please visit the mailing list at: http://groups.google.com/group/zakasbooks.

Chapter 1: Primitive and Reference Types

Most developers learn object-oriented programming by working with class-based languages such as Java or C#. When these developers start learning JavaScript, they get disoriented because JavaScript has no formal support for classes. Instead of defining classes from the beginning, with JavaScript you can just write code and create data structures as you need them. Because it lacks classes, JavaScript also lacks class groupings such as packages. Whereas in languages like Java, package and class names define both the types of objects you use and the layout of files and folders in your project, programming in JavaScript is like starting with a blank slate: You can organize things any way you want. Some developers choose to mimic structures from other languages, while others take advantage of JavaScripts flexibility to come up with something completely new. To the uninitiated, this freedom of choice can be overwhelming, but once you get used to it, youll find JavaScript to be an incredibly flexible language that can adapt to your preferences quite easily.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Principles of Object-Oriented Programming in JavaScript»

Look at similar books to Principles of Object-Oriented Programming in JavaScript. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Principles of Object-Oriented Programming in JavaScript»

Discussion, reviews of the book Principles of Object-Oriented Programming in JavaScript and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.