Tuesday, January 29, 2013

Iterator is a design pattern

Iterators are used so frequently that they have become implicit in modern programming environments, with foreach loops replacing explicit getIterator() and next() calls in typical designs.  It is therefore somewhat strange to think of iterator as a design pattern - it is so simple, common and abstracted that one hardly thinks about iterators as anything other than an implementation detail.

This got me to thinking about the nature of programming, as our tools and environments continue to evolve.  I was looking at a problem recently of adding logging to a number of functions in a C# application and my mind immediately jumped to implementing the feature using a decorator, as I would if tasked with the same problem in Python.  Django development has pushed the decorator pattern into the same category of common and trivial code as iterators in my mind, and yet decorators remain a far less standard programming construct across other languages and frameworks.  This is not to say C# doesn't exhibit a similar relationship with other design patterns - WPF databinding has likely antiquated thinking about the observer pattern for many front end developers.  Today, we stand on the shoulders of giants when starting any new application and simply need to choose the best fitting option.

As languages and frameworks continue to evolve, I look forward to seeing how this process continues.  Perhaps worrying about making an application RESTful will one day seem as trivial as iterators.  Wouldn't that be spiffy?

Wednesday, January 2, 2013

My contribution to the excessively obscure

Eclipse is an amazing program and a triumph of the open source community.  I genuinely think very, very highly of it.  That said, I have to admit that I sometimes suspect they have a slightly sinister marketing plan, where every so often the plugins destroy themselves or one another, just so the end user will look through their plugin list and appreciate all they've done with Eclipse over the years.

In my case, my plugin list contains a veritable who's who list of add ons - Google's Android plugins, Amazon's plugins for AWS, CDT for C++ development, J2EE, both CVS and Git integration, my beloved PyDev plugin and a handful of others.  Somewhere along the way, something didn't play well with something else, and I lost several editors.  Following the generally safe advice from "some guy on stackoverflow" I ran eclipse -clean, which mostly just broke things in a new way.

Reading through forums and mailing lists, most roads lead to advice to just wipe everything and start from a clean install.  Fortunately, with a bit of tinkering, I managed to restore my Eclipse to working order, and that's the cause for today's post.

Every so often, I google for an absurdly specific problem and just as I'm about to give up hope, miraculously find someone, somewhere has documented the exact same issue.  Every Linux user has had this experience at some point I'm sure.  In the off chance someone ends up here, this was my excessively obscure problem and solution:

On Eclipse 3.7.2, running under Ubuntu 12.04, with Eclipse Java Web Developer Tools 3.3.2 installed, installing the Web Page Editor 2.3.6 appeared to have no effect.  It showed as installed, but the editor did not appear in any menus.  Attempts to uninstall and reinstall, run eclipse -clean and check for plugin updates were no help.  Uninstalling both plugins and reinstalling only Web Page Editor solved the problem.  A fairly simple fix to try before going the full reinstall route if anyone ever finds their system in the same state.