SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Best Practices in Widget Development
Examples and Counterexamples


Daniel Dahrendorf (IMC)

ROLE Developer Camp,
Lausanne, Switzerland
August 23, 2010



                               © www.role-project.eu
Dr Stephen Dann from flickr.com   jbvkoos from flickr.com




23.08.2010                                       © www.role-project.eu
DESIGN AND USABILITY



23.08.2010                   © www.role-project.eu
In General

• Focus on a single task
     – Give your end user a single functionality
• Own added Value
     – Do not create a Widget which requires a second widget
• Self explanatory interface
     – There should be no need for help text or support




23.08.2010                                                     © www.role-project.eu
Size of Widgets

• Use a standard height
• The widget should scale between 250px and 500px
     – Use a width of 100% for the main elements of the widget
     – Center elements
• Use views
     – Canvas, home and profile views




23.08.2010                                                   © www.role-project.eu
Customization

• Let the user customize the widget
     – Color
     – Background
     – Content
• Provide always default or sample values
  and include a “welcome mode”
• Use the user preferences feature
  of Google Gadgets




23.08.2010                                  © www.role-project.eu
Use Space effectively

• Avoid scrollbars
• Use tabs
• Use paging




23.08.2010              © www.role-project.eu
User Account

• Content should be interesting even the user is not logged in
• State the benefits of creating an account
• Use OAuth if possible




23.08.2010                                          © www.role-project.eu
DEVELOPMENT



23.08.2010          © www.role-project.eu
Development Environment

• Own Apache Shindig Server
     – A web application which can be run e.g.
       in a Apache Tomcat


• OSDE
     – Eclipse plugin with built in Apache
       Shindig server


• Google Gadget Editor
     – A Google gadget which provides an editor
       and the possibility to save the widgets at
       iGoogle




23.08.2010                                          © www.role-project.eu
Development Environment

• Own Apache Shindig Server
     – A web application which can be run e.g.
       in a Apache Tomcat


     – Comfortable way to create complex
       interacting widgets




23.08.2010                                       © www.role-project.eu
Using the features provided by the gadget API

• The Gadget and OpenSocial API provides a lot of useful
  features:
     – fetch social data
     – provide UI element
     – Get data from external sources




• Only available for type=“html’’ widgets


23.08.2010                                       © www.role-project.eu
Selected Features:

• Tabs
     – Creates customizable tabs


• Setprefs
     – Allows setting of user preferences


• Pubsub (OpenSocial 0.8 only)
     – Inter-widget-communication
     – Use OpenApp instead
       (http://code.google.com/p/open-app/)


• Internationalization
     – Provides a mechanism to
       translate widgets



23.08.2010                                    © www.role-project.eu
makeRequest and the Same Origin Policy

• The gadget API provides a function to fetch
  HTML/XML/JSON content (OpenSocial 0.8):

    gadgets.io.makeRequest(url, callback, opt_params)




• As widgets run in iFrames this proxy approach allows to
  fetch data from other domains (same origin policy)
• Other approaches to solve cross domain problems are:
     – JSONP (retrieving JSON via Script Tags)
     – PMRPC (http://code.google.com/p/pmrpc/)


23.08.2010                                              © www.role-project.eu
Caching Problems




• If you are using makeRequest() to fetch content that is
  updated more than once an hour, such as feed data, you
  might not get the latest updates




23.08.2010                                       © www.role-project.eu
Refreshing the Content Cache

• Solution: create a wrapper with a refresh interval

 function makeCachedRequest(url, callback, params,
    refreshInterval) {

      var timestamp = new Date().getTime();
      var sep = "?";
      if (refreshInterval && refreshInterval > 0) {
         timestamp =
            Math.floor(timestamp / (refreshInterval * 1000));
      }
      if (url.indexOf("?") > -1) {
         sep = "&";
      }
      url = [ url, sep, "nocache=", timestamp ].join("");
      gadgets.io.makeRequest(url, callback, params);
 }


23.08.2010                                             © www.role-project.eu
Caching of external files

• Container caches:
     – JavaScript added with <script>
     – CSS added with <link>
     – Content got using the gadget API
• Further because of the widget infrastructure only absolute
  links are allowed




• External files are needed if the widget becomes more
  complex

23.08.2010                                          © www.role-project.eu
Loading JavaScript / CSS dynamically
                                                         http://www.bitsbythepound.com/include-
1. Determine the location of the xml                     external-javascript-and-css-files-with-a-
                                                         google-wave-gadget-249.html
function getModuleBase() {
    if (window.__moduleBase)
        return window.__moduleBase;
    if (_args){
        var moduleBase = _args()['url'];
        moduleBase = moduleBase.substring(0, moduleBase.lastIndexOf('/') + 1);
        window.__moduleBase = moduleBase;
        return window.__moduleBase;
    }
    alert('Can not find module base. Gadget may not work properly.');
    return '';
};

2. Create mechanism for loading JS and CSS
      jQuery provides a cross-browser require script plugin (requireScript)
3. Load the js/css in gadget init
function init() {
   var useCaching = false;
   addScript("js/default.js",useCaching);
   addStylesheet("css/style.css",useCaching);
};
gadgets.util.registerOnLoadHandler(init);

23.08.2010                                                            © www.role-project.eu
Performance

• Goal: Reduce size of the files and number of HTTP requests

• Minify JavaScript code
     – E.g. http://www.crockford.com/javascript/jsmin.html
• Pack all stuff in one XML file
     – Suggestion of Google
• Use the containers’ cache
     – gadgets.io.getProxyUrl
• More sources for optimization:
     – http://code.google.com/intl/de-DE/apis/gadgets/docs/publish.html
     – http://wiki.opensocial.org/index.php?title=OpenSocial_Latency_Meas
       urement

             Maintainability VS. Performance?
23.08.2010                                                   © www.role-project.eu
Performance Testing and debugging

• Use e.g. the Firebug extension of Firefox for debugging and
  measuring the performance




23.08.2010                                         © www.role-project.eu
Conclusions

• Guidelines are helping to provide a user friendly interface
• Customizations allows users to personalize their widgets
• An own Apache Shindig server can be used to develop
  interacting widgets
• Using the Gadget API prevents to “reinvent the wheel”
• Caching and cross domain problems can be handled with
  several methods
• A widget can be optimized regarding its performance
• Tools are available for debugging and performance
  measuring




23.08.2010                                           © www.role-project.eu
ROLE ALLIANCE PROGRAM


                  What is the Alliance Program?
       A partner network of strategic users, vendors and other
                             stakeholder

                Why should I become a member?
       As a member you have a lot of benefits e.g., access to our
         showcase platform, free visit of specific workshops, test
         of prototypes or attendance at Alliance Partner meetings

        How can I become part of the Alliance Program?
                        Please register under
              http://www.roleproject.eu/AllianceProgram


23.08.2010                                             © www.role-project.eu
References

• http://www.google.com/webmasters/gadgets/guidelines.html
• http://www.seoish.com/how-to-internationalize-google-
  gadgets/
• Lal, R. and Chava, L. C. 2010 Developing Web Widget with
  Html, Css, JSON and Ajax: a Complete Guide to Web
  Widget. CreateSpace.
• http://www.bitsbythepound.com/include-external-javascript-
  and-css-files-with-a-google-wave-gadget-249.html
• http://code.google.com/intl/de/apis/gadgets/docs/remote-
  content.html




23.08.2010                                        © www.role-project.eu

Contenu connexe

Tendances

MozTW Jetpack Workshop: Taichung
MozTW Jetpack Workshop: TaichungMozTW Jetpack Workshop: Taichung
MozTW Jetpack Workshop: Taichung
littlebtc
 
Write a Google Closure Editor Plugin
Write a Google Closure Editor PluginWrite a Google Closure Editor Plugin
Write a Google Closure Editor Plugin
yinhm .
 
Jetpack SDK: The new possibility of the extensions on browser
Jetpack SDK: The new possibility of the extensions on browserJetpack SDK: The new possibility of the extensions on browser
Jetpack SDK: The new possibility of the extensions on browser
littlebtc
 
MozTW Jetpack Workshop: Taipei
MozTW Jetpack Workshop: TaipeiMozTW Jetpack Workshop: Taipei
MozTW Jetpack Workshop: Taipei
littlebtc
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
Nuxeo
 

Tendances (11)

MozTW Jetpack Workshop: Taichung
MozTW Jetpack Workshop: TaichungMozTW Jetpack Workshop: Taichung
MozTW Jetpack Workshop: Taichung
 
Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)
 
Write a Google Closure Editor Plugin
Write a Google Closure Editor PluginWrite a Google Closure Editor Plugin
Write a Google Closure Editor Plugin
 
Jetpack SDK: The new possibility of the extensions on browser
Jetpack SDK: The new possibility of the extensions on browserJetpack SDK: The new possibility of the extensions on browser
Jetpack SDK: The new possibility of the extensions on browser
 
MozTW Jetpack Workshop: Taipei
MozTW Jetpack Workshop: TaipeiMozTW Jetpack Workshop: Taipei
MozTW Jetpack Workshop: Taipei
 
Web Components the best marriage for a PWA
Web Components the best marriage for a PWAWeb Components the best marriage for a PWA
Web Components the best marriage for a PWA
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
 
Building a Secure App with Google Polymer and Java / Spring
Building a Secure App with Google Polymer and Java / SpringBuilding a Secure App with Google Polymer and Java / Spring
Building a Secure App with Google Polymer and Java / Spring
 
Drupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.xDrupal in 5mins + Previewing Drupal 8.x
Drupal in 5mins + Previewing Drupal 8.x
 
The Heron Mapping Client
The Heron Mapping ClientThe Heron Mapping Client
The Heron Mapping Client
 
Drupal case study: Behind the scenes of website of University of Tartu
Drupal case study: Behind the scenes of website of University of TartuDrupal case study: Behind the scenes of website of University of Tartu
Drupal case study: Behind the scenes of website of University of Tartu
 

Similaire à Best Practices in Widget Development - Examples and Counterexamples

Contributions: what they are and how to find them
Contributions: what they are and how to find themContributions: what they are and how to find them
Contributions: what they are and how to find them
Pedro Cambra
 
Open social gadgets in ibm connections
Open social gadgets in ibm connectionsOpen social gadgets in ibm connections
Open social gadgets in ibm connections
Vincent Burckhardt
 

Similaire à Best Practices in Widget Development - Examples and Counterexamples (20)

jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
uMobile Development Strategies
uMobile Development StrategiesuMobile Development Strategies
uMobile Development Strategies
 
Contributions: what they are and how to find them
Contributions: what they are and how to find themContributions: what they are and how to find them
Contributions: what they are and how to find them
 
Html5 Future of WEB
Html5 Future of WEBHtml5 Future of WEB
Html5 Future of WEB
 
JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!
 
Vincent Burckhardt - Exending Connections with OpenSocial Gadgets
Vincent Burckhardt - Exending Connections with OpenSocial GadgetsVincent Burckhardt - Exending Connections with OpenSocial Gadgets
Vincent Burckhardt - Exending Connections with OpenSocial Gadgets
 
Open social gadgets in ibm connections
Open social gadgets in ibm connectionsOpen social gadgets in ibm connections
Open social gadgets in ibm connections
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
 
Vuejs and Web components - current state
Vuejs and Web components - current stateVuejs and Web components - current state
Vuejs and Web components - current state
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
April 2012 uPortal Community Call
April 2012 uPortal Community CallApril 2012 uPortal Community Call
April 2012 uPortal Community Call
 
Custom Activities in UiPath (Activity Builder)
Custom Activities in UiPath (Activity Builder)Custom Activities in UiPath (Activity Builder)
Custom Activities in UiPath (Activity Builder)
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
JIO and WebViewers: interoperability for Javascript and Web Applications
JIO and WebViewers: interoperability  for Javascript and Web ApplicationsJIO and WebViewers: interoperability  for Javascript and Web Applications
JIO and WebViewers: interoperability for Javascript and Web Applications
 
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
TulsaTechFest - Maximize SharePoint UX with free jQuery librariesTulsaTechFest - Maximize SharePoint UX with free jQuery libraries
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
 
Writing an extensible web testing framework ready for the cloud slide share
Writing an extensible web testing framework ready for the cloud   slide shareWriting an extensible web testing framework ready for the cloud   slide share
Writing an extensible web testing framework ready for the cloud slide share
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
Let's build Developer Portal with Backstage
Let's build Developer Portal with BackstageLet's build Developer Portal with Backstage
Let's build Developer Portal with Backstage
 
Developing Apps for SharePoint 2013
Developing Apps for SharePoint 2013Developing Apps for SharePoint 2013
Developing Apps for SharePoint 2013
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
 

Plus de ROLE Project

Self-regulated learning in a PLMS
Self-regulated learning in a PLMSSelf-regulated learning in a PLMS
Self-regulated learning in a PLMS
ROLE Project
 
Context-specific ROLE visions: Formal higher education, Life Long Learning, ....
Context-specific ROLE visions: Formal higher education, Life Long Learning, ....Context-specific ROLE visions: Formal higher education, Life Long Learning, ....
Context-specific ROLE visions: Formal higher education, Life Long Learning, ....
ROLE Project
 
Connecting the ROLE tools
Connecting the ROLE toolsConnecting the ROLE tools
Connecting the ROLE tools
ROLE Project
 
A Single Sign-on mechanism for Widgets
A Single Sign-on mechanism for WidgetsA Single Sign-on mechanism for Widgets
A Single Sign-on mechanism for Widgets
ROLE Project
 
Psycho pedagogical approach
Psycho pedagogical approachPsycho pedagogical approach
Psycho pedagogical approach
ROLE Project
 

Plus de ROLE Project (14)

Build your Responsive Open Learning Environment (Part II)
Build your Responsive Open Learning Environment (Part II)Build your Responsive Open Learning Environment (Part II)
Build your Responsive Open Learning Environment (Part II)
 
Build your Responsive Open Learning Environment (Part I)
Build your Responsive Open Learning Environment (Part I)Build your Responsive Open Learning Environment (Part I)
Build your Responsive Open Learning Environment (Part I)
 
Sharing Personal Learning Environments for Widget Based Systems using a Widge...
Sharing Personal Learning Environments for Widget Based Systems using a Widge...Sharing Personal Learning Environments for Widget Based Systems using a Widge...
Sharing Personal Learning Environments for Widget Based Systems using a Widge...
 
Towards self-regulated workplace learning
Towards self-regulated workplace learningTowards self-regulated workplace learning
Towards self-regulated workplace learning
 
Personal Learning Management Systems: Concept, Classification, Evaluation
Personal Learning Management Systems: Concept, Classification, EvaluationPersonal Learning Management Systems: Concept, Classification, Evaluation
Personal Learning Management Systems: Concept, Classification, Evaluation
 
Finding and using web widgets for self-regulated learning
Finding and using web widgets for self-regulated learningFinding and using web widgets for self-regulated learning
Finding and using web widgets for self-regulated learning
 
Self-regulated learning in a PLMS
Self-regulated learning in a PLMSSelf-regulated learning in a PLMS
Self-regulated learning in a PLMS
 
Context-specific ROLE visions: Formal higher education, Life Long Learning, ....
Context-specific ROLE visions: Formal higher education, Life Long Learning, ....Context-specific ROLE visions: Formal higher education, Life Long Learning, ....
Context-specific ROLE visions: Formal higher education, Life Long Learning, ....
 
English Learning Scenario
English Learning ScenarioEnglish Learning Scenario
English Learning Scenario
 
ROLE Project Status Meeting (January 2011)
ROLE Project Status Meeting (January 2011)ROLE Project Status Meeting (January 2011)
ROLE Project Status Meeting (January 2011)
 
From widgets to competencies
From widgets to competenciesFrom widgets to competencies
From widgets to competencies
 
Connecting the ROLE tools
Connecting the ROLE toolsConnecting the ROLE tools
Connecting the ROLE tools
 
A Single Sign-on mechanism for Widgets
A Single Sign-on mechanism for WidgetsA Single Sign-on mechanism for Widgets
A Single Sign-on mechanism for Widgets
 
Psycho pedagogical approach
Psycho pedagogical approachPsycho pedagogical approach
Psycho pedagogical approach
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Best Practices in Widget Development - Examples and Counterexamples

  • 1. Best Practices in Widget Development Examples and Counterexamples Daniel Dahrendorf (IMC) ROLE Developer Camp, Lausanne, Switzerland August 23, 2010 © www.role-project.eu
  • 2. Dr Stephen Dann from flickr.com jbvkoos from flickr.com 23.08.2010 © www.role-project.eu
  • 3. DESIGN AND USABILITY 23.08.2010 © www.role-project.eu
  • 4. In General • Focus on a single task – Give your end user a single functionality • Own added Value – Do not create a Widget which requires a second widget • Self explanatory interface – There should be no need for help text or support 23.08.2010 © www.role-project.eu
  • 5. Size of Widgets • Use a standard height • The widget should scale between 250px and 500px – Use a width of 100% for the main elements of the widget – Center elements • Use views – Canvas, home and profile views 23.08.2010 © www.role-project.eu
  • 6. Customization • Let the user customize the widget – Color – Background – Content • Provide always default or sample values and include a “welcome mode” • Use the user preferences feature of Google Gadgets 23.08.2010 © www.role-project.eu
  • 7. Use Space effectively • Avoid scrollbars • Use tabs • Use paging 23.08.2010 © www.role-project.eu
  • 8. User Account • Content should be interesting even the user is not logged in • State the benefits of creating an account • Use OAuth if possible 23.08.2010 © www.role-project.eu
  • 9. DEVELOPMENT 23.08.2010 © www.role-project.eu
  • 10. Development Environment • Own Apache Shindig Server – A web application which can be run e.g. in a Apache Tomcat • OSDE – Eclipse plugin with built in Apache Shindig server • Google Gadget Editor – A Google gadget which provides an editor and the possibility to save the widgets at iGoogle 23.08.2010 © www.role-project.eu
  • 11. Development Environment • Own Apache Shindig Server – A web application which can be run e.g. in a Apache Tomcat – Comfortable way to create complex interacting widgets 23.08.2010 © www.role-project.eu
  • 12. Using the features provided by the gadget API • The Gadget and OpenSocial API provides a lot of useful features: – fetch social data – provide UI element – Get data from external sources • Only available for type=“html’’ widgets 23.08.2010 © www.role-project.eu
  • 13. Selected Features: • Tabs – Creates customizable tabs • Setprefs – Allows setting of user preferences • Pubsub (OpenSocial 0.8 only) – Inter-widget-communication – Use OpenApp instead (http://code.google.com/p/open-app/) • Internationalization – Provides a mechanism to translate widgets 23.08.2010 © www.role-project.eu
  • 14. makeRequest and the Same Origin Policy • The gadget API provides a function to fetch HTML/XML/JSON content (OpenSocial 0.8): gadgets.io.makeRequest(url, callback, opt_params) • As widgets run in iFrames this proxy approach allows to fetch data from other domains (same origin policy) • Other approaches to solve cross domain problems are: – JSONP (retrieving JSON via Script Tags) – PMRPC (http://code.google.com/p/pmrpc/) 23.08.2010 © www.role-project.eu
  • 15. Caching Problems • If you are using makeRequest() to fetch content that is updated more than once an hour, such as feed data, you might not get the latest updates 23.08.2010 © www.role-project.eu
  • 16. Refreshing the Content Cache • Solution: create a wrapper with a refresh interval function makeCachedRequest(url, callback, params, refreshInterval) { var timestamp = new Date().getTime(); var sep = "?"; if (refreshInterval && refreshInterval > 0) { timestamp = Math.floor(timestamp / (refreshInterval * 1000)); } if (url.indexOf("?") > -1) { sep = "&"; } url = [ url, sep, "nocache=", timestamp ].join(""); gadgets.io.makeRequest(url, callback, params); } 23.08.2010 © www.role-project.eu
  • 17. Caching of external files • Container caches: – JavaScript added with <script> – CSS added with <link> – Content got using the gadget API • Further because of the widget infrastructure only absolute links are allowed • External files are needed if the widget becomes more complex 23.08.2010 © www.role-project.eu
  • 18. Loading JavaScript / CSS dynamically http://www.bitsbythepound.com/include- 1. Determine the location of the xml external-javascript-and-css-files-with-a- google-wave-gadget-249.html function getModuleBase() { if (window.__moduleBase) return window.__moduleBase; if (_args){ var moduleBase = _args()['url']; moduleBase = moduleBase.substring(0, moduleBase.lastIndexOf('/') + 1); window.__moduleBase = moduleBase; return window.__moduleBase; } alert('Can not find module base. Gadget may not work properly.'); return ''; }; 2. Create mechanism for loading JS and CSS jQuery provides a cross-browser require script plugin (requireScript) 3. Load the js/css in gadget init function init() { var useCaching = false; addScript("js/default.js",useCaching); addStylesheet("css/style.css",useCaching); }; gadgets.util.registerOnLoadHandler(init); 23.08.2010 © www.role-project.eu
  • 19. Performance • Goal: Reduce size of the files and number of HTTP requests • Minify JavaScript code – E.g. http://www.crockford.com/javascript/jsmin.html • Pack all stuff in one XML file – Suggestion of Google • Use the containers’ cache – gadgets.io.getProxyUrl • More sources for optimization: – http://code.google.com/intl/de-DE/apis/gadgets/docs/publish.html – http://wiki.opensocial.org/index.php?title=OpenSocial_Latency_Meas urement Maintainability VS. Performance? 23.08.2010 © www.role-project.eu
  • 20. Performance Testing and debugging • Use e.g. the Firebug extension of Firefox for debugging and measuring the performance 23.08.2010 © www.role-project.eu
  • 21. Conclusions • Guidelines are helping to provide a user friendly interface • Customizations allows users to personalize their widgets • An own Apache Shindig server can be used to develop interacting widgets • Using the Gadget API prevents to “reinvent the wheel” • Caching and cross domain problems can be handled with several methods • A widget can be optimized regarding its performance • Tools are available for debugging and performance measuring 23.08.2010 © www.role-project.eu
  • 22. ROLE ALLIANCE PROGRAM What is the Alliance Program? A partner network of strategic users, vendors and other stakeholder Why should I become a member? As a member you have a lot of benefits e.g., access to our showcase platform, free visit of specific workshops, test of prototypes or attendance at Alliance Partner meetings How can I become part of the Alliance Program? Please register under http://www.roleproject.eu/AllianceProgram 23.08.2010 © www.role-project.eu
  • 23. References • http://www.google.com/webmasters/gadgets/guidelines.html • http://www.seoish.com/how-to-internationalize-google- gadgets/ • Lal, R. and Chava, L. C. 2010 Developing Web Widget with Html, Css, JSON and Ajax: a Complete Guide to Web Widget. CreateSpace. • http://www.bitsbythepound.com/include-external-javascript- and-css-files-with-a-google-wave-gadget-249.html • http://code.google.com/intl/de/apis/gadgets/docs/remote- content.html 23.08.2010 © www.role-project.eu