Download presentation
Presentation is loading. Please wait.
Published byLeslie Johns Modified over 9 years ago
1
Jeremy Wells http://blog.postcivilization.com http://postcivilization.com https://twitter.com/jermywells https://plus.google.com/+JeremyWells Jeremy.Wells@postcivilization.com JAVASCRIPT if (!theFrontier.final()) {theFrontier.current(true);} (if not the final frontier, the current one)
2
JAVASCRIPT An object based language Has risen to a primary role in all modern web applications Is capable of OOP
3
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?]
4
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?]
5
What is OOP? Inheritance Encapsulation Polymorphism Abstraction Visit OOP article->
6
Inheritance -A mechanism for code reuse, serving to establish a hierarchy between objects Go to Inheritance Fiddle ->
7
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 ->
8
Polymorphism -An object is also another object. -Ad Hoc (overloading), Parametric (generics), Subtype (example below). Go to Polymorphism Fiddle ->
9
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 ->
10
Scope Scope / Execution ContextExecution Context -Global scope, Function scope, eval code Scope | Execution Context Scope and Execution Context are the same thing. Global Scope Function Scope *image from davidshariff.com
11
HoistingHoisting/Scalar Promotion/Loop Invariant Code MotionScalar 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 - >)(go to fiddle - >) types as variables var foo = ‘something’; var bar = 1; (go to fiddle ->)(go to fiddle ->) function declarations function foo (){ … } (go to fiddle ->) (go to fiddle ->)
12
Common Design Patterns -Singleton Pattern Go to Singleton Fiddle ->
13
Common Design Patterns -Factory Pattern Go to Factory Fiddle ->
14
Common Design Patterns -Fluent Interface / Extension Methods Go to Fluent Interface / Extension Methods Fiddle ->
15
Jeremy Wells http://blog.postcivilization.com http://postcivilization.com https://twitter.com/jermywells https://plus.google.com/+JeremyWells Jeremy.Wells@postcivilization.com JAVASCRIPT if (!theFrontier.final()) {theFrontier.current(true);} (if not the final frontier, the current one)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.