jeremy wells jeremywells [email protected]

15
Jeremy Wells http://blog.postcivilization.com http://postcivilization.com https://twitter.com/jermywells https://plus.google.com/+JeremyWells [email protected] JAVASCRIPT if (!theFrontier.final()) {theFrontier.current(true);} (if not the final frontier, the current one)

Upload: leslie-johns

Post on 18-Dec-2015

231 views

Category:

Documents


2 download

TRANSCRIPT

Jeremy Wells

http://blog.postcivilization.comhttp://postcivilization.com

https://twitter.com/jermywellshttps://plus.google.com/+JeremyWells

[email protected]

JAVASCRIPTif (!theFrontier.final()) {theFrontier.current(true);}

(if not the final frontier, the current one)

JAVASCRIPT

•An object based language•Has risen to a primary role in all modern web applications •Is capable of OOP

OBJECT ORIENTED JAVASCRIPT

•No less dynamic than other JS•No less functional than other JS•It’s better organized•It’s more easily managed •It’s more easily maintained•It's more easily unit tested•It’s more modular•etc, etc, etc...

[We all know why OOP is good, right?]

OBJECT ORIENTED JAVASCRIPT

•No classes like C#•A function creates an object

•No access modifiers like C#•Put them out of your mind

[We all know why OOP is good, right?]

Inheritance-A mechanism for code reuse, serving to establish a hierarchy between objects

Go to Inheritance Fiddle ->

Encapsulation-Restricts access to an object's properties or components.

-Bundles logical units of data/code together with methods intended to operate on that data/code.

Go to Encapsulation Fiddle ->

Polymorphism-An object is also another object.

-Ad Hoc (overloading), Parametric (generics), Subtype (example below).

Go to Polymorphism Fiddle ->

Abstraction-A separation of concepts based upon logical units of implementation.

-Removing non-essential characteristics from something in order to reduce it to a set of essential characteristics

Go to Abstraction Fiddle ->

Hoisting/Scalar Promotion/Loop Invariant Code Motion-Functions and Variables are automatically moved to the top of their containing scopes/execution contexts.

Hoisting | Scalar Promotion | Loop Invariant Code Motion

1. Variables

2. Functions

•function expressions var foo = function(){ … } (go to fiddle ->)•types as variables var foo = ‘something’; var bar = 1; (go to fiddle ->)

•function declarations function foo (){ … } (go to fiddle ->)

Common Design Patterns-Singleton Pattern

Go to Singleton Fiddle ->

Common Design Patterns-Fluent Interface / Extension Methods

Go to Fluent Interface / Extension Methods Fiddle ->

Jeremy Wells

http://blog.postcivilization.comhttp://postcivilization.com

https://twitter.com/jermywellshttps://plus.google.com/+JeremyWells

[email protected]

JAVASCRIPTif (!theFrontier.final()) {theFrontier.current(true);}

(if not the final frontier, the current one)