Академический Документы
Профессиональный Документы
Культура Документы
Jeffrey Stylos
User Interface Software, Fall 2004
Introduction
Component architectures
What are components good for?
Being able to reuse standard components within your own applications Allowing applications to be architected and implemented more modularly Allowing applications to be extended (by plugins) after they are compiled and released
What is a plug-in?
For my purposes, a plug-in is a piece of software that extends or changes the behavior or interface of an existing, compiled application
How are the plug-ins created and installed? Are they compiled? How do plug-in authors debug their plug-ins? How you create an architecture that balance these different issues is an interesting research question
DISCLAIMER
This wasnt one of the existing topics
I picked it because I wanted to learn more, not because I was already an expert
Overview
Intro Emacs Mozilla Eclipse Skinnable apps
Emacs
Emacs
"Editor MACroS One of the first runtime extensible systems Designed for text editing
Used for everything
Emacs extensions
Extensions are written in elisp Can provide new functions or replace existing functionality Most extensions are macros that provide some sort of automation when explicitly invoked Can also do things like change text formatting
Can display images, but only in the context of lines of text Auto spell-checking (flyspell)
Can also manually load any lisp file, or even execute code as you write it
Emacs examples
[Show Tetris example]
Mozilla
Mozilla
Several different applications
Current code base provides
Mozilla 1.8 Netscape 7.2 Firefox 1.0 Thunderbird 1.0
XUL / JavaScript
User interface modification and scripting Also used for themes
[XPConnect]
Bridges XPCOM and Javascript
[XPInstall]
Installation and package management
XPCOM
Cross-Platform COM
A cross platform clone of COM Multi-threaded, but no remote support (not DCOM)
Used to create heavy-weight components that can be called by XUL and JavaScript elements Code can be cross platform, but has to be recompiled
XPCOM (continued)
Used to implement much of Mozillas core functionality
XPCOM (continued)
Uses the IDL (Interface Definition Language) to specify capabilities
IDL compiles to C++ Connects to JavaScript As with COM, XPCOM programming uses lots of interface pointers
Bad: void ProcessSample(nsSampleImpl* aSample) { aSample->Poke(hello); } Good: void ProcessSample(nsISample* aSample) { aSample->Poke(Hello); }
Using XPCOM
(Usually) needs Mozilla framework to compile
Can be difficult to compile
Needs the Mozilla framework to debug component Requires special tool to generate IDL specification Can use XPCOM for programming other than Mozilla plug-ins, but few do
XPCOM Examples
Using XPCOM:
var sound = Components.classes["@mozilla.org/sound;1"].createInstance(); if (sound) sound.QueryInterface(Components.interfaces.nsISound);
IDL:
[scriptable, uuid(1BDC2EE0-E92A-11d4-BCC0-0060089296CB)] interface mozIGPS : nsISupports { boolean Open(in string strDevice); boolean Close(); string Reason(in boolean bClear); readonly attribute double latitude; readonly attribute double longitude; readonly attribute double elevation; readonly attribute double gpstime; };
XPCOM resources
High level information
http://www.mozilla.org/projects/xpcom/ An Introduction to XPCOM
http://www-128.ibm.com/developerworks/webservices/library/coxpcom.html
I dont know of any good tutorial for creating and compiling an XPCOM extension
XUL
zool XML User-interface Language
Initial ambitions of also being a language for richer webpages (sort of works now) Cross platform Can be used to create stand alone applications (with difficulty)
XUL (continued)
Uses overlays to add new interface elements to existing interfaces
Easy to add a new button to an existing form
...
Themes
Uses the swap-ability of XUL elements to create plug-ins that change the appearance but not the functionality [Show theme examples]
Provides support for separating formatting decisions into CSS files Provides support for internationalization by separating text strings into language files Dont have to compile Hard to debug Cant write arbitrary C code Potentially slow
Break
Eclipse
Eclipse
A modern Emacs Designed to have a very small core that loads independent components Written in Java, primary selling point is its included Java developing components The Eclipse Platform is an IDE for anything, and for nothing in particular. Cross platform
Eclipse (continued)
Designed for building IDEs People used it for other apps
Remail, Haystack (new version)
Eclipse architecture
Eclipse plug-ins
All written in Java Found at Eclipse launch
Heavier-weight than Emacs model cant dynamically swap plug-ins or write and execute code
Manifests help encapsulate plug-ins from each other (they can only use each other in specified ways)
Again, helps multi-layered extensibility
Allows for portable plug-ins that use native widgets Usable outside of Eclipse
Opinionated claim: Best Java widget set
Eclipse resources
Many high level articles
Most on eclipse.org
Skinnable Apps
Skinnable Apps
Is this research related? Some history
Remember Winamp 1?
(Thats an mp3 player, by the way)
Not intentionally skinnable Someone figured out how to modify the bitmap resources in the compiled Winamp executable Became wildly popular, then supported
Winamp 2 skins
Winamp 3
More than just changing bitmaps Let skin authors specify size and location of buttons, and simple scripting (MAKI scripts) Used an XML-based language to define the location of UI elements, similar to resource editors
Winamp 3 skins
[Show Winamp]
Sonique
(Another mp3 player) Flash-like graphic capabilities in a skin [Show Sonique]
Conclusions
Different plug-in architectures support different type of extensibility Plug-in programming is very different from regular GUI programming Never get a cough before you have to give a presentation
Thanks!
Good luck on homework 5!