Top Banner
1) Introduction to API Design: REST and Java Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii
13

Introduction to API Design: REST and Java

Dec 06, 2014

Download

Technology

Philip Johnson

An introduction to application programming interfaces.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to API Design: REST and Java

(1)

Introduction to API Design:REST and Java

Philip Johnson

Collaborative Software Development Laboratory

Information and Computer Sciences

University of Hawaii

Page 2: Introduction to API Design: REST and Java

(2)

What is an API?

Specifies a boundary between 2 systems•What you can do•What you can't do

The boundary is defined by:•Functions you can invoke•Objects passed & returned

APIs can exist:•Within a single program•Between independent programs

Page 3: Introduction to API Design: REST and Java

(3)

Advantages of APIs

Simplifies design by creating partitions Enables change without "ripple effect" Enables multiple implementations Enables development to scale•Larger development teams•Concurrent development

Page 4: Introduction to API Design: REST and Java

(4)

Disadvantages of APIs

Increases implementation complexity Creates boundaries that can make certain changes hard to accomplish

Can impede performance optimization

Page 5: Introduction to API Design: REST and Java

(5)

Kinds of APIs

Within a program•Separates components.•Creates "public" and "private" areas.

Between programs•Specifies a "protocol"•How to send and receive information.

Page 6: Introduction to API Design: REST and Java

(6)

Example in-Program API: Java Collections Framework

Interface java.util.Collection•boolean add (Object o)•void clear()•boolean equals(Object o)•boolean isEmpty()

This API is implemented by:•HashSet, LinkedList, TreeSet, etc.

Page 7: Introduction to API Design: REST and Java

(7)

Page 8: Introduction to API Design: REST and Java

(8)

Example between-program (REST)API: Twitter

The Twitter API is a RESTful protocol:

http://api.twitter.com/version/statuses/public_timeline.format•Operations: GET•Formats: json, xml, rss, atom•Authentication: none•Parameters: trim_user, include_entities

Page 9: Introduction to API Design: REST and Java

(9)

Page 10: Introduction to API Design: REST and Java

(10)

Example between-program (REST)API: WattDepot

Page 11: Introduction to API Design: REST and Java

(11)

The Solar Decathlon iHale System

Page 12: Introduction to API Design: REST and Java

(12)

The Solar Decathlon iHale System

Within-program between-program

Page 13: Introduction to API Design: REST and Java

(13)

On to the demo