Why do developers need Code-Snippets


Many of you may already have noticed that we started a Snippet collection for JFace-Elements like the one you know from SWT. Yesterday I updated the wiki-page to show all snippets with a short description.

Are Snippets only something we provide because we love our users soooo much? To me the answer is no.

There are multiple reasons why snippets are a great thing:

  • Help for users to get started easily (Users)
  • Useful templates for users to log bugs (Users/Developers)
    Without a reproduceable testcase it is very hard to track bugs. Be prepared that JFace-Devs will insist even more on Snippets because now you have starting points to create Snippets easily. Insisting on snippets we often found out that we are not the one to blame but someone different (including the bugreporter itself)
  • Useful to mark bugs as invalid (Developers)
  • Useful to check no regressions are introduced (Developers)
    We also added snippets to our collection although their Classes are deprecated because this way we had an easy test case that we don’t break any backwards contract. In our case we did this for TableTreeViewer
  • Development example for new features (Developers)
    A good example is Snippet026 which was used to develop Cell-Navigation and Editor-Activation throughout the whole 3.3 cycle.
  • Advertise new API
Advertisement
This entry was posted in 3.x. Bookmark the permalink.

3 Responses to Why do developers need Code-Snippets

  1. Ilya Shinkarenko says:

    Thank you Tom for the post. JFace snippets collection seems to be very interesting is definitely useful for Eclipse newcomers.

  2. tmseidel says:

    Hi Tom. Small node:
    The german flag in http://wiki.eclipse.org/index.php/JFaceSnippets#Snippet010OwnerDraw is not correct 😉

  3. Chris says:

    Thanks Tom!
    All you’ve said about snippets are so true… In addition snippets are a good way during development to filter out bad new API. If the snippet feels ugly, the new API is probably just not ‘right’ yet.
    Now how can we encourage other components to expose snippets too? With your work maybe we can now close
    bug 176610

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.