Building APIs That Rock
                           Congratulations: If you’re here, you’re a nerd!




Wednesday, March 4,...
hi. i’m eaton.
                                                 •
               •                                     Vot...
You Have Been
                            Deceived


Wednesday, March 4, 2009
You Have Been
                            Deceived


Wednesday, March 4, 2009
http://www.flickr.com/photos/diamondduste/1918745208/
Wednesday, March 4, 2009
Drupal, 2004




http://www.flickr.com/photos/diamondduste/1918745208/
Wednesday, March 4, 2009
http://www.flickr.com/photos/ejpphoto/2314610838/
Wednesday, March 4, 2009
Drupal, 2009
http://www.flickr.com/photos/ejpphoto/2314610838/
Wednesday, March 4, 2009
http://www.flickr.com/photos/jphilipson/582274247/
Wednesday, March 4, 2009
Your Module




http://www.flickr.com/photos/jphilipson/582274247/
Wednesday, March 4, 2009
What is an API?
                           (Hint: If it’s got comments, it’s fair game)




Wednesday, March 4, 2009
http://www.flickr.com/photos/noahwesley/120499365/
Wednesday, March 4, 2009
This is your code.


http://www.flickr.com/photos/noahwesley/120499365/
Wednesday, March 4, 2009
This is your code.
               Can other devs use it?
http://www.flickr.com/photos/noahwesley/120499365/
Wednesday, Marc...
http://www.flickr.com/photos/splorp/126523012/
Wednesday, March 4, 2009
An
                                                  interface
                                                to reusable...
An
                           Features! Ponies!
                                                  interface
              ...
Your API

                                                        An
                           Features! Ponies!
        ...
Your UI


                             Your API

                                                        An
              ...
Your UI                     Code!


                             Your API

                                               ...
Wednesday, March 4, 2009
An abstraction
                that hides
                complexity




Wednesday, March 4, 2009
http://www.flickr.com/photos/mikereys/2643220264/
Wednesday, March 4, 2009
An agreement
                                  about how things
                                          are done




htt...
Gentlemen! A Recap!




Wednesday, March 4, 2009
Gentlemen! A Recap!
                                • Drupal is complicated




Wednesday, March 4, 2009
Gentlemen! A Recap!
                                • Drupal is complicated
                                • APIs let oth...
Gentlemen! A Recap!
                                • Drupal is complicated
                                • APIs let oth...
Gentlemen! A Recap!
                                • Drupal is complicated
                                • APIs let oth...
Screw this.




                           Let’s make an API.
http://www.flickr.com/photos/djou/2908514697/
Wednesday, Marc...
When two modules love
                 each other very much
                           The real story of how one API came ...
Wednesday, March 4, 2009
VotingAPI 0.1
                “This module looks cool, but that one works better…”




Wednesday, March 4, 2009
Wednesday, March 4, 2009
Find the nouns!




Wednesday, March 4, 2009
Find the nouns!




Wednesday, March 4, 2009
Find the nouns!
                              They’re your data!




Wednesday, March 4, 2009
Find the nouns!
                              They’re your data!




                           Find the verbs!

Wednesday...
Find the nouns!
                              They’re your data!




                           Find the verbs!

Wednesday...
Find the nouns!
                               They’re your data!




                           Find the verbs!
         ...
Step 2: Evolution!
                           Are the verbs and nouns flexible enough?




Wednesday, March 4, 2009
Wednesday, March 4, 2009
Step 3: Planning Ahead
                           Letting other modules do the unanticipated




Wednesday, March 4, 2009
Wednesday, March 4, 2009
Wednesday, March 4, 2009
Wednesday, March 4, 2009
Wednesday, March 4, 2009
Wednesday, March 4, 2009
Wednesday, March 4, 2009
SCREW YOU,
       MISTER API
       DESIGNER GUY
http://www.flickr.com/photos/jayd/3296037643
Wednesday, March 4, 2009
http://www.flickr.com/photos/jayd/3296037643
Wednesday, March 4, 2009
What happens when someone adds a new type?




http://www.flickr.com/photos/jayd/3296037643
Wednesday, March 4, 2009
What happens when someone adds a new type?
                What happens when another person does?




http://www.flickr.com...
What happens when someone adds a new type?
                What happens when another person does?

                       ...
What happens when someone adds a new type?
                What happens when another person does?

                       ...
Boldly going where no
          module has gone before




Wednesday, March 4, 2009
Boldly going where no
          module has gone before




                           (planning ahead)
Wednesday, March 4,...
Remember the verbs?




Wednesday, March 4, 2009
Remember the verbs?
                           Are you doing things other modules care about?




Wednesday, March 4, 2009
Remember the verbs?
                           Are you doing things other modules care about?




Wednesday, March 4, 2009
Remember the verbs?
                           Are you doing things other modules care about?




Wednesday, March 4, 2009
Remember the verbs?
                           Are you doing things other modules care about?




                        ...
Remember the nouns?




Wednesday, March 4, 2009
Remember the nouns?
                  Are you building data other modules want to change?




Wednesday, March 4, 2009
Remember the nouns?
                  Are you building data other modules want to change?




Wednesday, March 4, 2009
Remember the nouns?
                  Are you building data other modules want to change?




Wednesday, March 4, 2009
Remember the nouns?
                  Are you building data other modules want to change?




                            ...
Is your name Adrian?




Wednesday, March 4, 2009
Is your name Adrian?
                                  Perhaps Earl?




Wednesday, March 4, 2009
Is your name Adrian?
                                  Perhaps Earl?




Wednesday, March 4, 2009
Is your name Adrian?
                                  Perhaps Earl?




Wednesday, March 4, 2009
Is your name Adrian?
                                  Perhaps Earl?




Wednesday, March 4, 2009
Is your name Adrian?
                                  Perhaps Earl?




Wednesday, March 4, 2009
Is your name Adrian?
                                  Perhaps Earl?




Wednesday, March 4, 2009
Is your name Adrian?
                                              Perhaps Earl?




                Custom data structure...
Stop! Hammertime!




Wednesday, March 4, 2009
Stop! Hammertime!
                                 • Identify verbs and nouns




Wednesday, March 4, 2009
Stop! Hammertime!
                                 • Identify verbs and nouns
                                 • Layer you...
Stop! Hammertime!
                                 • Identify verbs and nouns
                                 • Layer you...
Stop! Hammertime!
                                 • Identify verbs and nouns
                                 • Layer you...
Stop! Hammertime!
                                 • Identify verbs and nouns
                                 • Layer you...
http://www.flickr.com/photos/tonyjcase/2847943252/
Wednesday, March 4, 2009
The Seven
                              Deadly
                                 Sins




                             http...
The Lone Ranger




Wednesday, March 4, 2009
The Lone Ranger

                   • Reinventing the wheel




Wednesday, March 4, 2009
The Lone Ranger

                   • Reinventing the wheel
                   • Ignoring conventions



Wednesday, March ...
The Lone Ranger

                   • Reinventing the wheel
                   • Ignoring conventions
                   •...
The Lone Ranger

                   • Reinventing the wheel
                   • Ignoring conventions
                   •...
Invisible Assumptions




Wednesday, March 4, 2009
Invisible Assumptions

                   • Assuming the global $user




Wednesday, March 4, 2009
Invisible Assumptions

                   • Assuming the global $user
                   • Checking arg(0)…



Wednesday, ...
Invisible Assumptions

                   • Assuming the global $user
                   • Checking arg(0)…
              ...
Invisible Assumptions

                   • Assuming the global $user
                   • Checking arg(0)…
              ...
Helping them to death




Wednesday, March 4, 2009
Helping them to death

                   • “I’ll set the breadcrumb while I’m at it...”




Wednesday, March 4, 2009
Helping them to death

                   • “I’ll set the breadcrumb while I’m at it...”
                   • “And I’ll se...
Helping them to death

                   • “I’ll set the breadcrumb while I’m at it...”
                   • “And I’ll se...
Helping them to death

                   • “I’ll set the breadcrumb while I’m at it...”
                   • “And I’ll se...
Leaky Abstraction




Wednesday, March 4, 2009
Leaky Abstraction

                   • “Just use this function…”




Wednesday, March 4, 2009
Leaky Abstraction

                   • “Just use this function…”
                   • ...And learn everything underneath ...
Leaky Abstraction

                   • “Just use this function…”
                   • ...And learn everything underneath ...
Leaky Abstraction

                   • “Just use this function…”
                   • ...And learn everything underneath ...
Leaky Abstraction

                   • “Just use this function…”
                   • ...And learn everything underneath ...
Fake Flexibility




Wednesday, March 4, 2009
Fake Flexibility

                   • “Oh, you can save any data…” (votingapi)




Wednesday, March 4, 2009
Fake Flexibility

                   • “Oh, you can save any data…” (votingapi)
                   • “Oh, there’s a hook f...
Fake Flexibility

                   • “Oh, you can save any data…” (votingapi)
                   • “Oh, there’s a hook f...
Fake Flexibility

                   • “Oh, you can save any data…” (votingapi)
                   • “Oh, there’s a hook f...
Mission Creep




Wednesday, March 4, 2009
Mission Creep

                   • Even worse than feature creep




Wednesday, March 4, 2009
Mission Creep

                   • Even worse than feature creep
                   • Common with “solve-a-big-problem” A...
Mission Creep

                   • Even worse than feature creep
                   • Common with “solve-a-big-problem” A...
Mission Creep

                   • Even worse than feature creep
                   • Common with “solve-a-big-problem” A...
Dependency Soup




Wednesday, March 4, 2009
Dependency Soup

                   • The flip side of mission creep




Wednesday, March 4, 2009
Dependency Soup

                   • The flip side of mission creep
                   • Focus, focus, focus!



Wednesday...
Dependency Soup

                   • The flip side of mission creep
                   • Focus, focus, focus!
            ...
Dependency Soup

                   • The flip side of mission creep
                   • Focus, focus, focus!
            ...
Oh, the Recappery!




Wednesday, March 4, 2009
Oh, the Recappery!

                                   • Cooperate




Wednesday, March 4, 2009
Oh, the Recappery!

                                   • Cooperate
                                   • Don’t assume too m...
Oh, the Recappery!

                                   • Cooperate
                                   • Don’t assume too m...
Oh, the Recappery!

                                   • Cooperate
                                   • Don’t assume too m...
Oh, the Recappery!

                                   • Cooperate
                                   • Don’t assume too m...
Oh, the Recappery!

                                   • Cooperate
                                   • Don’t assume too m...
http://www.flickr.com/photos/-sel-/60124578/
Wednesday, March 4, 2009
What? That’s it?
 http://www.flickr.com/photos/-sel-/60124578/
Wednesday, March 4, 2009
Thanks, flickr!

      •                                             •
            http://www.flickr.com/photos/mikereys    ...
Upcoming SlideShare
Loading in...5
×

Building Apis That Rock

8,061

Published on

Published in: Technology
3 Comments
19 Likes
Statistics
Notes
  • Link to PDF ( keynote presentation export ) of above slide

    http://www.techbracket.net/Building_Apis_That_Rock.pdf

    or

    http://www.scribd.com/doc/16032080/Building-Apis-That-Rock
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • hey Jeff
    I wanted to download this presentation, when i did , it was a ZIP file containing 2 folders 1. _macosx ( you made it on MAC) and 2. building-apis-that-rock.key , It contain many images and PDF , and some folders too.

    I am unable to get, how to open it as presentation and which software should i use. I dont have a MaC. I only have linux and windows. Can you please help me out here .
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • its rock dude!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
8,061
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
224
Comments
3
Likes
19
Embeds 0
No embeds

No notes for slide




  • You were promised puppets. Also, magic.
    Unfortunately, you’ve been deceived. There are no puppets.
    The ends justify the means: APIs are Drupal’s lifeblood.
  • When I started using Drupal, it was a little goofy, but fundamentally simple.
    Core. Some modules (gallery? event? done!)
    Maybe a custom module and a theme if you were REALLY crazy.
  • When I started using Drupal, it was a little goofy, but fundamentally simple.
    Core. Some modules (gallery? event? done!)
    Maybe a custom module and a theme if you were REALLY crazy.
  • Today, lots and lots of smaller modules
    Image == Views, CCK, FileField, ImageField, ImageCache, ImageAPI, Custom Breadcrumbs.
    Flexibility vs. Complexity
    All the pieces have to work with each other! And that’s where APIs come in.
  • Today, lots and lots of smaller modules
    Image == Views, CCK, FileField, ImageField, ImageCache, ImageAPI, Custom Breadcrumbs.
    Flexibility vs. Complexity
    All the pieces have to work with each other! And that’s where APIs come in.
  • The pull between functionality and flexibility
    Building code that does stuff, APIs that let other code control it, and UIs that let users configure/control
  • The pull between functionality and flexibility
    Building code that does stuff, APIs that let other code control it, and UIs that let users configure/control


  • Imagine a Drupal module as a giant pile of money.
    Mmmmmmmmmmm.
    Each of those awesome features is like a crisp $20.



    Imagine “Code” -- other Drupal modules -- as users who can’t click on anything. All they can do is call other functions.
    Can they use your module?



    Could an install profile set up your module automatically?
    Can someone turn off your UI entirely, and make it automatic?
    Can someone build a new UI for your module?
  • Imagine a Drupal module as a giant pile of money.
    Mmmmmmmmmmm.
    Each of those awesome features is like a crisp $20.



    Imagine “Code” -- other Drupal modules -- as users who can’t click on anything. All they can do is call other functions.
    Can they use your module?



    Could an install profile set up your module automatically?
    Can someone turn off your UI entirely, and make it automatic?
    Can someone build a new UI for your module?
  • Imagine a Drupal module as a giant pile of money.
    Mmmmmmmmmmm.
    Each of those awesome features is like a crisp $20.



    Imagine “Code” -- other Drupal modules -- as users who can’t click on anything. All they can do is call other functions.
    Can they use your module?



    Could an install profile set up your module automatically?
    Can someone turn off your UI entirely, and make it automatic?
    Can someone build a new UI for your module?
  • The ATM is a metaphor: it’s a basic way of controlling things that can be used externally.
    Flag
    Organic Groups
    node_save()
  • The ATM is a metaphor: it’s a basic way of controlling things that can be used externally.
    Flag
    Organic Groups
    node_save()
  • The ATM is a metaphor: it’s a basic way of controlling things that can be used externally.
    Flag
    Organic Groups
    node_save()
  • The ATM is a metaphor: it’s a basic way of controlling things that can be used externally.
    Flag
    Organic Groups
    node_save()
  • The ATM is a metaphor: it’s a basic way of controlling things that can be used externally.
    Flag
    Organic Groups
    node_save()
  • The ATM is a metaphor: it’s a basic way of controlling things that can be used externally.
    Flag
    Organic Groups
    node_save()
  • Something complicated can be simplified by putting a buffer between it, and you.
    ImageAPI
    Messaging
    Visitor
    cache_get() and cache_set()
  • Something complicated can be simplified by putting a buffer between it, and you.
    ImageAPI
    Messaging
    Visitor
    cache_get() and cache_set()
  • The value in credit cards isn’t that they’re thin and plastic
    It’s that everyone uses them, so the problem of “IOUs” and “Store credit” and “Pay you back later” are all handled with this.
    Everyone’s on the same page, so they can get on to solving other problems
  • The value in credit cards isn’t that they’re thin and plastic
    It’s that everyone uses them, so the problem of “IOUs” and “Store credit” and “Pay you back later” are all handled with this.
    Everyone’s on the same page, so they can get on to solving other problems












  • History of VotingAPI - 2005
    Was making a community site that needed to rate comments AND nodes, with a nice flash widget AND a nice
    Picked the one that seemed best and shamelessly ripped its guts out
  • History of VotingAPI - 2005
    Was making a community site that needed to rate comments AND nodes, with a nice flash widget AND a nice
    Picked the one that seemed best and shamelessly ripped its guts out
  • History of VotingAPI - 2005
    Was making a community site that needed to rate comments AND nodes, with a nice flash widget AND a nice
    Picked the one that seemed best and shamelessly ripped its guts out
  • Voila! VotingAPI 1.0 Beta! Simple, but effective.
    How to start thinking about it like an API?
    Find the nouns
    Find the verbs
    This is similar to building good classes in OOP languages like Java. Those guys think about APIs all freakin’ day.
  • Voila! VotingAPI 1.0 Beta! Simple, but effective.
    How to start thinking about it like an API?
    Find the nouns
    Find the verbs
    This is similar to building good classes in OOP languages like Java. Those guys think about APIs all freakin’ day.
  • Voila! VotingAPI 1.0 Beta! Simple, but effective.
    How to start thinking about it like an API?
    Find the nouns
    Find the verbs
    This is similar to building good classes in OOP languages like Java. Those guys think about APIs all freakin’ day.
  • Voila! VotingAPI 1.0 Beta! Simple, but effective.
    How to start thinking about it like an API?
    Find the nouns
    Find the verbs
    This is similar to building good classes in OOP languages like Java. Those guys think about APIs all freakin’ day.
  • Voila! VotingAPI 1.0 Beta! Simple, but effective.
    How to start thinking about it like an API?
    Find the nouns
    Find the verbs
    This is similar to building good classes in OOP languages like Java. Those guys think about APIs all freakin’ day.
  • Voila! VotingAPI 1.0 Beta! Simple, but effective.
    How to start thinking about it like an API?
    Find the nouns
    Find the verbs
    This is similar to building good classes in OOP languages like Java. Those guys think about APIs all freakin’ day.
  • Discussions on drupal.org, working with other developers to gather use cases.
    Not flexible enough! My my noun weren’t precise enough…
    Additional data: “Tag” for multiple criteria voting
    My verbs were too broad!
    Sub-functions.
    Building in layers is important
  • Discussions on drupal.org, working with other developers to gather use cases.
    Not flexible enough! My my noun weren’t precise enough…
    Additional data: “Tag” for multiple criteria voting
    My verbs were too broad!
    Sub-functions.
    Building in layers is important
  • Discussions on drupal.org, working with other developers to gather use cases.
    Not flexible enough! My my noun weren’t precise enough…
    Additional data: “Tag” for multiple criteria voting
    My verbs were too broad!
    Sub-functions.
    Building in layers is important
  • Discussions on drupal.org, working with other developers to gather use cases.
    Not flexible enough! My my noun weren’t precise enough…
    Additional data: “Tag” for multiple criteria voting
    My verbs were too broad!
    Sub-functions.
    Building in layers is important
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Feedback: Vote on a 1-100 scale! Or vote with “points” like Digg! And getting results is too slow -- sorting and filtering with them takes complex SQL!
    The “vote” noun has a ‘value type’ now. What does the number MEAN?
    New noun: “Results”, new verb “Recalculate”
    Now have votes that can be set, and retrieved. Results that can be recalculated and retrieved. “Value type” lets modules use it in unanticipated ways, too!
  • Holy crap, someone hates me.
    Quick show of hands -- what’s wrong with this?
  • Holy crap, someone hates me.
    Quick show of hands -- what’s wrong with this?
  • Holy crap, someone hates me.
    Quick show of hands -- what’s wrong with this?
  • Holy crap, someone hates me.
    Quick show of hands -- what’s wrong with this?
  • Holy crap, someone hates me.
    Quick show of hands -- what’s wrong with this?
  • Holy crap, someone hates me.
    Quick show of hands -- what’s wrong with this?
  • We’ve covered the basics of letting other modules “steer” your code.
    The next step - giving your module points of expansion
    Several common patterns in Drupal






































































































































  • Building Apis That Rock

    1. 1. Building APIs That Rock Congratulations: If you’re here, you’re a nerd! Wednesday, March 4, 2009
    2. 2. hi. i’m eaton. • • Voting API eaton@lullabot.com • • Token eaton in #drupal • • Form API twitter.com/eaton • Render API • • @eaton is rambling in the Amazon API #drupalapi presentation. • no puppets yet! Twitter API Wednesday, March 4, 2009
    3. 3. You Have Been Deceived Wednesday, March 4, 2009
    4. 4. You Have Been Deceived Wednesday, March 4, 2009
    5. 5. http://www.flickr.com/photos/diamondduste/1918745208/ Wednesday, March 4, 2009
    6. 6. Drupal, 2004 http://www.flickr.com/photos/diamondduste/1918745208/ Wednesday, March 4, 2009
    7. 7. http://www.flickr.com/photos/ejpphoto/2314610838/ Wednesday, March 4, 2009
    8. 8. Drupal, 2009 http://www.flickr.com/photos/ejpphoto/2314610838/ Wednesday, March 4, 2009
    9. 9. http://www.flickr.com/photos/jphilipson/582274247/ Wednesday, March 4, 2009
    10. 10. Your Module http://www.flickr.com/photos/jphilipson/582274247/ Wednesday, March 4, 2009
    11. 11. What is an API? (Hint: If it’s got comments, it’s fair game) Wednesday, March 4, 2009
    12. 12. http://www.flickr.com/photos/noahwesley/120499365/ Wednesday, March 4, 2009
    13. 13. This is your code. http://www.flickr.com/photos/noahwesley/120499365/ Wednesday, March 4, 2009
    14. 14. This is your code. Can other devs use it? http://www.flickr.com/photos/noahwesley/120499365/ Wednesday, March 4, 2009
    15. 15. http://www.flickr.com/photos/splorp/126523012/ Wednesday, March 4, 2009
    16. 16. An interface to reusable features http://www.flickr.com/photos/splorp/126523012/ Wednesday, March 4, 2009
    17. 17. An Features! Ponies! interface to reusable features http://www.flickr.com/photos/splorp/126523012/ Wednesday, March 4, 2009
    18. 18. Your API An Features! Ponies! interface to reusable features http://www.flickr.com/photos/splorp/126523012/ Wednesday, March 4, 2009
    19. 19. Your UI Your API An Features! Ponies! interface to reusable features http://www.flickr.com/photos/splorp/126523012/ Wednesday, March 4, 2009
    20. 20. Your UI Code! Your API An Features! Ponies! interface to reusable features http://www.flickr.com/photos/splorp/126523012/ Wednesday, March 4, 2009
    21. 21. Wednesday, March 4, 2009
    22. 22. An abstraction that hides complexity Wednesday, March 4, 2009
    23. 23. http://www.flickr.com/photos/mikereys/2643220264/ Wednesday, March 4, 2009
    24. 24. An agreement about how things are done http://www.flickr.com/photos/mikereys/2643220264/ Wednesday, March 4, 2009
    25. 25. Gentlemen! A Recap! Wednesday, March 4, 2009
    26. 26. Gentlemen! A Recap! • Drupal is complicated Wednesday, March 4, 2009
    27. 27. Gentlemen! A Recap! • Drupal is complicated • APIs let other code use your features Wednesday, March 4, 2009
    28. 28. Gentlemen! A Recap! • Drupal is complicated • APIs let other code use your features • APIs hide complexity Wednesday, March 4, 2009
    29. 29. Gentlemen! A Recap! • Drupal is complicated • APIs let other code use your features • APIs hide complexity • APIs get everyone on the same page Wednesday, March 4, 2009
    30. 30. Screw this. Let’s make an API. http://www.flickr.com/photos/djou/2908514697/ Wednesday, March 4, 2009
    31. 31. When two modules love each other very much The real story of how one API came to be Wednesday, March 4, 2009
    32. 32. Wednesday, March 4, 2009
    33. 33. VotingAPI 0.1 “This module looks cool, but that one works better…” Wednesday, March 4, 2009
    34. 34. Wednesday, March 4, 2009
    35. 35. Find the nouns! Wednesday, March 4, 2009
    36. 36. Find the nouns! Wednesday, March 4, 2009
    37. 37. Find the nouns! They’re your data! Wednesday, March 4, 2009
    38. 38. Find the nouns! They’re your data! Find the verbs! Wednesday, March 4, 2009
    39. 39. Find the nouns! They’re your data! Find the verbs! Wednesday, March 4, 2009
    40. 40. Find the nouns! They’re your data! Find the verbs! They’re your functions! Wednesday, March 4, 2009
    41. 41. Step 2: Evolution! Are the verbs and nouns flexible enough? Wednesday, March 4, 2009
    42. 42. Wednesday, March 4, 2009
    43. 43. Step 3: Planning Ahead Letting other modules do the unanticipated Wednesday, March 4, 2009
    44. 44. Wednesday, March 4, 2009
    45. 45. Wednesday, March 4, 2009
    46. 46. Wednesday, March 4, 2009
    47. 47. Wednesday, March 4, 2009
    48. 48. Wednesday, March 4, 2009
    49. 49. Wednesday, March 4, 2009
    50. 50. SCREW YOU, MISTER API DESIGNER GUY http://www.flickr.com/photos/jayd/3296037643 Wednesday, March 4, 2009
    51. 51. http://www.flickr.com/photos/jayd/3296037643 Wednesday, March 4, 2009
    52. 52. What happens when someone adds a new type? http://www.flickr.com/photos/jayd/3296037643 Wednesday, March 4, 2009
    53. 53. What happens when someone adds a new type? What happens when another person does? http://www.flickr.com/photos/jayd/3296037643 Wednesday, March 4, 2009
    54. 54. What happens when someone adds a new type? What happens when another person does? Use enums for lists that won’t change. http://www.flickr.com/photos/jayd/3296037643 Wednesday, March 4, 2009
    55. 55. What happens when someone adds a new type? What happens when another person does? Use enums for lists that won’t change. Use strings for stuff you can’t predict http://www.flickr.com/photos/jayd/3296037643 Wednesday, March 4, 2009
    56. 56. Boldly going where no module has gone before Wednesday, March 4, 2009
    57. 57. Boldly going where no module has gone before (planning ahead) Wednesday, March 4, 2009
    58. 58. Remember the verbs? Wednesday, March 4, 2009
    59. 59. Remember the verbs? Are you doing things other modules care about? Wednesday, March 4, 2009
    60. 60. Remember the verbs? Are you doing things other modules care about? Wednesday, March 4, 2009
    61. 61. Remember the verbs? Are you doing things other modules care about? Wednesday, March 4, 2009
    62. 62. Remember the verbs? Are you doing things other modules care about? module_invoke_all() It’s like party invitations for code Wednesday, March 4, 2009
    63. 63. Remember the nouns? Wednesday, March 4, 2009
    64. 64. Remember the nouns? Are you building data other modules want to change? Wednesday, March 4, 2009
    65. 65. Remember the nouns? Are you building data other modules want to change? Wednesday, March 4, 2009
    66. 66. Remember the nouns? Are you building data other modules want to change? Wednesday, March 4, 2009
    67. 67. Remember the nouns? Are you building data other modules want to change? drupal_alter() It’s like passing around the doobie of data Wednesday, March 4, 2009
    68. 68. Is your name Adrian? Wednesday, March 4, 2009
    69. 69. Is your name Adrian? Perhaps Earl? Wednesday, March 4, 2009
    70. 70. Is your name Adrian? Perhaps Earl? Wednesday, March 4, 2009
    71. 71. Is your name Adrian? Perhaps Earl? Wednesday, March 4, 2009
    72. 72. Is your name Adrian? Perhaps Earl? Wednesday, March 4, 2009
    73. 73. Is your name Adrian? Perhaps Earl? Wednesday, March 4, 2009
    74. 74. Is your name Adrian? Perhaps Earl? Wednesday, March 4, 2009
    75. 75. Is your name Adrian? Perhaps Earl? Custom data structures Build it, let modules alter it, then do stuff with it. Wednesday, March 4, 2009
    76. 76. Stop! Hammertime! Wednesday, March 4, 2009
    77. 77. Stop! Hammertime! • Identify verbs and nouns Wednesday, March 4, 2009
    78. 78. Stop! Hammertime! • Identify verbs and nouns • Layer your verbs to hide complexity Wednesday, March 4, 2009
    79. 79. Stop! Hammertime! • Identify verbs and nouns • Layer your verbs to hide complexity • Account for new uses Wednesday, March 4, 2009
    80. 80. Stop! Hammertime! • Identify verbs and nouns • Layer your verbs to hide complexity • Account for new uses • Broadcast events via hooks Wednesday, March 4, 2009
    81. 81. Stop! Hammertime! • Identify verbs and nouns • Layer your verbs to hide complexity • Account for new uses • Broadcast events via hooks • Let modules alter data Wednesday, March 4, 2009
    82. 82. http://www.flickr.com/photos/tonyjcase/2847943252/ Wednesday, March 4, 2009
    83. 83. The Seven Deadly Sins http://www.flickr.com/photos/tonyjcase/2847943252/ Wednesday, March 4, 2009
    84. 84. The Lone Ranger Wednesday, March 4, 2009
    85. 85. The Lone Ranger • Reinventing the wheel Wednesday, March 4, 2009
    86. 86. The Lone Ranger • Reinventing the wheel • Ignoring conventions Wednesday, March 4, 2009
    87. 87. The Lone Ranger • Reinventing the wheel • Ignoring conventions • Ignoring related APIs! Wednesday, March 4, 2009
    88. 88. The Lone Ranger • Reinventing the wheel • Ignoring conventions • Ignoring related APIs! • Common for newcomers, or obsessives Wednesday, March 4, 2009
    89. 89. Invisible Assumptions Wednesday, March 4, 2009
    90. 90. Invisible Assumptions • Assuming the global $user Wednesday, March 4, 2009
    91. 91. Invisible Assumptions • Assuming the global $user • Checking arg(0)… Wednesday, March 4, 2009
    92. 92. Invisible Assumptions • Assuming the global $user • Checking arg(0)… • Assuming logged in users… Wednesday, March 4, 2009
    93. 93. Invisible Assumptions • Assuming the global $user • Checking arg(0)… • Assuming logged in users… • Common with UI-bound APIs Wednesday, March 4, 2009
    94. 94. Helping them to death Wednesday, March 4, 2009
    95. 95. Helping them to death • “I’ll set the breadcrumb while I’m at it...” Wednesday, March 4, 2009
    96. 96. Helping them to death • “I’ll set the breadcrumb while I’m at it...” • “And I’ll send an email, too!” Wednesday, March 4, 2009
    97. 97. Helping them to death • “I’ll set the breadcrumb while I’m at it...” • “And I’ll send an email, too!” • “And add these links, and…” Wednesday, March 4, 2009
    98. 98. Helping them to death • “I’ll set the breadcrumb while I’m at it...” • “And I’ll send an email, too!” • “And add these links, and…” • Common when an API grows out of a specific use case, or an existing module Wednesday, March 4, 2009
    99. 99. Leaky Abstraction Wednesday, March 4, 2009
    100. 100. Leaky Abstraction • “Just use this function…” Wednesday, March 4, 2009
    101. 101. Leaky Abstraction • “Just use this function…” • ...And learn everything underneath it. Wednesday, March 4, 2009
    102. 102. Leaky Abstraction • “Just use this function…” • ...And learn everything underneath it. • Common in complex problem domains Wednesday, March 4, 2009
    103. 103. Leaky Abstraction • “Just use this function…” • ...And learn everything underneath it. • Common in complex problem domains • Simplify, or get out of the way Wednesday, March 4, 2009
    104. 104. Leaky Abstraction • “Just use this function…” • ...And learn everything underneath it. • Common in complex problem domains • Simplify, or get out of the way • Sometimes, problems are just complicated. Wednesday, March 4, 2009
    105. 105. Fake Flexibility Wednesday, March 4, 2009
    106. 106. Fake Flexibility • “Oh, you can save any data…” (votingapi) Wednesday, March 4, 2009
    107. 107. Fake Flexibility • “Oh, you can save any data…” (votingapi) • “Oh, there’s a hook for that…” (blogapi) Wednesday, March 4, 2009
    108. 108. Fake Flexibility • “Oh, you can save any data…” (votingapi) • “Oh, there’s a hook for that…” (blogapi) • Build 3 test implementations Wednesday, March 4, 2009
    109. 109. Fake Flexibility • “Oh, you can save any data…” (votingapi) • “Oh, there’s a hook for that…” (blogapi) • Build 3 test implementations • Step through different use cases Wednesday, March 4, 2009
    110. 110. Mission Creep Wednesday, March 4, 2009
    111. 111. Mission Creep • Even worse than feature creep Wednesday, March 4, 2009
    112. 112. Mission Creep • Even worse than feature creep • Common with “solve-a-big-problem” APIs Wednesday, March 4, 2009
    113. 113. Mission Creep • Even worse than feature creep • Common with “solve-a-big-problem” APIs • Focus, focus, focus. Wednesday, March 4, 2009
    114. 114. Mission Creep • Even worse than feature creep • Common with “solve-a-big-problem” APIs • Focus, focus, focus. • Split into complementary APIs Wednesday, March 4, 2009
    115. 115. Dependency Soup Wednesday, March 4, 2009
    116. 116. Dependency Soup • The flip side of mission creep Wednesday, March 4, 2009
    117. 117. Dependency Soup • The flip side of mission creep • Focus, focus, focus! Wednesday, March 4, 2009
    118. 118. Dependency Soup • The flip side of mission creep • Focus, focus, focus! • Make the dependencies optional Wednesday, March 4, 2009
    119. 119. Dependency Soup • The flip side of mission creep • Focus, focus, focus! • Make the dependencies optional • Pray for a package manager Wednesday, March 4, 2009
    120. 120. Oh, the Recappery! Wednesday, March 4, 2009
    121. 121. Oh, the Recappery! • Cooperate Wednesday, March 4, 2009
    122. 122. Oh, the Recappery! • Cooperate • Don’t assume too much Wednesday, March 4, 2009
    123. 123. Oh, the Recappery! • Cooperate • Don’t assume too much • Don’t be pushy Wednesday, March 4, 2009
    124. 124. Oh, the Recappery! • Cooperate • Don’t assume too much • Don’t be pushy • Simplify or step aside Wednesday, March 4, 2009
    125. 125. Oh, the Recappery! • Cooperate • Don’t assume too much • Don’t be pushy • Simplify or step aside • Test your extensions Wednesday, March 4, 2009
    126. 126. Oh, the Recappery! • Cooperate • Don’t assume too much • Don’t be pushy • Simplify or step aside • Test your extensions • Stay focused Wednesday, March 4, 2009
    127. 127. http://www.flickr.com/photos/-sel-/60124578/ Wednesday, March 4, 2009
    128. 128. What? That’s it? http://www.flickr.com/photos/-sel-/60124578/ Wednesday, March 4, 2009
    129. 129. Thanks, flickr! • • http://www.flickr.com/photos/mikereys http://www.flickr.com/photos/jayd • • http://www.flickr.com/photos/splorp http://www.flickr.com/photos/djou • • http://www.flickr.com/photos/ http://www.flickr.com/photos/-sel- noahwesley • http://www.flickr.com/photos/ • http://www.flickr.com/photos/tonyjcase diamondduste • • http://www.flickr.com/photos/ejpphoto http://www.flickr.com/photos/jphilipson Wednesday, March 4, 2009
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×