SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

CV-Phi_Hoang
CV-Phi_HoangCV-Phi_Hoang
CV-Phi_HoangHoang Phi
 
Notice Me, Senpai! Get Discovered with Creative Technical Content
Notice Me, Senpai! Get Discovered with Creative Technical ContentNotice Me, Senpai! Get Discovered with Creative Technical Content
Notice Me, Senpai! Get Discovered with Creative Technical ContentTomomi Imura
 
Visual Validation - The Missing Tip of the Automation Pyramid
Visual Validation - The Missing Tip of the Automation PyramidVisual Validation - The Missing Tip of the Automation Pyramid
Visual Validation - The Missing Tip of the Automation PyramidAnand Bagmar
 
Enterprise PHP (php|works 2008)
Enterprise PHP (php|works 2008)Enterprise PHP (php|works 2008)
Enterprise PHP (php|works 2008)Ivo Jansch
 
Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Lorna Mitchell
 
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...Tomomi Imura
 
Full-Stack Development
Full-Stack DevelopmentFull-Stack Development
Full-Stack DevelopmentDhilipsiva DS
 
Architecture @ Appknox
Architecture @ AppknoxArchitecture @ Appknox
Architecture @ AppknoxDhilipsiva DS
 
Ampersand Commerce Graduate Schemes 2013
Ampersand Commerce Graduate Schemes 2013Ampersand Commerce Graduate Schemes 2013
Ampersand Commerce Graduate Schemes 2013Ampersand
 
Whay QA- engineers should know how to code
Whay QA- engineers should know how to codeWhay QA- engineers should know how to code
Whay QA- engineers should know how to codeQA Club Kiev
 

Was ist angesagt? (11)

CV-Phi_Hoang
CV-Phi_HoangCV-Phi_Hoang
CV-Phi_Hoang
 
Notice Me, Senpai! Get Discovered with Creative Technical Content
Notice Me, Senpai! Get Discovered with Creative Technical ContentNotice Me, Senpai! Get Discovered with Creative Technical Content
Notice Me, Senpai! Get Discovered with Creative Technical Content
 
Visual Validation - The Missing Tip of the Automation Pyramid
Visual Validation - The Missing Tip of the Automation PyramidVisual Validation - The Missing Tip of the Automation Pyramid
Visual Validation - The Missing Tip of the Automation Pyramid
 
Java Freelancing
Java FreelancingJava Freelancing
Java Freelancing
 
Enterprise PHP (php|works 2008)
Enterprise PHP (php|works 2008)Enterprise PHP (php|works 2008)
Enterprise PHP (php|works 2008)
 
Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)
 
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
[DevRelCon Tokyo 2017] Creative Technical Content for Better Developer Experi...
 
Full-Stack Development
Full-Stack DevelopmentFull-Stack Development
Full-Stack Development
 
Architecture @ Appknox
Architecture @ AppknoxArchitecture @ Appknox
Architecture @ Appknox
 
Ampersand Commerce Graduate Schemes 2013
Ampersand Commerce Graduate Schemes 2013Ampersand Commerce Graduate Schemes 2013
Ampersand Commerce Graduate Schemes 2013
 
Whay QA- engineers should know how to code
Whay QA- engineers should know how to codeWhay QA- engineers should know how to code
Whay QA- engineers should know how to code
 

Andere mochten auch

Andere mochten auch (8)

Metaphor
MetaphorMetaphor
Metaphor
 
Goalstribe
GoalstribeGoalstribe
Goalstribe
 
TaskArmy - Pitch Deck
TaskArmy - Pitch DeckTaskArmy - Pitch Deck
TaskArmy - Pitch Deck
 
Tips from a retired facebook app developer
Tips from a retired facebook app developerTips from a retired facebook app developer
Tips from a retired facebook app developer
 
Why Ruby on Rails rocks from a .net developer eye
Why Ruby on Rails rocks from a .net developer eyeWhy Ruby on Rails rocks from a .net developer eye
Why Ruby on Rails rocks from a .net developer eye
 
New Employees
New EmployeesNew Employees
New Employees
 
Write Better Javascript code
Write Better Javascript codeWrite Better Javascript code
Write Better Javascript code
 
Knockout (support slides for presentation)
Knockout (support slides for presentation)Knockout (support slides for presentation)
Knockout (support slides for presentation)
 

Ähnlich wie Event4 better javascript

Recipe of a rockstar developer
Recipe of a rockstar developerRecipe of a rockstar developer
Recipe of a rockstar developerTopu Newaj
 
Career Talk Series Web Developer
Career Talk Series Web DeveloperCareer Talk Series Web Developer
Career Talk Series Web DeveloperRajwaAthoriq
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Codersebbe
 
Test Driven Development with Laravel
Test Driven Development with LaravelTest Driven Development with Laravel
Test Driven Development with LaravelTyler Johnston
 
TDD - Cultivating a Beginner's Mind
TDD -  Cultivating a Beginner's MindTDD -  Cultivating a Beginner's Mind
TDD - Cultivating a Beginner's MindShai Yallin
 
Integrating react in django while staying sane and happy
Integrating react in django while staying sane and happyIntegrating react in django while staying sane and happy
Integrating react in django while staying sane and happyFröjd Interactive
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdodaniil3
 
Introducing the JAQ (Java, Angular, Sql/NoSQL) Stack
Introducing the JAQ (Java, Angular, Sql/NoSQL) Stack Introducing the JAQ (Java, Angular, Sql/NoSQL) Stack
Introducing the JAQ (Java, Angular, Sql/NoSQL) Stack Suren Konathala
 
Cracking OCA and OCP Java 8 Exams
Cracking OCA and OCP Java 8 ExamsCracking OCA and OCP Java 8 Exams
Cracking OCA and OCP Java 8 ExamsGanesh Samarthyam
 
Software developer interview fails
Software developer interview failsSoftware developer interview fails
Software developer interview failsRaghuraman Kanchi
 
IT Success in and after College
IT Success in and after CollegeIT Success in and after College
IT Success in and after CollegeKeith Smith
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential SkillsJohn Choi
 
Java days Lviv 2015
Java days Lviv 2015Java days Lviv 2015
Java days Lviv 2015Alex Theedom
 
How to Build your Career.pptx
How to Build your Career.pptxHow to Build your Career.pptx
How to Build your Career.pptxvaideheekore
 

Ähnlich wie Event4 better javascript (20)

Recipe of a rockstar developer
Recipe of a rockstar developerRecipe of a rockstar developer
Recipe of a rockstar developer
 
Js basics
Js basicsJs basics
Js basics
 
Career Talk Series Web Developer
Career Talk Series Web DeveloperCareer Talk Series Web Developer
Career Talk Series Web Developer
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
 
Software development fundamentals
Software development fundamentalsSoftware development fundamentals
Software development fundamentals
 
Clean code
Clean codeClean code
Clean code
 
Test Driven Development with Laravel
Test Driven Development with LaravelTest Driven Development with Laravel
Test Driven Development with Laravel
 
TDD - Cultivating a Beginner's Mind
TDD -  Cultivating a Beginner's MindTDD -  Cultivating a Beginner's Mind
TDD - Cultivating a Beginner's Mind
 
Java 9, JShell, and Modularity
Java 9, JShell, and ModularityJava 9, JShell, and Modularity
Java 9, JShell, and Modularity
 
Integrating react in django while staying sane and happy
Integrating react in django while staying sane and happyIntegrating react in django while staying sane and happy
Integrating react in django while staying sane and happy
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdo
 
Introducing the JAQ (Java, Angular, Sql/NoSQL) Stack
Introducing the JAQ (Java, Angular, Sql/NoSQL) Stack Introducing the JAQ (Java, Angular, Sql/NoSQL) Stack
Introducing the JAQ (Java, Angular, Sql/NoSQL) Stack
 
Ee
EeEe
Ee
 
Bug Hunting Safari
Bug Hunting SafariBug Hunting Safari
Bug Hunting Safari
 
Cracking OCA and OCP Java 8 Exams
Cracking OCA and OCP Java 8 ExamsCracking OCA and OCP Java 8 Exams
Cracking OCA and OCP Java 8 Exams
 
Software developer interview fails
Software developer interview failsSoftware developer interview fails
Software developer interview fails
 
IT Success in and after College
IT Success in and after CollegeIT Success in and after College
IT Success in and after College
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential Skills
 
Java days Lviv 2015
Java days Lviv 2015Java days Lviv 2015
Java days Lviv 2015
 
How to Build your Career.pptx
How to Build your Career.pptxHow to Build your Career.pptx
How to Build your Career.pptx
 

Kürzlich hochgeladen

Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 

Kürzlich hochgeladen (20)

Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 

Event4 better javascript