The whiteboard pattern is a pretty well-known "best practice" in the OSGi community. For this reason, I was somewhat surprised to hear from a co-worker (echoed by a couple folks at EclipseCon) that not everyone considers this pattern a blessing. Unfortunately, I have never seen this argument laid out in writing before, so I thought I would give it a shot in this blog entry--apologies if I do it no justice.
The whiteboard pattern is basically a modification on the standard listener pattern in which the content publisher looks up its consumers in the service registry instead of the consumers hooking themselves into the publisher. For a deeper understanding, there is lots of good info available including this whitepaper. This pattern purportedly works much better (fewer lines of code, less prone to error, etc.) in the dynamic world of OSGi services...so why wouldn't everyone love that?
The answer (and I suspect this is an eye-of-the-beholder thing) is simplicity. Although the code presented in the whitepaper makes it pretty clear that using the basic framework to implement the traditional listener pattern can be quite burdensome, I am not convinced it must be this way. With the improvements in service frameworks like Declarative Services, it is becoming easier and cheaper to develop a system based around service interactions. So if the programming complexity becomes similar, in what way does the whiteboard pattern introduce additional complexity?
I can say from first-hand experience that the loosely-coupled nature of OSGi services can be a dual edged sword...powerful yes, but also difficult to follow. When you step into a large project with lots of service dependencies, it can be hard to untangle the interactions and see how the pieces fit together. This effort is made even more difficult in code which uses the whiteboard pattern. The registry becomes entangled with a bunch of listener objects, which have no clear indication of who should call them or what service they are providing to the system. Additionally, the developer is expected to know that they can hook into a particular producer by implementing some standard interface and publishing it to the registry. This type of hidden interaction model can be very tricky to find and needs to be well documented to be effective...or else it can start to feel a bit too 'magical'.
The beauty of the service registry is that it gives us a single place for safe, dynamic, loosely-coupled bundle interaction. So what we would really like to see in the registry is the "service" a particular bundle is offering to the other bundles in the system. On the one hand we have a pool of content consumers offering only a "listen" service, while on the other we have a content publisher who allows you to register your interest with its content. Now which of these bundles do you think more accurately fits the average developer's notion of "service"? I wonder why we don't see this type of "whiteboard" pattern in distributed SOA systems...
Tuesday, September 30, 2008
Friday, September 5, 2008
Keyboard Shortcuts - Others
In my previous post I covered my favorite Eclipse shortcuts fairly extensively. Here are some of my favorites in other programs:
Perhaps a bit less known is
I have begun to use this Alt + D shortcut in combination with the Quick Search feature in Firefox. This is a feature that allows you associate a keyword in the address bar with a particular type of search. Firefox comes preloaded with a number of useful ones, including "wp" for wikipedia (though my Linux version of Firefox 3 seems to be missing these for some reason). To try this out, simply navigate to the address bar and type "wp firefox". This should pull up a page with the results of the wikipedia search. You can even set your own Quick Searches (much like setting a bookmark). For more info on this nice little feature, check out http://lifehacker.com/software/geek-to-live/geek-to-live-fifteen-firefox-quick-searches-129658.php
Finally, there are the page search shortcuts (at least in Firefox).
Finally, some new-fangled, web 2.0, RIA, Ajax-enabled, Software-as-a-Service webpages provide their own shortcuts. The only ones I know of and use are the Google shortcuts (especially for Gmail and Reader). In particular, I find the use of j/k and n/p to navigate lists/items quite useful. For a useful reference list, be sure to type '?' while in one of these services.
On my work computers I use Windows XP and have gotten familiar with a number of the special windows shortcuts (many involving that silly little "windows" key between Ctrl and Alt on the keyboard). Of these shortcuts, perhaps my favorite is:
Well that is enough for now. I will have to write new posts or update these ones as I find particularly useful shortcuts which I have missed.
Browsers/Apps
Most folks know that Firefox, IE7, Chrome and some other tabbed interfaces provide the following shortcuts for working with tabs:- Ctrl + T => New Tab
- Ctrl + Tab => Next Tab
- Ctrl + W => Close Tab
Perhaps a bit less known is
- Alt + D => Goto the Address Bar
I have begun to use this Alt + D shortcut in combination with the Quick Search feature in Firefox. This is a feature that allows you associate a keyword in the address bar with a particular type of search. Firefox comes preloaded with a number of useful ones, including "wp" for wikipedia (though my Linux version of Firefox 3 seems to be missing these for some reason). To try this out, simply navigate to the address bar and type "wp firefox". This should pull up a page with the results of the wikipedia search. You can even set your own Quick Searches (much like setting a bookmark). For more info on this nice little feature, check out http://lifehacker.com/software/geek-to-live/geek-to-live-fifteen-firefox-quick-searches-129658.php
Finally, there are the page search shortcuts (at least in Firefox).
- / => Find As You Type Text
- ' => Find As You Type Link
Finally, some new-fangled, web 2.0, RIA, Ajax-enabled, Software-as-a-Service webpages provide their own shortcuts. The only ones I know of and use are the Google shortcuts (especially for Gmail and Reader). In particular, I find the use of j/k and n/p to navigate lists/items quite useful. For a useful reference list, be sure to type '?' while in one of these services.
Operating Systems
Operating systems usually provide some useful shortcuts for managing the desktop and the running applications.- Alt + Tab => Switch between applications
On my work computers I use Windows XP and have gotten familiar with a number of the special windows shortcuts (many involving that silly little "windows" key between Ctrl and Alt on the keyboard). Of these shortcuts, perhaps my favorite is:
- Winkey + D => Show Desktop (Toggle)
Well that is enough for now. I will have to write new posts or update these ones as I find particularly useful shortcuts which I have missed.
Friday, August 29, 2008
Keyboard Shortcuts - Eclipse
Whether you call them Keyboard Shortcuts, Key Bindings, Hotkeys, or what-have-you the Eclipse IDE contains a great number of useful keyboard shortcuts...from general navigation to coding/editing and running/debugging. In fact, beneath the surface lies an entirely extensible command and binding framework, which I have only briefly investigated.
One simple shortcut for displaying a list of these shortcuts is
Here is a list of some of the most useful Eclipse shortcuts I use:
Disclaimer: my shortcuts are very Java(JDT)/Plug-in(PDE) focused. Similar shortcuts are probably available in CDT or other packages, especially given the ongoing work to provide JDT-like functionality via projects such as the DLTK.
Common
There is something to be said for de facto shortcuts which work across all types of programs. Eclipse does a good job in this respect by implementing some shortcuts that are common to many programs. Such shortcuts include
One of the tasks which led to my constant use of the mouse in Eclipse was the simple navigation between views/perspectives/editors/etc. While each of these tasks has its own set of commands (Alt+Shift+Q was particularly useful for me to open/navigate to different views), I recently discovered the master of all shortcuts
Most people I know are familiar with some common navigation shortcuts such as
Eclipse provides some useful views for navigation, including the type hierarchy and outline views, but instead of letting these views clog your precious screen real-estate, you can use their quick command options instead:
Eclipse also provides some useful commands for use while programming. Perhaps the best know example would be the content assist (Ctrl+Space) feature. This binding will also rotate through a list of (customizable) templates/proposals if you press it more than once.
Another prevalent shortcut is the quick fix. This command seems to get better with each version of eclipse (especially for OSGi-related issues). I also use the lesser know quick assist command for assigning statements to fields (Ctrl+2, F) and local variables (Ctrl+2, L).
Eclipse is also chock full of refactoring/source assistance. Although each of these menus is available via shortcut (Alt+Shift+T and Alt+Shift+S), my favorite refactoring shortcuts are:
Run/Debug
Finally I would be remiss to list my favorite run/debug shortcuts, though I think these are fairly self-explanatory:
Conclusion
The combination of key bindings and filtering text boxes is awesomely powerful.
Learning to use Alt, Ctrl, and Shift on both sides of keyboard is vital (maybe its just me, but I previously used my left hand for all these keys...proving problematic for bindings like Alt+Shift+R).
In general, I am not a big fan of Fx (x=1-12) shortcuts as I find them awkward to type (though I do use them and have even listed a few).
Here is a slightly condensed list of the most useful bindings I've seen people miss:
*new in Ganymede
One simple shortcut for displaying a list of these shortcuts is
- Ctrl + Shift + L => Show Key Assist
Here is a list of some of the most useful Eclipse shortcuts I use:
Disclaimer: my shortcuts are very Java(JDT)/Plug-in(PDE) focused. Similar shortcuts are probably available in CDT or other packages, especially given the ongoing work to provide JDT-like functionality via projects such as the DLTK.
Common
There is something to be said for de facto shortcuts which work across all types of programs. Eclipse does a good job in this respect by implementing some shortcuts that are common to many programs. Such shortcuts include
- [update: I thought Ctrl+Tab was used to tab through the open editors, but I see now the default for this command is Ctrl+F6. Another command I would find useful is a next tab command for navigating the bottom tabs found in editors such as the Plug-in Manifest Editor.]
- Ctrl + W => Close Tab
- Ctrl + N => New (Other...)
One of the tasks which led to my constant use of the mouse in Eclipse was the simple navigation between views/perspectives/editors/etc. While each of these tasks has its own set of commands (Alt+Shift+Q was particularly useful for me to open/navigate to different views), I recently discovered the master of all shortcuts
- Ctrl + 3 => Quick Access
Most people I know are familiar with some common navigation shortcuts such as
- F3 => Open Declaration
- F2 => Open Tooltip
Eclipse provides some useful views for navigation, including the type hierarchy and outline views, but instead of letting these views clog your precious screen real-estate, you can use their quick command options instead:
- Ctrl + O => Quick Outline (x2 to toggle show/hide inherited members)
- Ctrl + T => Type Hierarchy (x2 to toggle between supertype/subtype hierarchies)
- Ctrl + H => Search
- Ctrl + G => Declarations in Workspace
- Ctrl + Shift + G => References in Workspace
- Ctrl + Alt + H => Call Hierarchy
- Ctrl + Shift + R => Open Resource
- Ctrl + Shift + T => open type
- Ctrl + Shift + A => open plug-in artifact*
Eclipse also provides some useful commands for use while programming. Perhaps the best know example would be the content assist (Ctrl+Space) feature. This binding will also rotate through a list of (customizable) templates/proposals if you press it more than once.
Another prevalent shortcut is the quick fix. This command seems to get better with each version of eclipse (especially for OSGi-related issues). I also use the lesser know quick assist command for assigning statements to fields (Ctrl+2, F) and local variables (Ctrl+2, L).
- Ctrl + 1 => Quick Fix
- Ctrl + 2 => Quick Assist (Assign To)
- Ctrl + Shift + F => format
Eclipse is also chock full of refactoring/source assistance. Although each of these menus is available via shortcut (Alt+Shift+T and Alt+Shift+S), my favorite refactoring shortcuts are:
- Alt + Shift + R => Rename
- Alt + Shift + Z => Surround With
- Alt + Shift + M => Extract Method
Run/Debug
Finally I would be remiss to list my favorite run/debug shortcuts, though I think these are fairly self-explanatory:
- F11 => Run
- Ctrl + F11 => Debug
- F5 => Step Into
- F6 => Step Over
- F7 => Step Return
- F8 => Resume
- Ctrl + R => Run to Line
- Ctrl + click => Step Into Method
- Ctrl + F2 => Terminate
Conclusion
The combination of key bindings and filtering text boxes is awesomely powerful.
Learning to use Alt, Ctrl, and Shift on both sides of keyboard is vital (maybe its just me, but I previously used my left hand for all these keys...proving problematic for bindings like Alt+Shift+R).
In general, I am not a big fan of Fx (x=1-12) shortcuts as I find them awkward to type (though I do use them and have even listed a few).
Here is a slightly condensed list of the most useful bindings I've seen people miss:
- Ctrl + Shift + L (x2) => Key Bindings Preferences
- Ctrl + 3 => Quick Access List
- Ctrl + O => Quick Outline (x2 to toggle show/hide inherited members)
- Ctrl + T => Type Hierarchy (x2 to toggle between supertype/subtype hierarchies)
- Ctrl + H => Search (File Search)
- Ctrl + G => Declarations in Workspace
- Ctrl + Shift + G => References in Workspace
- Ctrl + Alt + H => Call Hierarchy
- Ctrl + Shift + R => Open Resource
- Ctrl + Shift + T => Open Type
- Ctrl + Shift + F => Format
- Alt + Shift + F1 => Plug-in Spy
- Alt + Shift + R => Rename
- F11 => Run
- Ctrl + F11 => Debug
- Ctrl + R => Run to Line
*new in Ganymede
Subscribe to:
Posts (Atom)