JS JavaScripters www.javascripters.org JavaScripters Community to Connect, Share & Explore http://www.javascripters.org Email: pune.javascripters@gmail.com
JS JavaScripters www.javascripters.orgwww.javascripters.org 2 About JavaScripters JavaScripters is an initiative taken for front-end engineers community to share and gain JavaScript basic and advance knowledge along with moto to connect all javascripters together. We conduct technical discussion forums, sessions, workshops, trainings and knowledge sharing meet-ups around the city, for all front-end / UI engineers on core & advance(object oriented) level javascript concepts, along with all latest javascript frameworks like AngularJS, NodeJs, emberJs, TypeScript, ReactJs technologies by experts. • Since : April 2015 • Members : Around 2500+ • Speakers & Mentors : 17 • Events/ Meetup Conducted: 5 • Feature Planned Events : 10 events confirmed till December 2016 Our initiatives: WhatsApp Group (2) Meetup Groups JavaScriptes PuneJs HTML5-Web-Mobile-Development-Meetup Pune-UX-UI-Engineers WebF
JS JavaScripters www.javascripters.orgwww.javascripters.org List of upcoming events 3 1.JS Performance tips and tricks 2.BootStrap , CSS and Responsive Design 3.JavaScript Design Patterns 4.Introduction of Design thinking for front-end Engineers 5.React JS with Material design 6.Introduction to Angular 2.x 7.Practice with TypeSpcript 8.Introduction to ES6 9.Automated javascript workflow with Gulp 10.NodeJs practice session
JS JavaScripters www.javascripters.orgwww.javascripters.org Our Sponsor
JS JavaScripters www.javascripters.orgwww.javascripters.org • Laxman M • Tushar Jadhav About Speaker
JS JavaScripters www.javascripters.org WHY ARE WE HERE ?
JS JavaScripters www.javascripters.org What is Pattern? A pattern is a reusable solution that can be applied to commonly occurring problems. Another way of looking at pattern is as templates for how we solve problems.
JS JavaScripters www.javascripters.org Anti-Patterns Anti-patterns represents a lesson that has been learned. • Describes a bad solution to a particular problem that resulted in bad situation occurring • Describe how to get out of said situation and how to go from there to a good solution
JS JavaScripters www.javascripters.org Benefits • Patterns are proven solutions • Patterns can be easily reused • Patterns can be expressive
JS JavaScripters www.javascripters.org What is “good” pattern? A pattern is considered good if it • solves a particular problem • does not have an obvious solution • describes a proven concept • describes a relationship
JS JavaScripters www.javascripters.org Categories of Design Patterns • Creational Design Patterns focus on object-creation mechanism • Structural Design Patterns concerned with object composition and relationship between objects • Behavioural Design Patterns focus on improving or streamlining the communication between disparate objects
JS JavaScripters www.javascripters.org Overview • Constructor Pattern • Module Pattern • Singleton Pattern • Observer Pattern • Prototype Pattern • Facade Pattern • Factory Pattern • Decorator Pattern
JS JavaScripters www.javascripters.org Constructor Pattern A constructor is a special method used to initialise a newly created object once memory has been allocated for it.
JS JavaScripters www.javascripters.org Module Pattern Modules are an integral piece of any robust application’s architecture and typically help in keeping the units of code for a project both cleanly separated and organised. Modules can be implemented using • Object literal notation • The Module pattern • AMD modules • CommonJS modules • ECMAScript Harmony modules
JS JavaScripters www.javascripters.org The Module pattern A way to provide both private and public encapsulation for classes.
JS JavaScripters www.javascripters.org The Module pattern Advantages: • Encapsulation • Privacy Disadvantages: • Cannot access private members in the methods that are added to the object at later point • Inability to create automated unit tests for private members
JS JavaScripters www.javascripters.org Revealing Module Pattern In Module pattern, 1. repeat the name of module each time when accessing public method/variable from other public method 2. switch to object literal notation to make things public The updated module pattern in which all the functions and variables are defined in private scope and return an anonymous object with pointers to the private members to reveal them publicly.
JS JavaScripters www.javascripters.org Revealing Module Pattern Advantages: • Readability Disadvantages: • If a private function refers to public function, that public function can’t be overridden • Public object members that refer to private variables are also subject to no- patch rule
JS JavaScripters www.javascripters.org Singleton Pattern The singleton pattern restricts instantiation of a class to a single object. Classically, the Singleton pattern can be implemented by creating a class with a method that creates a new instance of the class if one doesn’t exist. In JavaScript, Singletons serve as a shared resource namespace which isolate implementation code from the global namespace so as to provide a single point of access for functions.
JS JavaScripters www.javascripters.org Observer Pattern In Observer pattern, an object(subject) maintains a list of objects depending on it(observers) automatically notifying them of any changes to state.
JS JavaScripters www.javascripters.org Difference between Observer and Pub/Sub Pattern
JS JavaScripters www.javascripters.org Observer and Pub/Sub Pattern Advantages: • Loosely Coupled • Flexibility Disadvantages: • In Pub/Sub, by decoupling publishers from subscribers, it can sometimes become difficult to obtain guarantees that particular parts of the application are functioning as we may expect
JS JavaScripters www.javascripters.org Prototype Pattern Creates objects based on a template of an existing object through cloning.
JS JavaScripters www.javascripters.org Facade Pattern This pattern provides a convenient higher-level interface to a larger body of code, hiding its true underlying complexity.
JS JavaScripters www.javascripters.org Facade Pattern Advantages: • Simplicity • Abstraction Disadvantages: • Performance
JS JavaScripters www.javascripters.org Factory Pattern A factory provides a generic interface for creating objects, where we can specify the type of factory object we wish to create.
JS JavaScripters www.javascripters.org Decorator Pattern Decorators are structural design pattern that aims to promote code reuse. They can be used to modify existing systems where we wish to add additional features to objects without the need to heavily modify the underlying code.
JS JavaScripters www.javascripters.org Decorator Pattern Advantages: • Flexible Disadvantages: • If poorly managed, it can add complexity
JS JavaScripters www.javascripters.org Can we check what we have learned ?
JS JavaScripters www.javascripters.orgwww.javascripters.org
JS JavaScripters www.javascripters.orgwww.javascripters.org Register for upcoming events 31 3.BootStrap , CSS and Responsive Design 4.Introduction of Design thinking for front-end Engineers 5.React JS with Material design 6.Introduction to Angular 2.x 7.Practice with TypeScript 8.Introduction to ES6 9.Automated javascript workflow with Gulp 10.NodeJs practice session 11. Total (3) online webinar under planning

JavaScripters Event Sep 17, 2016 · 2:00 PM: Scalable Javascript Design Patterns