IDEA Plugin Development

Subtitle: PicoContainers, Decoupling and other things I don’t know anything about.

Alright, in a really weird way this post is a perfect candidate for this ‘In a world gone mad’ blog. Here’s why..

Besides other, probably more important things, frameworks like PicoContainer try to make decoupling easier. Maybe a too simplistic description. But let’s focus on the resulting “APIs”..

You try to avoid too tight coupling. You rely on alternative mechanisms like for example singleton objects like “ApplicationManager” etc. You access the objects you need – when you need them – through the associated singleton classes.

Which probably is fine under certain circumstances. But does it really make things easier? It surely makes the ‘top level interfaces’ easier. Have a look at for example the “ApplicationComponent” interface provided by IDEAs OpenAPI:


public interface ApplicationComponent
{
    String getComponentName();
    void initComponent();
    void disposeComponent();
}

Easy enough. But what does it tell you?

Here’s what I mean: Why is there no “anchor” object part of method signatures? Why is it better to have to read the (quite extensive) documentation to find examples on how (and reasons why) to use for example the ApplicationManager class. Looking at a somewhat more sophisticated plugin like GroovyJ you are faced with all the beauty of this “system”.

Don’t get me wrong.. I don’t mean to sound too negative here. I think taking everything into account the JetBrains guys did a great job! And of course it’s quite a hard problem itself to figure out what this before mentioned “anchor” object would look like.

What I really mean to say is this: If a system gets complex (complicated?) enough to make you long for a “dependency injection thing”, wouldn’t it then be a good time to stop for a minute, and try to look at your problem from a different point of view? Maybe looking for alternative solutions? Shouldn’t there be an easier solution? A more expressive, maybe more “declarative” API possible? An API that guides you through the development?

OK. Sorry for this – not really! – rant. I don’t know too much about component containers, dependency injection, etc. And I only looked at IDEA plugin development for a few hours. And I haven’t worked on projects as big as IDEA must be.

It’s just that sometimes.. you know.. I feel lost.. uncomfortable.. you know.. In a world gone mad.. :)

tfdj

No comments yet. Be the first.

Leave a reply