SlideShare a Scribd company logo
Write Better Javascript
Event #4
Aymeric Gaurat Apelli
Senior Developer
Who am I?
Why a “Who am I?”
• Aymeric Gaurat-Apelli
• .NET developer/consultant since first beta
• Worked in France, Australia (Readify) and Thailand
• Web entrepreneur
• Facebook games (1M users/day)
• http://taskarmy.com
• http://weekplan.net (knockout.js SPA)

• Principal developer at Jetabroad (Thailand)
“Classes”
Yes you can… kind of.

Want inheritance?
http://ejohn.org/blog/simple-javascript-inheritance/
Coding
principles
They apply to Javascript too!

DRY
Don’t repeat yourself

KISS
Simplicity (and avoiding complexity)
should always be a key goal.

YAGNI
You aren’t going to need it.
Coding
principles

LAW OF DEMETER
Code components should only
communicate with their direct relations

SRP
A component of code (e.g. class or function)
should perform a single well defined task.

DEPENDENCY INJECTION
Depend upon Abstractions.
Do not depend upon Concretions.
How would you rewrite this code?

Suggestion:
http://jsfiddle.net/XejEY/1/
Javascript
Frameworks
More structure for your code

Check out
http://todomvc.com/
Templating
engines

Allow you to reuse snippets of
HTML and to bind it to your data
http://jsfiddle.net/aPv9H/1/

Choose a template engine

Fast templating engine.
Scope

There is no block level scope.

A bit different from C#

http://madebyknight.com/javascript-scope/

http://jsfiddle.net/Ukv2R/1/
Modules
The solution to spaghetti code
Sample home grown module
AMD, the standard.

Popular AMD module loader: requirejs
Dependencies versus events
Dependencies versus events
After refactoring

Router.js module
Unit testing
http://qunitjs.com/intro/

http://pivotal.github.io/jasmine/
Random
tips

1. Link to your javascript code
at the end of your HTML document
2. Bundle and minify
3. Work with css classes instead of working
with styling/animations
Example
Resources
to learn

http://microjs.com/
Fantastic micro libraries
to use and learn from

http://dailyjs.com
Blog about new stuff
in the Javascript world
http://terrariumjs.wiselabs.net

http://github.com
Search for javascript projects
Thank you

More Related Content

What's hot (11)

PDF
CV-Phi_Hoang
Hoang Phi
 
PDF
Notice Me, Senpai! Get Discovered with Creative Technical Content
Tomomi Imura
 
PDF
Visual Validation - The Missing Tip of the Automation Pyramid
Anand Bagmar
 
PDF
Java Freelancing
Dmitry Buzdin
 
PDF
Enterprise PHP (php|works 2008)
Ivo Jansch
 
PDF
Teach a Man To Fish (phpconpl edition)
Lorna Mitchell
 
PDF
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
Tomomi Imura
 
PDF
Full-Stack Development
Dhilipsiva DS
 
PDF
Architecture @ Appknox
Dhilipsiva DS
 
PDF
Ampersand Commerce Graduate Schemes 2013
Ampersand
 
PPT
Whay QA- engineers should know how to code
QA Club Kiev
 
CV-Phi_Hoang
Hoang Phi
 
Notice Me, Senpai! Get Discovered with Creative Technical Content
Tomomi Imura
 
Visual Validation - The Missing Tip of the Automation Pyramid
Anand Bagmar
 
Java Freelancing
Dmitry Buzdin
 
Enterprise PHP (php|works 2008)
Ivo Jansch
 
Teach a Man To Fish (phpconpl edition)
Lorna Mitchell
 
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
Tomomi Imura
 
Full-Stack Development
Dhilipsiva DS
 
Architecture @ Appknox
Dhilipsiva DS
 
Ampersand Commerce Graduate Schemes 2013
Ampersand
 
Whay QA- engineers should know how to code
QA Club Kiev
 

Viewers also liked (8)

PPT
Metaphor
Tabitha Booth
 
PPT
Goalstribe
Aymeric Gaurat-Apelli
 
PPTX
TaskArmy - Pitch Deck
Aymeric Gaurat-Apelli
 
PPTX
Tips from a retired facebook app developer
Aymeric Gaurat-Apelli
 
PPTX
Why Ruby on Rails rocks from a .net developer eye
Aymeric Gaurat-Apelli
 
PPT
New Employees
nicatwood
 
PPTX
Write Better Javascript code
Aymeric Gaurat-Apelli
 
PPTX
Knockout (support slides for presentation)
Aymeric Gaurat-Apelli
 
Metaphor
Tabitha Booth
 
TaskArmy - Pitch Deck
Aymeric Gaurat-Apelli
 
Tips from a retired facebook app developer
Aymeric Gaurat-Apelli
 
Why Ruby on Rails rocks from a .net developer eye
Aymeric Gaurat-Apelli
 
New Employees
nicatwood
 
Write Better Javascript code
Aymeric Gaurat-Apelli
 
Knockout (support slides for presentation)
Aymeric Gaurat-Apelli
 
Ad

Similar to Event4 better javascript (20)

PDF
15 Experts on the Art of JavaScript Programming
FusionCharts
 
PPTX
jquery summit presentation for large scale javascript applications
DivyanshGupta922023
 
PPTX
SPA Architecture Basics - Colombo JS meetup
Hasith Yaggahavita
 
PDF
Professional JavaScript: AntiPatterns
Mike Wilcox
 
PDF
Object Oriented Programming | class | object
Asim217608
 
PPT
Building Rich User Experiences Without JavaScript Spaghetti
Jared Faris
 
PDF
Javascript spaghetti stirtrek_5_17
Jared Faris
 
PDF
Patterns, Code Smells, and The Pragmattic Programmer
Jason McCreary
 
PDF
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
PDF
Maintainable Javascript carsonified
Christian Heilmann
 
PPTX
Monster JavaScript Course - 50+ projects and applications
Laurence Svekis ✔
 
PDF
Good Coding Practices with JavaScript
🏁 Pierre-Henry Soria 💡
 
KEY
SOLID Design Principles
Samuel Breed
 
PPTX
Becoming a better developer by using the SOLID design principles
Katerina Trajchevska
 
KEY
10 Years of JavaScript
Mike de Boer
 
PPTX
Teaching old java script new tricks
Simon Sturmer
 
PDF
Maintainable JavaScript 2011
Nicholas Zakas
 
PPTX
Maintainable JavaScript 2012
Nicholas Zakas
 
KEY
hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7
Elisha Tan
 
PPTX
From Good to SOLID: How to become a better PHP developer
Katerina Trajchevska
 
15 Experts on the Art of JavaScript Programming
FusionCharts
 
jquery summit presentation for large scale javascript applications
DivyanshGupta922023
 
SPA Architecture Basics - Colombo JS meetup
Hasith Yaggahavita
 
Professional JavaScript: AntiPatterns
Mike Wilcox
 
Object Oriented Programming | class | object
Asim217608
 
Building Rich User Experiences Without JavaScript Spaghetti
Jared Faris
 
Javascript spaghetti stirtrek_5_17
Jared Faris
 
Patterns, Code Smells, and The Pragmattic Programmer
Jason McCreary
 
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
Maintainable Javascript carsonified
Christian Heilmann
 
Monster JavaScript Course - 50+ projects and applications
Laurence Svekis ✔
 
Good Coding Practices with JavaScript
🏁 Pierre-Henry Soria 💡
 
SOLID Design Principles
Samuel Breed
 
Becoming a better developer by using the SOLID design principles
Katerina Trajchevska
 
10 Years of JavaScript
Mike de Boer
 
Teaching old java script new tricks
Simon Sturmer
 
Maintainable JavaScript 2011
Nicholas Zakas
 
Maintainable JavaScript 2012
Nicholas Zakas
 
hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7
Elisha Tan
 
From Good to SOLID: How to become a better PHP developer
Katerina Trajchevska
 
Ad

Recently uploaded (20)

PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Designing Production-Ready AI Agents
Kunal Rai
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Biography of Daniel Podor.pdf
Daniel Podor
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 

Event4 better javascript