• Like
  • Save
Organizing jQuery Projects Without OO
Upcoming SlideShare
Loading in...5
×
 

Organizing jQuery Projects Without OO

on

  • 3,599 views

 

Statistics

Views

Total Views
3,599
Views on SlideShare
3,569
Embed Views
30

Actions

Likes
1
Downloads
28
Comments
0

3 Embeds 30

http://www.slideshare.net 28
http://www.linkedin.com 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Organizing jQuery Projects Without OO Organizing jQuery Projects Without OO Presentation Transcript

    • { Evented...
    • Why You Shouldn’t Write OO jQuery
    • Why You Shouldn’t Write OO jQuery Troll
    • Organization
    • Organization X
    • Code Reuse
    • We’re Used to It
    • Strategy
    • Widget
    • Widget
    • Widget
    • Widget function function function
    • Widget AjaxWidget
    • Widget AjaxWidget HistoryAjaxWidget
    • Widget AjaxWidget super HistoryAjaxWidget
    • Widget super AjaxWidget super HistoryAjaxWidget
    • Widget AjaxWidget
    • Widget Widget AjaxWidget HistoryWidget
    • Composability
    • X Composability
    • OO Code in JS is Crippled Evented Code
    • Instead of calling a method
    • { widget.activate();
    • User Code Widget
    • User Code 1:1 Widget
    • User Code 1:1 Sync Widget
    • Trigger an Event
    • } element.trigger("activate")
    • User Code Listener Listener Listener
    • Advantages
    • Familiar Model
    • { $("div").click(function() { }) // do stuff
    • Evented Code Fits More Cleanly with Requirements
    • “When the user picks an item from the autocompleter”
    • Real Example
    • Caveat: Simple Technique
    • I’ve Used This Technique on Large Projects
    • Tabs
    • div.ui-tabs
    • click keypress div.ui-tabs
    • click keypress div.ui-tabs tabactivate
    • click keypress div.ui-tabs tabactivate
    • click keypress div.ui-tabs tabactivate
    • a) open pane b) mark tab selected tabactivate default analogy: typing in text box triggers a change event
    • a) open pane b) mark tab selected tabactivate return false default
    • Tech in the Example
    • Arista Theme
    • Sass and Compass
    • (try to avoid using JS to set up layouts)
    • Staticmatic
    • jQuery BBQ (Ben Alman)
    • Demo