plug-in architectures presented by truc nguyen. what’s a plug-in? “a type of program that...
TRANSCRIPT
Plug-in Architectures
Presented by Truc Nguyen
What’s a plug-in?
“a type of program that tightly integrates with a larger application to add a special capability to it”
- CNET“a set of software components that adds specific abilities to a larger software application”
- Wikipedia
What’s a plug-in?
• Component architectures• Semantics– Plug-ins– Extensions– Add-ons
Plug-ins
• Not hard-coded into host app– Unknown at compile time
• Not a standalone application• One step further: compose an entire
application out of plugins
Why do have plug-ins?
• Extensible• Modular• Customizable• Keep It Small and Simple!
Traditional vs Pure
Traditional Plug-in
• Extend capabilities of base application
• Not compiled into the application
Pure Plug-in
• Everything is a plug-in• Plug-ins extend other plug-ins• Where does that leave the base
application?– A run-time engine for plug-ins– Plug-ins become hosts to other plug-ins
by providing extension points
• How do plug-ins play nicely with each other?– Abide by the framework’s or each
other’s rules
Pure Plug-in Engine
• Keeping track of where the right plug-in code is and running it
• Maintain a registry of plug-ins and functions that go with each
• Manage extension model and dependencies between plug-ins
Plug-in Design Patterns
• Best practice solutions to solve a design problem
• How to support dynamic loading of modules unknown during compilation
Plug-in Pattern
Eclipse
• Well known as a Java IDE• Pure plug-in architecture– Runtime engine itself is a bunch of core
plug-ins except for tiny bootstrap code
• Universal plug-in architecture for creating “anything, but nothing in particular”
• Each plug-in has a manifest
Eclipse
Gecko (NPAPI)
• Netscape Plugin Application Programming Interface
• Plug-in is completely controlled by web page that calls it
• On start, Gecko looks for plug-in modules in a specified locations on the system
• On a page with certain embedded media, checks for plug-in with matching MIME type creates new instance and runs it
Photoshop
• Central Plug-in loader– Scans PiPL (Plug-in Property List)
• Fixed types– filter, import, export, file format,
automation– selection and parser (not implemented
by 3rd party)
• Non-Photoshop applications can support Photoshop plug-ins
Chrome
• Scripting API vs Browser API• Extensions can modify the DOM• Can have access to the history,
current tabs, bookmarks, etc• Composed of files, can be packaged
as .crx–manifest.json– HTML files– JavaScript– Other resources (e.g CSS, images)
Chrome
• Background pages– Persistent or event
• Content scripts are JS that executes in the context of the page just loaded– Can change the DOM on the current
page– Can’t change the DOM on the
background page of parent extension
• Callbacks execute on a user action
Challenges
• Installing and updating– Configuration plugin
• Security• Concurrent plug-in version– Eclipse convention: Only plug-ins that
contribute code libraries can coexist
• Scalability
Questions?