plug-in architectures

19
Plug-in Architectures Presented by Truc Nguyen

Upload: derry

Post on 24-Feb-2016

27 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Plug-in Architectures

Plug-in ArchitecturesPresented by Truc Nguyen

Page 2: Plug-in Architectures

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

Page 3: Plug-in Architectures

What’s a plug-in?• Component architectures• Semantics– Plug-ins– Extensions– Add-ons

Page 4: Plug-in Architectures

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

Page 5: Plug-in Architectures

Why do have plug-ins?• Extensible• Modular• Customizable• Keep It Small and Simple!

Page 6: Plug-in Architectures

Traditional vs Pure

Page 7: Plug-in Architectures

Traditional Plug-in• Extend capabilities of base

application• Not compiled into the application

Page 8: Plug-in Architectures

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

Page 9: Plug-in Architectures

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

Page 10: Plug-in Architectures

Plug-in Design Patterns• Best practice solutions to solve a

design problem• How to support dynamic loading of

modules unknown during compilation

Page 11: Plug-in Architectures

Plug-in Pattern

Page 12: Plug-in Architectures

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

Page 13: Plug-in Architectures

Eclipse

Page 14: Plug-in Architectures

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

Page 15: Plug-in Architectures

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

Page 16: Plug-in Architectures

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)

Page 17: Plug-in Architectures

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

Page 18: Plug-in Architectures

Challenges• Installing and updating– Configuration plugin

• Security• Concurrent plug-in version– Eclipse convention: Only plug-ins that

contribute code libraries can coexist• Scalability

Page 19: Plug-in Architectures

Questions?