go! go! gadgets. writing an opensocial application

108
Go Go Gadgets! Building an OpenSocial Application 1 Mark Halvorson Community Member, OpenSocial Foundation Board Chief Imagineer, Atlassian Software Email: [email protected] Twitter: @halv0112 Monday, December 6, 2010

Upload: mark-halvorson

Post on 17-May-2015

2.334 views

Category:

Technology


1 download

DESCRIPTION

This presentation delivered at the OpenSocial Europe Summit and Industry Spotlight on Education Event. Talks about writing OpenSocial Gadgets from Hello World to something a little more useful.

TRANSCRIPT

Page 1: Go! Go! Gadgets.  Writing an OpenSocial Application

Go Go Gadgets!Building an OpenSocial Application

1

Mark HalvorsonCommunity Member, OpenSocial Foundation BoardChief Imagineer, Atlassian Software

Email: [email protected]: @halv0112

Monday, December 6, 2010

Page 2: Go! Go! Gadgets.  Writing an OpenSocial Application

What is an ‘Imagineer’?Monday, December 6, 2010

Page 3: Go! Go! Gadgets.  Writing an OpenSocial Application

Take things that exist...

!" #"

Monday, December 6, 2010

Page 4: Go! Go! Gadgets.  Writing an OpenSocial Application

...and make something different.

Monday, December 6, 2010

Page 5: Go! Go! Gadgets.  Writing an OpenSocial Application

Monday, December 6, 2010

Page 6: Go! Go! Gadgets.  Writing an OpenSocial Application

Agenda

•What it is a Gadget•Why Atlassian chose OpenSocial•Application Portability

•Why you should too!•Application Sharing

6Monday, December 6, 2010

Page 7: Go! Go! Gadgets.  Writing an OpenSocial Application

What is OpenSocial?

7Monday, December 6, 2010

Page 8: Go! Go! Gadgets.  Writing an OpenSocial Application

Social Data Model

8Monday, December 6, 2010

Page 9: Go! Go! Gadgets.  Writing an OpenSocial Application

Web Service APIs

9Monday, December 6, 2010

Page 10: Go! Go! Gadgets.  Writing an OpenSocial Application

Gadgets

10Monday, December 6, 2010

Page 11: Go! Go! Gadgets.  Writing an OpenSocial Application

Our Problem

11Monday, December 6, 2010

Page 12: Go! Go! Gadgets.  Writing an OpenSocial Application

Before

FishEyeSourceCode

JIRAIssues&Tasks

ConfluenceWiki

12

•Enterprise Apps are Silos

Monday, December 6, 2010

Page 13: Go! Go! Gadgets.  Writing an OpenSocial Application

13

Emphasize Teams, Projects & Tasks over Tools

Monday, December 6, 2010

Page 14: Go! Go! Gadgets.  Writing an OpenSocial Application

13

Emphasize Teams, Projects & Tasks over Tools

Monday, December 6, 2010

Page 15: Go! Go! Gadgets.  Writing an OpenSocial Application

13

Emphasize Teams, Projects & Tasks over Tools

Monday, December 6, 2010

Page 16: Go! Go! Gadgets.  Writing an OpenSocial Application

13

Emphasize Teams, Projects & Tasks over Tools

Monday, December 6, 2010

Page 17: Go! Go! Gadgets.  Writing an OpenSocial Application

Too Many Dashboards

14Monday, December 6, 2010

Page 18: Go! Go! Gadgets.  Writing an OpenSocial Application

Too Many Dashboards

14Monday, December 6, 2010

Page 19: Go! Go! Gadgets.  Writing an OpenSocial Application

Cross-Product Sharing

15Monday, December 6, 2010

Page 20: Go! Go! Gadgets.  Writing an OpenSocial Application

Integration with Non-Atlassian apps

16Monday, December 6, 2010

Page 21: Go! Go! Gadgets.  Writing an OpenSocial Application

Solution: OpenSocial Gadgets

17Monday, December 6, 2010

Page 22: Go! Go! Gadgets.  Writing an OpenSocial Application

Gadgets

18

are a Great Solution for Dashboard

Monday, December 6, 2010

Page 23: Go! Go! Gadgets.  Writing an OpenSocial Application

Open standard for enterprise application connection

After

19

viewcompleteproject

singleacCvity

Monday, December 6, 2010

Page 24: Go! Go! Gadgets.  Writing an OpenSocial Application

Not just about portals,or internal applications.

Managers Do Email

viewacCvity&status

createissues

20Monday, December 6, 2010

Page 25: Go! Go! Gadgets.  Writing an OpenSocial Application

Open Standards, Industry Support

21Monday, December 6, 2010

Page 26: Go! Go! Gadgets.  Writing an OpenSocial Application

Why Write Gadgets?

•They’re easy!

•They use stable, widely accessible and understood technologies

•Write once, display everywhere

22Monday, December 6, 2010

Page 27: Go! Go! Gadgets.  Writing an OpenSocial Application

The Obligatory Hello World Example

23Monday, December 6, 2010

Page 28: Go! Go! Gadgets.  Writing an OpenSocial Application

The Obligatory Hello World Example

23Monday, December 6, 2010

Page 29: Go! Go! Gadgets.  Writing an OpenSocial Application

Anatomy of a Gadget

24Monday, December 6, 2010

Page 30: Go! Go! Gadgets.  Writing an OpenSocial Application

Anatomy of a Gadget

•XML Spec File•Metadata, HTML Content, and JavaScript

24Monday, December 6, 2010

Page 31: Go! Go! Gadgets.  Writing an OpenSocial Application

Anatomy of a Gadget

•XML Spec File•Metadata, HTML Content, and JavaScript

•Core JavaScript API•Access Preferences, Make Requests

24Monday, December 6, 2010

Page 32: Go! Go! Gadgets.  Writing an OpenSocial Application

Anatomy of a Gadget

•XML Spec File•Metadata, HTML Content, and JavaScript

•Core JavaScript API•Access Preferences, Make Requests

•Gadget Features•Additional, Optional Capabilities & APIs

24Monday, December 6, 2010

Page 33: Go! Go! Gadgets.  Writing an OpenSocial Application

XML Spec File

25Monday, December 6, 2010

Page 34: Go! Go! Gadgets.  Writing an OpenSocial Application

<ModulePrefs>

26Monday, December 6, 2010

Page 35: Go! Go! Gadgets.  Writing an OpenSocial Application

<ModulePrefs>

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail="http://labs.atlassian.com/svn/GADGETS/trunk/jira-issues/basic/jira-issues-thumbnail.png" description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

26Monday, December 6, 2010

Page 36: Go! Go! Gadgets.  Writing an OpenSocial Application

<ModulePrefs>

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail="http://labs.atlassian.com/svn/GADGETS/trunk/jira-issues/basic/jira-issues-thumbnail.png" description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

26Monday, December 6, 2010

Page 37: Go! Go! Gadgets.  Writing an OpenSocial Application

<ModulePrefs>

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail="http://labs.atlassian.com/svn/GADGETS/trunk/jira-issues/basic/jira-issues-thumbnail.png" description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

26Monday, December 6, 2010

Page 38: Go! Go! Gadgets.  Writing an OpenSocial Application

<UserPref>

<UserPref name="show_date" display_name="Show Dates?" datatype="bool" default_value="true"/> <UserPref name="show_summ" display_name="Show Summaries?" datatype="bool" default_value="true"/> <UserPref name="num_entries" display_name="Number of Entries:" default_value="5" required="true"/>

27Monday, December 6, 2010

Page 39: Go! Go! Gadgets.  Writing an OpenSocial Application

<UserPref>

<UserPref name="show_date" display_name="Show Dates?" datatype="bool" default_value="true"/> <UserPref name="show_summ" display_name="Show Summaries?" datatype="bool" default_value="true"/> <UserPref name="num_entries" display_name="Number of Entries:" default_value="5" required="true"/>

27Monday, December 6, 2010

Page 40: Go! Go! Gadgets.  Writing an OpenSocial Application

<UserPref>

<UserPref name="show_date" display_name="Show Dates?" datatype="bool" default_value="true"/> <UserPref name="show_summ" display_name="Show Summaries?" datatype="bool" default_value="true"/> <UserPref name="num_entries" display_name="Number of Entries:" default_value="5" required="true"/>

27Monday, December 6, 2010

Page 43: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - DEFAULT view

29Monday, December 6, 2010

Page 44: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - DEFAULT view

29Monday, December 6, 2010

Page 45: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - DEFAULT view

30Monday, December 6, 2010

Page 46: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - DEFAULT view

30Monday, December 6, 2010

Page 47: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - CANVAS view

31Monday, December 6, 2010

Page 48: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - CANVAS view

31Monday, December 6, 2010

Page 49: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - DEFAULT view (in Gmail)

32Monday, December 6, 2010

Page 50: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - DEFAULT view (in Gmail)

32Monday, December 6, 2010

Page 51: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - CANVAS view (in Gmail)

33Monday, December 6, 2010

Page 52: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - CANVAS view (in Gmail)

33Monday, December 6, 2010

Page 53: Go! Go! Gadgets.  Writing an OpenSocial Application

Views - Custom view

34Monday, December 6, 2010

Page 54: Go! Go! Gadgets.  Writing an OpenSocial Application

Wallboards

Gadgets go beyond theJIRA Dashboardonto your wall!

35Monday, December 6, 2010

Page 55: Go! Go! Gadgets.  Writing an OpenSocial Application

Wallboards

Gadgets go beyond theJIRA Dashboardonto your wall!

35Monday, December 6, 2010

Page 56: Go! Go! Gadgets.  Writing an OpenSocial Application

JavaScript

// Create minimessage factoryvar msg = new gadgets.MiniMessage();// Show a small loading message to the uservar loadMessage = msg.createStaticMessage("loading...");

// Get configured user prefsvar prefs = new gadgets.Prefs();var showDate = prefs.getBool("show_date");var showSummary = prefs.getBool("show_summ");var numEntries = prefs.getInt("num_entries");

// Fetch issues when the gadget loadsgadgets.util.registerOnLoadHandler(fetchIssues);

36Monday, December 6, 2010

Page 57: Go! Go! Gadgets.  Writing an OpenSocial Application

JavaScript

// Create minimessage factoryvar msg = new gadgets.MiniMessage();// Show a small loading message to the uservar loadMessage = msg.createStaticMessage("loading...");

// Get configured user prefsvar prefs = new gadgets.Prefs();var showDate = prefs.getBool("show_date");var showSummary = prefs.getBool("show_summ");var numEntries = prefs.getInt("num_entries");

// Fetch issues when the gadget loadsgadgets.util.registerOnLoadHandler(fetchIssues);

36Monday, December 6, 2010

Page 58: Go! Go! Gadgets.  Writing an OpenSocial Application

JavaScript

// Create minimessage factoryvar msg = new gadgets.MiniMessage();// Show a small loading message to the uservar loadMessage = msg.createStaticMessage("loading...");

// Get configured user prefsvar prefs = new gadgets.Prefs();var showDate = prefs.getBool("show_date");var showSummary = prefs.getBool("show_summ");var numEntries = prefs.getInt("num_entries");

// Fetch issues when the gadget loadsgadgets.util.registerOnLoadHandler(fetchIssues);

36Monday, December 6, 2010

Page 59: Go! Go! Gadgets.  Writing an OpenSocial Application

Requesting Data from Web Services

•AJAX + DOM

•OAuth

•Request Proxy

37Monday, December 6, 2010

Page 60: Go! Go! Gadgets.  Writing an OpenSocial Application

38Monday, December 6, 2010

Page 61: Go! Go! Gadgets.  Writing an OpenSocial Application

39Monday, December 6, 2010

Page 62: Go! Go! Gadgets.  Writing an OpenSocial Application

40Monday, December 6, 2010

Page 63: Go! Go! Gadgets.  Writing an OpenSocial Application

41Monday, December 6, 2010

Page 64: Go! Go! Gadgets.  Writing an OpenSocial Application

gadgets.io.makeRequest()

42Monday, December 6, 2010

Page 65: Go! Go! Gadgets.  Writing an OpenSocial Application

What Can You Call?

•Any URL

•XML and JSON are the most useful•

43Monday, December 6, 2010

Page 66: Go! Go! Gadgets.  Writing an OpenSocial Application

Fetching Issues

function fetchIssues() { var url = "http://jira.atlassian.com/sr/" + "jira.issueviews:searchrequest-xml" + "/temp/SearchRequest.xml?" + "created%3Aprevious=-1w&resolution=-1" + "&sorter/field=issuekey&sorter/order=DESC" + "&sorter/field=created&sorter/order=DESC" + "&tempMax=20";

var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM;

gadgets.io.makeRequest(url, handleResponse, params);}

44Monday, December 6, 2010

Page 67: Go! Go! Gadgets.  Writing an OpenSocial Application

Handling the Response

function handleResponse(obj) { var domData = obj.data;

var jiraIssues = { title : getTitle(domData), items : getItems(domData) }; renderJiraIssues(jiraIssues);

msg.dismissMessage(loadMessage); gadgets.window.adjustHeight();}

45Monday, December 6, 2010

Page 68: Go! Go! Gadgets.  Writing an OpenSocial Application

Handling the Response

function handleResponse(obj) { var domData = obj.data;

var jiraIssues = { title : getTitle(domData), items : getItems(domData) }; renderJiraIssues(jiraIssues);

msg.dismissMessage(loadMessage); gadgets.window.adjustHeight();}

45Monday, December 6, 2010

Page 69: Go! Go! Gadgets.  Writing an OpenSocial Application

TextText

An ExampleReal World Example...Monday, December 6, 2010

Page 70: Go! Go! Gadgets.  Writing an OpenSocial Application

TextText

An ExampleReal World Example...Monday, December 6, 2010

Page 71: Go! Go! Gadgets.  Writing an OpenSocial Application

TextText

An ExampleReal World Example...Monday, December 6, 2010

Page 72: Go! Go! Gadgets.  Writing an OpenSocial Application

TextText

An ExampleReal World Example...Monday, December 6, 2010

Page 73: Go! Go! Gadgets.  Writing an OpenSocial Application

TextText

An ExampleReal World Example...Monday, December 6, 2010

Page 74: Go! Go! Gadgets.  Writing an OpenSocial Application

TextText

An ExampleReal World Example...Monday, December 6, 2010

Page 75: Go! Go! Gadgets.  Writing an OpenSocial Application

The Goal

The Goal47

Monday, December 6, 2010

Page 76: Go! Go! Gadgets.  Writing an OpenSocial Application

48The Result

Monday, December 6, 2010

Page 77: Go! Go! Gadgets.  Writing an OpenSocial Application

48The Result

Monday, December 6, 2010

Page 78: Go! Go! Gadgets.  Writing an OpenSocial Application

49Preferences

Monday, December 6, 2010

Page 79: Go! Go! Gadgets.  Writing an OpenSocial Application

Statistics

50Monday, December 6, 2010

Page 80: Go! Go! Gadgets.  Writing an OpenSocial Application

Let’s Take a Step Back.

51Monday, December 6, 2010

Page 81: Go! Go! Gadgets.  Writing an OpenSocial Application

Q: What is the purpose of an application?

52Monday, December 6, 2010

Page 82: Go! Go! Gadgets.  Writing an OpenSocial Application

Q: What is the purpose of an application?

•A: DO Something. Complete some process.

52Monday, December 6, 2010

Page 83: Go! Go! Gadgets.  Writing an OpenSocial Application

Anatomy of an Application

Context Content Ac(on

53Monday, December 6, 2010

Page 84: Go! Go! Gadgets.  Writing an OpenSocial Application

An ExampleGmail

Communica(on

ContactsMail

ReadWriteReply

54Monday, December 6, 2010

Page 85: Go! Go! Gadgets.  Writing an OpenSocial Application

Q: What is the purpose of a gadget?

55Monday, December 6, 2010

Page 86: Go! Go! Gadgets.  Writing an OpenSocial Application

Q: What is the purpose of a gadget?

•A: DO Something. Complete some process.

55Monday, December 6, 2010

Page 87: Go! Go! Gadgets.  Writing an OpenSocial Application

Gadget = ReusableMini‐ApplicaCon

Context

Content

Ac(on

AtomicUnitofWork

Ac(on

Context

Content

•or

56Monday, December 6, 2010

Page 88: Go! Go! Gadgets.  Writing an OpenSocial Application

Example - “Mini-Application”

JIRACommentGadget

JIRA‐1234

AddComment

UsersComment

57Monday, December 6, 2010

Page 89: Go! Go! Gadgets.  Writing an OpenSocial Application

JIRACommentGadget

Context

UsersComment

AddComment

58

Example - Unit of Work

Monday, December 6, 2010

Page 90: Go! Go! Gadgets.  Writing an OpenSocial Application

JIRACommentGadget

Context

UsersComment

AddComment

58

Example - Unit of Work

Monday, December 6, 2010

Page 91: Go! Go! Gadgets.  Writing an OpenSocial Application

Lesson Learned over time:

•Gadgets as “Units of Work” are...

• Easier to build

• Easier to use

• Easier to reuse

59Monday, December 6, 2010

Page 92: Go! Go! Gadgets.  Writing an OpenSocial Application

Composite Application

Gadget

Ac(on

Context

Content

Gadget

Ac(on

Context

Content

Context

Gadget

Ac(on

Add’lContext

ContentContent

Ac(on

60Monday, December 6, 2010

Page 93: Go! Go! Gadgets.  Writing an OpenSocial Application

Example - Gmail

GoogleCommunicaConApplicaCon

Gmail

Communica(on

ContactsMail

ReadWriteReply

GoogleTalk

IM

ReadWriteReply

Presence

61Monday, December 6, 2010

Page 94: Go! Go! Gadgets.  Writing an OpenSocial Application

<demo>

62Monday, December 6, 2010

Page 95: Go! Go! Gadgets.  Writing an OpenSocial Application

Get Satisfaction

63Monday, December 6, 2010

Page 96: Go! Go! Gadgets.  Writing an OpenSocial Application

Gadgets?

64

Monday, December 6, 2010

Page 97: Go! Go! Gadgets.  Writing an OpenSocial Application

Gadgets?

Gadget? Gadget?

64

Monday, December 6, 2010

Page 98: Go! Go! Gadgets.  Writing an OpenSocial Application

65Monday, December 6, 2010

Page 99: Go! Go! Gadgets.  Writing an OpenSocial Application

65

Gadget

Gadget!

Gadget

Monday, December 6, 2010

Page 100: Go! Go! Gadgets.  Writing an OpenSocial Application

Get Satisfactionpowered by JIRA

66Monday, December 6, 2010

Page 101: Go! Go! Gadgets.  Writing an OpenSocial Application

Gadgets!

67Monday, December 6, 2010

Page 102: Go! Go! Gadgets.  Writing an OpenSocial Application

Gadgets!

67Monday, December 6, 2010

Page 103: Go! Go! Gadgets.  Writing an OpenSocial Application

Gadgets!

67Gadget!

Gadget!

Monday, December 6, 2010

Page 104: Go! Go! Gadgets.  Writing an OpenSocial Application

68Monday, December 6, 2010

Page 105: Go! Go! Gadgets.  Writing an OpenSocial Application

68Monday, December 6, 2010

Page 106: Go! Go! Gadgets.  Writing an OpenSocial Application

</demo>

69Monday, December 6, 2010

Page 107: Go! Go! Gadgets.  Writing an OpenSocial Application

Summary - Why write gadgets?

•Easy!• Simple web based technologies mean anyone can write a gadget.

•Reusable!•Use in any OpenSocial Container. iGoogle, Gmail, JIVE, more every day.

•Fun!• Thinking about applications as atomic units of work add a new dimension to

application design.

70Monday, December 6, 2010