mr. ankur sharma - pde good practices

22
1 PDE Good Practices Ankur Sharma PDE co-lead @ankur_sharma blog.ankursharma.org

Upload: beloslab

Post on 27-May-2015

667 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Mr. Ankur Sharma - PDE good practices

1

PDE Good Practices

Ankur SharmaPDE co-lead@ankur_sharma blog.ankursharma.org

Page 2: Mr. Ankur Sharma - PDE good practices

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

Page 3: Mr. Ankur Sharma - PDE good practices

3 of 23

#2 bundle-localization

• Externalize bundle strings

• ‘Usage of non-externalized strings’ preference

Page 4: Mr. Ankur Sharma - PDE good practices

4 of 23

Page 5: Mr. Ankur Sharma - PDE good practices

5 of 23

Page 6: Mr. Ankur Sharma - PDE good practices

6 of 23

Page 7: Mr. Ankur Sharma - PDE good practices

7 of 23

Page 8: Mr. Ankur Sharma - PDE good practices

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

Page 9: Mr. Ankur Sharma - PDE good practices

9 of 23

#3 Singletons

• Prefer singleton plug-ins– but there is a cost involved– singleton plug-ins can not be dynamically

installed

Page 10: Mr. Ankur Sharma - PDE good practices

10 of 23

Page 11: Mr. Ankur Sharma - PDE good practices

11 of 23

Page 12: Mr. Ankur Sharma - PDE good practices

12 of 23

#4 Use startup code carefully

• Plug-in startup and constructor

• org.eclipse.ui.startup extension

Page 13: Mr. Ankur Sharma - PDE good practices

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.

Page 14: Mr. Ankur Sharma - PDE good practices

14 of 23

#6 Share target definitions

Page 15: Mr. Ankur Sharma - PDE good practices

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.

Page 16: Mr. Ankur Sharma - PDE good practices

16 of 23

Page 17: Mr. Ankur Sharma - PDE good practices

17 of 23

#8 EE and Java compliance

• Set the Execution Environments to the lowest required JRE version.

• Set the appropriate Java Compiler preferences

Page 18: Mr. Ankur Sharma - PDE good practices

18 of 23

#9 Use proper version ranges

• Use proper version restrictions

• Also helps in catching API leaks

Page 19: Mr. Ankur Sharma - PDE good practices

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.

Page 20: Mr. Ankur Sharma - PDE good practices

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

Page 21: Mr. Ankur Sharma - PDE good practices

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

Page 22: Mr. Ankur Sharma - PDE good practices

22

thank you