1
PDE Good Practices
Ankur SharmaPDE co-lead@ankur_sharma blog.ankursharma.org
2 of 23
#1 Separation of Concerns
• A plug-in is used to group your code into a modular, extendable and sharable unit.
• Do not create monolithic plug-ins
• Separate the platform/locale code into fragments
• Separate Core, UI, Doc, etc
3 of 23
#2 bundle-localization
• Externalize bundle strings
• ‘Usage of non-externalized strings’ preference
4 of 23
5 of 23
6 of 23
7 of 23
8 of 23
#3 Lazy-loading
• Prefer to have lazy loading plug-ins– Helps reduce memory footprint– Every plug-in loads with a dependency
baggage– Judiciously make plug-ins reusable
9 of 23
#3 Singletons
• Prefer singleton plug-ins– but there is a cost involved– singleton plug-ins can not be dynamically
installed
10 of 23
11 of 23
12 of 23
#4 Use startup code carefully
• Plug-in startup and constructor
• org.eclipse.ui.startup extension
13 of 23
#5 Prefer target over workspace
• Prefer adding the required plug-ins to Target Platform
• Adding them to workspace makes it difficult to track and manage.
14 of 23
#6 Share target definitions
15 of 23
#7 Keep build.properties synced
• Export wizard and headless build uses build.properties
• Use build preferences to keep it in sync with classpath
• This helps avoid “…but it was working in my workspace!” situations.
16 of 23
17 of 23
#8 EE and Java compliance
• Set the Execution Environments to the lowest required JRE version.
• Set the appropriate Java Compiler preferences
18 of 23
#9 Use proper version ranges
• Use proper version restrictions
• Also helps in catching API leaks
19 of 23
#10 Versions are not for marketing
• Version numbering is very important
• Version numbers are not meant for marketing
• Stick to major.minor.micro-qualifier
• Bump up the correct number in version on releases.
20 of 23
#11 Define API carefully
• Put classes in correct packages
• Public, internal and x-friends
• Don’t Re-export everything
An Eclipse API is forever
21 of 23
#12 Use API Tools
• API Tools will help you with– #9 Use proper version ranges– #10 Versions are not for marketing– #11 Define API carefully
22
thank you