SlideShare ist ein Scribd-Unternehmen logo
1 von 85
Buildin’ Apps
   @txjs #2011
FAIR WARNING


If you are sensitive to anything gtfo.
This includes...

• sexuality
• gender
• race
• religion
... and not limited to:

• microframeworks vs uberframeworks
• native vs web
• vim vs emacs

 Basically, any polarizing junk debate.
Nothing is absolute; there
 is no right or wrong.
// embrace imperfection

null instanceof Object
// false

typeof null
// ‘object’
# whoami




 @brianleroux
ye ol’ UNIX philosophy

      - mythical collection of koans
      - bottom up and pragmatic
      - ignoring it is irresponsible
Make each program do one thing well. To do a
 new job, build afresh rather than complicate old
       programs by adding new features.


                                         Doug McIlroy
Rule 1. You can’t tell where a program is going to spend its time.
Bottlenecks occur in surprising places, so don’t try to second guess and
put in a speed hack until you’ve proven that’s where the bottleneck is.

Rule 2. Measure. Don’t tune for speed until you’ve measured, and even
then don’t unless one part of the code overwhelms the rest.

Rule 3. Fancy algorithms are slow when n is small, and n is usually
small. Fancy algorithms have big constants. Until you know that n is
frequently going to be big, don’t get fancy. (Even if n does get big, use
Rule 2 first.)

Rule 4. Fancy algorithms are buggier than simple ones, and they’re
much harder to implement. Use simple algorithms as well as simple
data structures.

Rule 5. Data dominates. If you’ve chosen the right data structures and
organized things well, the algorithms will almost always be self-evident.
Data structures, not algorithms, are central to programming.

Rule 6. There is no Rule 6.
                                                                   Rob Pike
When in doubt,
use brute force.



                   Ken Thompson
Eric S. Raymond
Rule of Modularity

Write simple parts connected by
clean interfaces.
Rule of Clarity

Clarity is better than cleverness.
Rule of Composition

Design programs to be
connected to other programs.
Rule of Separation

Separate policy from mechanism;
separate interfaces from engines.
Rule of Simplicity

Design for simplicity; add complexity
only where you must.
Rule of Parsimony

Write a big program only when it is clear
by demonstration that nothing else will do.
Rule of Transparency

Design for visibility to make
inspection and debugging easier.
Rule of Robustness

Robustness is the child of
transparency and simplicity.
Rule of Representation

Fold knowledge into data so program
logic can be stupid and robust.
Rule of Least Surprise

In interface design, always do
the least surprising thing.
Rule of Silence

When a program has nothing surprising
to say, it should say nothing.
Rule of Repair

When you must fail, fail noisily
and as soon as possible.
Rule of Economy

Programmer time is expensive; conserve
it in preference to machine time.
Rule of Generation

Avoid hand-hacking; write programs
to write programs when you can.
Rule of Optimization

Prototype before polishing. Get it
working before you optimize it.
Rule of Diversity

Distrust all claims for “one true way”.
Rule of Extensibility

Design for the future, because it will be
here sooner than you think.
Balance > Purity
Unix Haters Handbook
“...your book is a pudding stuffed with apposite
observations, many well-conceived. Like
excrement, it contains enough undigested
nuggets of nutrition to sustain life for some. But
it is not a tasty pie: it reeks too much of
contempt and of envy.

Bon appetit!
                                      Dennis Ritchie
practice != principle


best practices are temporal
don’t confuse a practice w/ a principle
eg: technology w/ goal (eg. git vs rcs)
great principles

revision control
issue tracking
unit testing
automated builds
principle ... practice

revision control ..... git
issue tracking ......... bugzilla
unit testing ............. qunit
automated builds ... hudson
mobile development

your development operating system(s)
device operating systems
software development kits
IDE dependence
devices themselves
mobile development
is a hostile environment
“It’s a poor craftsman
who blames his tools.”
“Get some new tools.”
programming is hard


failure is likely; if not inevitable
so, what are we waiting for?
http://github.com/brianleroux/cordova
the web as a platform

deep API integration to the host env
first class tooling support
standards


W3C various groups
TC39 *




  * green developer needs modules badly
mobile browser scene

webkits every-fucking-where I look
ie still happens
opera mini / opera mobile
firefox
device apis

sensors
data
outputs
device api browser
       scene
geospatial business everywhere
(literally!)
Capture API now in Android 3.x, Opera
file api partially seen in FF, Android
PhoneGap Platforms

iOS            webOS
Android       Symbian
BlackBerry      Bada
The PhoneGap Web
       Ecosystem


Any JS framework.
Any text editor.


Anything appropriate for web dev.
micro vs uber
microframeworks
pros
tiny! less code is good.
does one thing well


cons
not cohesive (require glue and updates)
inconsistent (different codebases)
uberframeworks
pros
future proofing built in
structures your code for you


cons
heavy (lots of code)
generalized (do not do one thing well)
It’s easy to make a case for
or against either approach.
It depends.
Be appropriate.
So, how does
PhoneGap work?
The technique...

1. Instantiate a chromeless browser
   instance.
2. Implement PhoneGap.exec bridge code.
3. Implement native plugin code.
4. Implement your JS API by wrapping
   PhoneGap.exec() into something pretty.
...
 }
iOS init webview




* PhoneGapDelegate.m line 178
iOS Native to JS




This was what inspired the original hack!
document.location
// I shit you not
iFrame
Android webview

import android.webkit.*




     * DroidGap.java
Nasty bug in Android 2.3 emulators
caused addJavaScriptInterface to fail...


      Possibly some devices too.
onJsPrompt
// I shit you not
Android Native to JS




* ghetto, but it works and did work for a very long time
com.phonegap.CallBackServer.java
// you can’t make this stuff up!
4.2
document.cookie
// I shit you not
Plugins

Any native code can be called by
PhoneGap.
Anything: its always been this way too.
Thats how it works dude.
PhoneGap API
Accelerometer   Events
Camera          File
Capture         Geolocation
Compass         Media
Connection      Network
Contacts        Notification
Device          Storage
Closer look at Geo

geolocation
accelerometer
gyroscope
magnometer
Closing concerns

debugging
performance
security
The Future
debugging?

no longer a colossal PITA
chrome building in smarts for remoting
most ide envs have step debug now
until then: pull out your weinre *


    * http://debug.phonegap.com
debuggers are not a substitute
   for unit tests and linting
performance
http://stevesouders.com is the man
latency != init != exec
less code is faster code to write, exec, debug
compile, concat, min, inline, etc
closure compiler advanced mode is promising
DO NOT use css transforms (yet)
AVOID gradients, text-shadow, etc
ZOMG Future!!!

Windows Phone 7
PhoneGap/Qt (Symbian && MeeGo)
http://build.phonegap.com
Futuristic Future!!!1!

Background Services
WebGL
Web Notifications API
<menu>
alternate rendering engines (non-webkit)
mobile is hostile: use build tools to
automate repetitive tasks

read up on those that came before; this
isn’t new stuff

build a mobile web app first

give vanilla javascript a try; its a neat
language!
thx, eh!

Weitere ähnliche Inhalte

Was ist angesagt?

Lessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's AssLessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's Ass
Kevin Whinnery
 
Write Better JavaScript
Write Better JavaScriptWrite Better JavaScript
Write Better JavaScript
Kevin Whinnery
 

Was ist angesagt? (19)

Gears and HTML 5 @media Ajax London 2008
Gears and HTML 5 @media Ajax London 2008Gears and HTML 5 @media Ajax London 2008
Gears and HTML 5 @media Ajax London 2008
 
A call to JS Developers - Let’s stop trying to impress each other and start b...
A call to JS Developers - Let’s stop trying to impress each other and start b...A call to JS Developers - Let’s stop trying to impress each other and start b...
A call to JS Developers - Let’s stop trying to impress each other and start b...
 
HTML5 or Android for Mobile Development?
HTML5 or Android for Mobile Development?HTML5 or Android for Mobile Development?
HTML5 or Android for Mobile Development?
 
Titanium @ Minnebar
Titanium @ MinnebarTitanium @ Minnebar
Titanium @ Minnebar
 
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
 
Bone.io for HTML5 Apps
Bone.io for HTML5 AppsBone.io for HTML5 Apps
Bone.io for HTML5 Apps
 
iPhone App from concept to product
iPhone App from concept to productiPhone App from concept to product
iPhone App from concept to product
 
Lessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's AssLessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's Ass
 
JavaScript as a First-Class Citizen on iOS 7
JavaScript as a First-Class Citizen on iOS 7JavaScript as a First-Class Citizen on iOS 7
JavaScript as a First-Class Citizen on iOS 7
 
Can we make es6 the baseline of the “modern web”? - BrazilJS 2105
Can we make es6 the baseline of the “modern web”? - BrazilJS 2105 Can we make es6 the baseline of the “modern web”? - BrazilJS 2105
Can we make es6 the baseline of the “modern web”? - BrazilJS 2105
 
Apache Cordova, Hybrid Application Development
Apache Cordova, Hybrid Application DevelopmentApache Cordova, Hybrid Application Development
Apache Cordova, Hybrid Application Development
 
Write Better JavaScript
Write Better JavaScriptWrite Better JavaScript
Write Better JavaScript
 
What Web Framework To Use?
What Web Framework To Use?What Web Framework To Use?
What Web Framework To Use?
 
Samsung Indonesia: Tizen Wearables
Samsung Indonesia: Tizen WearablesSamsung Indonesia: Tizen Wearables
Samsung Indonesia: Tizen Wearables
 
Building frameworks: from concept to completion
Building frameworks: from concept to completionBuilding frameworks: from concept to completion
Building frameworks: from concept to completion
 
Make Cross Platform Apps that Suck Less
Make Cross Platform Apps that Suck LessMake Cross Platform Apps that Suck Less
Make Cross Platform Apps that Suck Less
 
I broke what?!??!? Taking over maintenance on well loved projects
I broke what?!??!? Taking over maintenance on well loved projectsI broke what?!??!? Taking over maintenance on well loved projects
I broke what?!??!? Taking over maintenance on well loved projects
 
Hybrid Apps with Ionic Framework
Hybrid Apps with Ionic FrameworkHybrid Apps with Ionic Framework
Hybrid Apps with Ionic Framework
 
OSCON Titanium Tutorial
OSCON Titanium TutorialOSCON Titanium Tutorial
OSCON Titanium Tutorial
 

Ähnlich wie TxJS 2011

Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential Skills
John Choi
 

Ähnlich wie TxJS 2011 (20)

Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patterns
 
DeKnowledge - Try us
DeKnowledge - Try usDeKnowledge - Try us
DeKnowledge - Try us
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in php
 
From 🤦 to 🐿️
From 🤦 to 🐿️From 🤦 to 🐿️
From 🤦 to 🐿️
 
Website qa
Website qaWebsite qa
Website qa
 
Put to the Test
Put to the TestPut to the Test
Put to the Test
 
From DevOps to NoOps how not to get Equifaxed Apidays
From DevOps to NoOps how not to get Equifaxed ApidaysFrom DevOps to NoOps how not to get Equifaxed Apidays
From DevOps to NoOps how not to get Equifaxed Apidays
 
Best pratice
Best praticeBest pratice
Best pratice
 
From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018From Duke of DevOps to Queen of Chaos - Api days 2018
From Duke of DevOps to Queen of Chaos - Api days 2018
 
Worse Is Better, for Better or for Worse
Worse Is Better, for Better or for WorseWorse Is Better, for Better or for Worse
Worse Is Better, for Better or for Worse
 
10 Code Anti-Patterns to Avoid in Software Development.pdf
10 Code Anti-Patterns to Avoid in Software Development.pdf10 Code Anti-Patterns to Avoid in Software Development.pdf
10 Code Anti-Patterns to Avoid in Software Development.pdf
 
Why test with flex unit
Why test with flex unitWhy test with flex unit
Why test with flex unit
 
Security for AWS : Journey to Least Privilege (update)
Security for AWS : Journey to Least Privilege (update)Security for AWS : Journey to Least Privilege (update)
Security for AWS : Journey to Least Privilege (update)
 
Security for AWS: Journey to Least Privilege
Security for AWS: Journey to Least PrivilegeSecurity for AWS: Journey to Least Privilege
Security for AWS: Journey to Least Privilege
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web Application
 
Pain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakPain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr Sugak
 
Preparing for the WebGeek DevCup
Preparing for the WebGeek DevCupPreparing for the WebGeek DevCup
Preparing for the WebGeek DevCup
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential Skills
 
Php rules
Php rulesPhp rules
Php rules
 
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
Developers’ mDay u Banjoj Luci - Milan Popović, PHP Srbija – Testimony (about...
 

Mehr von Brian LeRoux (10)

After HTML5 Mobilism 2011
After HTML5 Mobilism 2011After HTML5 Mobilism 2011
After HTML5 Mobilism 2011
 
Mobile Knife Fighting at JSConf US
Mobile Knife Fighting at JSConf US Mobile Knife Fighting at JSConf US
Mobile Knife Fighting at JSConf US
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for Engineers
 
Fullfrontal 2010
Fullfrontal 2010Fullfrontal 2010
Fullfrontal 2010
 
Txjs
TxjsTxjs
Txjs
 
Palm Developer Day PhoneGap
Palm Developer Day PhoneGap Palm Developer Day PhoneGap
Palm Developer Day PhoneGap
 
Scurvyconf
ScurvyconfScurvyconf
Scurvyconf
 
Mobile Web App Development
Mobile Web App DevelopmentMobile Web App Development
Mobile Web App Development
 
Mobile JavaScript
Mobile JavaScriptMobile JavaScript
Mobile JavaScript
 
Phonegap 1.0
Phonegap 1.0Phonegap 1.0
Phonegap 1.0
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
"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 ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

TxJS 2011

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n