Advanced JS The World's Most Misunderstood Programming Language ) Douglas Crockford( Shimon Dahan

Slides:



Advertisements
Similar presentations
JavaScript: A Language of Many Contrasts
Advertisements

L3:CSC © Dr. Basheer M. Nasef Lecture #3 By Dr. Basheer M. Nasef.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
1 l Inheritance Basics l Programming with Inheritance l Dynamic Binding and Polymorphism Inheritance.
Julian on JavaScript: Objects Julian M Bucknall, CTO.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Object-Oriented PHP (1)
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Chapter 7 l Inheritance Basics l Programming with Inheritance l Dynamic Binding and Polymorphism Inheritance.
Object-oriented Programming Concepts
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
More Classes in C++ Bryce Boe 2012/08/20 CS32, Summer 2012 B.
Taking JavaScript Seriously IS NOT THE WORST IDEA.
OOP Languages: Java vs C++
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Chapter 12: Adding Functionality to Your Classes.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Chapter 8 More Object Concepts
J AVA S CRIPT Shadi Banitaan 1. O UTLINE Introduction JavaScript Functions Using Objects in JavaScript Built-in Objects User-Defined Objects Examples.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Tutorial 2 Variables and Objects. Working with Variables and Objects Variables (or identifiers) –Values stored in computer memory locations –Value can.
Programming Languages and Paradigms Object-Oriented Programming.
APCS Java AB 2004 Review of CS1 and CS2 Review for AP test #1 Sources: 2003 Workshop notes from Chris Nevison (Colgate University) AP Study Guide to go.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
Inheritance and Polymorphism Daniel Liang, Introduction to Java Programming.
OOP IN PHP `Object Oriented Programming in any language is the use of objects to represent functional parts of an application and real life entities. For.
Tuc Goodwin  Object and Component-Oriented Programming  Classes in C#  Scope and Accessibility  Methods and Properties  Nested.
OOP: Encapsulation,Abstraction & Polymorphism. What is Encapsulation Described as a protective barrier that prevents the code and data being randomly.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
1 Chapter Four Creating and Using Classes. 2 Objectives Learn about class concepts How to create a class from which objects can be instantiated Learn.
COP3502 Programming Fundamentals for CIS Majors 1 Instructor: Parisa Rashidi.
Julian on JavaScript: Functions Julian M Bucknall, CTO.
Chapter 4&5 Defining Classes Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
OOP in C++ CS 124. Program Structure C++ Program: collection of files Source (.cpp) files be compiled separately to be linked into an executable Files.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 9 Inheritance and.
JavaScript: The First Parts Part One Douglas Crockford Yahoo! Inc.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Objects.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved X 1 Chapter 9 Objects and Classes.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 6 Objects and Classes.
Chapter 8 Class Inheritance and Interfaces F Superclasses and Subclasses  Keywords: super F Overriding methods  The Object Class  Modifiers: protected,
Inheritance 2 Mehdi Einali Advanced Programming in Java 1.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Introduction To Objects Oriented Programming Instructor: Mohammed Faisal.
MIT-AITI: Functions Defining and Invoking Functions Functions as Data Function Scope: The call Object Function Arguments: The arguments objects Function.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
Object Oriented JavaScript. JavaScript Really only 4 types in JavaScript – number, string, boolean – Object (includes arrays) Remember that an object.
Getting from Scripts to Applications Donald J. Sipe | Refresh Jacksonville | November 11 th 2008.
5.1 Basics of defining and using classes A review of class and object definitions A class is a template or blueprint for an object A class defines.
Click to add Text Javascript Presented by Bunlong VAN Basic.
Lecture 9: Object and Classes Michael Hsu CSULA. 2 OO Programming Concepts Object-oriented programming (OOP) involves programming using objects. An object.
What is an object?. What Makes an Object? An object has identity (it acts as a single whole). Every object has a name that identifies what it is. Ex.
By: Travis Powell and Chad Herman. About CoffeeScript The Golden Rule: o "Its just JavaScript" One-to-One Compilage into equivalent JavaScript Passes.
Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved X 1 Chapter 9 Introduction of Object Oriented Programming.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Objects as a programming concept
Java Primer 1: Types, Classes and Operators
Chapter 3: Using Methods, Classes, and Objects
Dr. Charles W. Kann III JavaScript Objects Dr. Charles W. Kann III
Java Programming Language
CS5220 Advanced Topics in Web Programming JavaScript Basics
SPL – PS3 C++ Classes.
Presentation transcript:

Advanced JS The World's Most Misunderstood Programming Language ) Douglas Crockford( Shimon Dahan

Basic JavaScript Overview Closures JavaScript Objects Model Prototype Inheritance More OOP Concepts Agenda

Variables Variable names are case-sensitive. Variables can be implicitly declared JavaScript is a loosely typed language Variables types Variables scope === VS == Basic JavaScript

Functions functions are objects special feature: invokable Can pass more argument (or less) that declared arguments property The arguments of a function are maintained in an array-like object Functions always return something this keyword – call & apply

Functions Functions can be defined inside of other functions.

Primitive values Undefined, Null, Boolean, Number, and String Reference values Array or a user-defined object Parameters are always passed by value. Note that if you pass an object, the address of the object is passed by value, but changes we make affects the original object. Reference & Value

An inner function has access to the variables and parameters of functions that it is contained within. The scope that an inner function enjoys continues even after the parent functions have returned Closure

What’s an object? a hash of key => value pairs if a key (property) happens to be a function, we can call it a method Object literal notation { Wrapped in curly braces },-delimited properties key:value pairs The scope that an inner function enjoys continues even after the parent functions have returned JavaScript Objects Model

Constructors When invoked with new, functions return an object known as this You have a chance of modifying this before it's returned JavaScript Objects Model

A Public Method is a function that uses this to access its object This binding of this to an object happens at invocation time Use Closure for private fields Encapsulation

A property of the Function objects A prototype is an object from which other objects inherit properties The prototype chain Prototype

Inheritance via the prototype var Dad = function () { this.family = “Levi"; }; var Kid = function () { }; Kid.prototype = new Dad(); var moti = new Kid();

Class-based (Java)Prototype-based (JavaScript) Class and instance are distinct entities.All objects are instances. Define a class with a class definition; instantiate a class with constructor methods. Define and create a set of objects with constructor functions. Create a single object with the new operator.Same. Construct an object hierarchy by using class definitions to define subclasses of existing classes. Construct an object hierarchy by assigning an object as the prototype associated with a constructor function. Inherit properties by following the class chain.Inherit properties by following the prototype chain. Class definition specifies all properties of all instances of a class. Cannot add properties dynamically at run time. Constructor function or prototype specifies an initial set of properties. Can add or remove properties dynamically to individual objects or to the entire set of objects.

תודה :)