SlideShare uma empresa Scribd logo
1 de 30
Building Happy Web Applications
Elan Hami
Frontend Framework Team
LivePerson
Elan Hami
Frontend Developer here @ LivePerson
Developing client-side projects for ~4 years
elanh@liveperson.com
Most new applications today are:
• Mobile/Tablet apps (i-*, Android, etc.)
• Web apps
• Single-page apps
• With JavaScript
JavaScript can make you sad
• No compiler – hard to trace basic “errors”
• Multiple runtime environments
• Hard to make sense of
• Hard to maintain – very lenient, easy to abuse
• No isolation – everything runs together
• OO aspects can be misleading or missing
• The Bad Parts by Douglas Crockford
http://oreilly.com/javascript/excerpts/javascript-
good-parts/bad-parts.html
But, you CAN be happy
Happy (hap·py, adj., ˈha-pē):
• in software design -
1. Makes you happy today
2. Keeps future you happy
How?
Stop treating client as
“dumb”
Client can’t do everything
• Some things are solely for server
• Security
• Authentication & authorization
• Actual input validation
• Persistence to (non client) data-storage
But…
Doesn’t mean they’re simple
• Clients should be smart in their domain:
• Handle navigation flows (single page)
• Manipulate data models
• UI logic and presentation
• i18n
• Sync data from multiple APIs
• Allow to work offline
Client side challenges are major and need a serious
attitude
OK, but how do I solve
those issues?
Apply well known design
principles
Modularity
Separation of concerns
Composition
I like those concepts, but
it’s hard in JavaScript!
Choose an MV*
provider
(or build one)
Why?
Modularity
Separation of concerns
Composition
Using Your Library
• Learn it
• Understand what it provides
• Keep learning it – not just the basics
• Evolve your code patterns with it
• Remember moving from Vanilla JS to jQuery?
(What’s that $ doing everywhere?!)
Some examples
With jQuery
var that = this;
$(".name").change(function(e){
var newVal = $(this).val();
that.changeName(newVal);
});
$(".saveBtn").click(function(e){
that.save();
});
With Backbone
events: {
"click .saveBtn":"save",
"change .name":"changeName"
}
Some examples
With jQuery
var that = this;
this.vent.on("myEvent", function(data){
//do something with that
});
With Underscore
this.vent.on("myEvent",
_.bind(this.handler, this));
//in handler this is this
Don’t be afraid to make
mistakes
Use the right tools
•Dependency management – allows separation
of resources (we use require.js)
–Don’t worry about too many requests
–In dev we load ~500 files, in prod ~3
•JSHint/JSLint – a must (really)
•Testing - QUnit, Jasmine, whatever
•Build tools – use build tools for client code
(r.js, grunt, yeoman)
Questions?
Further reading:
http://addyosmani.com/resources/essentialjsdesignpatterns/book/
http://addyosmani.com/writing-modular-js/
http://lostechies.com/derickbailey/
http://addyosmani.com/largescalejavascript/
http://stackoverflow.com/questions/10847852/what-are-the-real-world-strengths-and-
weaknesses-of-the-many-frameworks-based-on
http://net.tutsplus.com/tutorials/javascript-ajax/3-reasons-to-choose-angularjs-for-
your-next-project/
Q&A
peoplejobs@liveperson.com
Want to work on cool stuff
like this?

Mais conteúdo relacionado

Último

Último (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Building happy web applications

Notas do Editor

  1. Mix of Suspicion \ Wariness \ “No way I’m getting into that”
  2. It makes me sad tooLet’s face it, we have a lemon
  3. But we can make lemonade
  4. Makes me happy that we have all these challenges!
  5. Approach client side coding as engineering problemTreat it as something that can challenge your intellect
  6. Single responsibility & IndependenceBreaking down problemsEasily interchangeable and maintainable1 class per fileCommunication through eventsMakes me happy!
  7. Each module should deal with a specific problemDifferent module types for different problems – Data VS VisualAllows independent developmentLayersEncapsulationMakes me happy!
  8. Combine simple objects to solve complex issuesReuse componentsSolve problems onceFix problems onceMakes me happy!
  9. You are right, but we won’t let that stop our pursuit!
  10. It doesn’t matter whichJust choose oneOr build one yourself
  11. You are right, but we won’t let that stop our pursuit!
  12. Every object (Model, View, Controller) has a single responsibility and problem setThey are independent (multiple views can be developed over 1 model)Break down problems like API communication and Browser quirks Easy to replace your View without touching the data modelEach object can be written in a separate file – Use dependency management and buildEvent driven architecture – loose couplingMakes me happy!
  13. Models deal with data/APIs, Views deal with Presentation/DOM events, Controllers deal with Business LogicAllows independent developmentLayers – Lasagna codeEncapsulation of complicated data manipulationMakes me happy!
  14. Don’t look at pages as one large thingBreak down to UI components with easy interfaceCombine Components to create a page – fast, consistent developmentReuse componentsSolve problems onceFix problems onceMakes me happy!
  15. Once you chose – learn how to useDon’t lose the excitementYou will see that you start applying the correct design patterns
  16. Don’t look at pages as one large thingBreak down to UI components with easy interfaceCombine Components to create a page – fast, consistent developmentReuse componentsSolve problems onceFix problems onceMakes me happy!