Introduction to API Design: REST and Java

2,042 views

Published on

An introduction to application programming interfaces.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,042
On SlideShare
0
From Embeds
0
Number of Embeds
83
Actions
Shares
0
Downloads
37
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to API Design: REST and Java

  1. 1. Introduction to API Design: REST and Java Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii
  2. 2. What is an API? <ul><li>Specifies a boundary between 2 systems </li></ul><ul><ul><li>What you can do </li></ul></ul><ul><ul><li>What you can't do </li></ul></ul><ul><li>The boundary is defined by: </li></ul><ul><ul><li>Functions you can invoke </li></ul></ul><ul><ul><li>Objects passed & returned </li></ul></ul><ul><li>APIs can exist: </li></ul><ul><ul><li>Within a single program </li></ul></ul><ul><ul><li>Between independent programs </li></ul></ul>
  3. 3. Advantages of APIs <ul><li>Simplifies design by creating partitions </li></ul><ul><li>Enables change without &quot;ripple effect&quot; </li></ul><ul><li>Enables multiple implementations </li></ul><ul><li>Enables development to scale </li></ul><ul><ul><li>Larger development teams </li></ul></ul><ul><ul><li>Concurrent development </li></ul></ul>
  4. 4. Disadvantages of APIs <ul><li>Increases implementation complexity </li></ul><ul><li>Creates boundaries that can make certain changes hard to accomplish </li></ul><ul><li>Can impede performance optimization </li></ul>
  5. 5. Kinds of APIs <ul><li>Within a program </li></ul><ul><ul><li>Separates components. </li></ul></ul><ul><ul><li>Creates &quot;public&quot; and &quot;private&quot; areas. </li></ul></ul><ul><li>Between programs </li></ul><ul><ul><li>Specifies a &quot;protocol&quot; </li></ul></ul><ul><ul><li>How to send and receive information. </li></ul></ul>
  6. 6. Example in-Program API: Java Collections Framework <ul><li>Interface java.util.Collection </li></ul><ul><ul><li>boolean add (Object o) </li></ul></ul><ul><ul><li>void clear() </li></ul></ul><ul><ul><li>boolean equals(Object o) </li></ul></ul><ul><ul><li>boolean isEmpty() </li></ul></ul><ul><li>This API is implemented by: </li></ul><ul><ul><li>HashSet, LinkedList, TreeSet, etc. </li></ul></ul>
  7. 8. Example between-program (REST)API: Twitter <ul><li>The Twitter API is a RESTful protocol: </li></ul><ul><li>http://api.twitter.com/ version /statuses/public_timeline. format </li></ul><ul><ul><li>Operations: GET </li></ul></ul><ul><ul><li>Formats: json, xml, rss, atom </li></ul></ul><ul><ul><li>Authentication: none </li></ul></ul><ul><ul><li>Parameters: trim_user, include_entities </li></ul></ul>
  8. 10. Example between-program (REST)API: WattDepot
  9. 11. The Solar Decathlon iHale System
  10. 12. The Solar Decathlon iHale System <ul><li>Within-program between-program </li></ul>
  11. 13. On to the demo

×