Why You Shouldn't Write OO
Upcoming SlideShare
Loading in...5
×
 

Why You Shouldn't Write OO

on

  • 1,659 views

 

Statistics

Views

Total Views
1,659
Views on SlideShare
1,635
Embed Views
24

Actions

Likes
2
Downloads
17
Comments
0

3 Embeds 24

http://www.slideshare.net 22
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

Why You Shouldn't Write OO Why You Shouldn't Write OO Presentation Transcript

  • { Evented...
  • Why You Shouldn’t Write OO jQuery
  • Why You Shouldn’t Write OO jQuery Troll View slide
  • Organization View slide
  • 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