Object JavaScript is all about the idea of using JavaScript using an object oriented paradigm. Object-oriented programming is a programming paradigm that uses abstraction to create models based on the real world. It uses several techniques from previously established paradigms: modularity, polymorphism, and encapsulation.
Object-oriented programming may be seen as the design of software using a collection of cooperating objects, as opposed to a traditional view in which a program may be seen as a collection of functions, or simply as a list of instructions to the computer.
Object-oriented programming is intended to promote greater flexibility and maintainability in programming, and is widely popular in large-scale software engineering. By virtue of its strong emphasis on modularity, object oriented code is intended to be simpler to develop and easier to understand later on, lending itself to more direct analysis, coding, and understanding of complex situations and procedures than less modular programming methods.
Objects in JavaScript are kind of two-faced.
From one side, an object is an associative array (called hash in some languages). It stores key-value pairs.
From the other side, objects are used for object-oriented programming, and that’s the story described in these posts.
Prerequisites
This series requires a basic understand of JavaScript. The purpose is to take your JavaScript to a new level. If you want to get started with JavaScript, there are some great tutorials, such as
- Learn Javascript – Javascript Tutorial.
- Getting Started (JavaScript Tutorial) On Mozilla Developer Network.
Full of Features
JavaScript is full of features so that you can create modules, objects, that can be used between projects. Think for a moment about having your own jQuery-like objects for your own projects.
These posts consider both the facilities in the JavaScript language, but also some of the huge assortment of JavaScript libraries that enable modularity, polymorphism, and encapsulation.
So these posts include how you can use Q, RequireJS, jQuery, Knockout, Mustache, and more. You will find explanations, best practices, and step by step on how you can use all these in your projects.
You are encouraged to pick and choose the features that best fit your own needs.
Object JavaScript Posts
- Getting Started with Objects the Way JavaScript Thinks About Objects. The purpose of this series is take your knowledge to the next level, for you to add skills that will help you build commercial-quality code. JavaScript object features were introduced in the ECMAScript 5 specification.
- Understanding Prototypes, Inheritance. JavaScript “thinks” about objects through prototypes. This post describes more about how prototypes are used in object oriented programming.
- Scope, Namespaces, "use strict". In this post, you will learn about how JavaScript defines scopes and how you can use that to your advantage by declaring your own namespaces.
- Namespaces, Anonymous Module, Revealing Module Pattern. You will learn how to create modules in JavaScript, how you can expose properties and methods, and how to build objects using the revealing module pattern.
- Scope, Self-Invoking Anonymous Function, Closures, Revealing Module Pattern. This provides a deeper look into the mechanics of JavaScript objects, such as closures, and how you can use the revealing module pattern. At this point, if you have seen lots of JavaScript you will be able to recognize the patterns.
- Asynchronous Module Definition (AMD). AMD address the need to standardize a way to define modules, not only to make them recognizable, but so you can define their requirements.
- Revealing Modular Pattern Into Asynchronous Modules. Learn how you can take your revealing module pattern and use them as asynchronous modules.
- Understanding Prototypes. We revisit prototypes with the idea of introducing inheritance, using traditional JavaScript techniques.
- Inheritance Using Revealing Module Pattern. You will learn how to implement inheritance using the revealing module pattern.
- Using the
this
Keyword. Thethis
keyword provides ways to access the context of your JavaScript object. - Asynchronous Programming Using Promises. This introduces you to the idea of promises. A Promise is an object that basically represents a process that is or will take place at some point in time, but allows you to register callbacks to it for when the process gets terminated or completed.
- Promises for Asynchronous Operations Using jQuery. Shows how you can use jQuery’s implementation of promises based around the jQuery.Deferred object.
- Asynchronous JavaScript Promises Using Q. Learn how you can use a more robust library to implement promises and to understand when it you will need it.
- Using Q Promises Inside a RequireJS AMD Module. Combine long running functions inside your module.
jQuery posts
- Getting Started with jQuery. The purpose of this series is take your knowledge to the next level, for you to add skills that will help you build commercial-quality code. JavaScript object features were introduced in the ECMAScript 5 specification.
- Promises for Asynchronous Operations Using jQuery. implementation of promises is based around the jQuery.Deferred object.
HTML5 features
- Asynchronous Script Execution. For pages using process-intensive scripts, you can get quicker page loading with the async attribute.
Sample Code
Sample code for these posts is available on the DevDays GitHub:
- DevDays Sample Code for Object JavaScript. Includes examples for Infuser, Knockout, Mustache, Namespaces, RequireJS, and UnderscoreJS.
- DevDays Sample Code for Single Page App. Includes sample code for SammyJS, jQuery, Knockout. It includes template loading samples using RequireJS, Q, AppCache.
2 thoughts on “Object JavaScript”
Comments are closed.