11/19/08

The Trouble with Plugins

One of the things that excites me most about developing apps is the enormous potential of plugins to extend an application. Xcode and NSBundle make it quite easy to implement too.


Unfortunately, loading external code can be quite risky, and, from what I've seen, there appears to be no built-in solution to help with this. Sure, you could be very careful about what objects you give the plugin access to, and it can't send your objects a method you don't publicly declare in the framework or header files that you make publicly available. However, there are plenty of classes in the Apple frameworks that any object, externally loaded or not, can get a shared instance of. Once it has one of these singleton instances, malicious code could possibly gain access to your data model and controllers through the accessors methods for the object's delegate. Even if it never gained access to your custom objects, it could still wreak havoc with an instance of, say, NSApplication or NSWorkspace. In addition, poorly designed, non-malicious plugins have freedom to do undesirable things like loading new windows and views without the host application's consent.


This is something I'd love to see Apple do something about. They could introduce a class called something like NSRuntime perhaps. This class could let objects ask for a notification to be posted whenever an externally loaded object sends a particular message or calls the method of a specified object. Additionally, the loaded objects could be forced to only communicate with a specified list of objects and or classes.


Of course, there are other solutions like letting other developers only create plugins with a special application (something in the vein of the iSync Plug-in Maker app) or by using a scripting language. However, I'd love to see Apple produce an elegant, cocoa solution to this (or maybe even a language feature of objective-c 3.0).

11/18/08

It's Alive!

After a long period of stagnation, I've decided to revive this blog. Now that I finally have an idea of what I'm going to do with my life, I believe I actually have something useful to write about. Please disregard my previous posts (unless you liked them of course).


 From now on this blog will be mostly focused on my adventures becoming a cocoa programmer among other things. I don't profess any experience in cocoa; I'm the very definition of a beginner. In fact, I've only just started learning programming this past summer, but I think I've learned quite a bit since then. The excellent book Programming in Objective-C by Stephen Kochan was a big help in this, and I highly recommend it.


My ultimate dream is to become an indie mac developer and run my own software development house. From this side of my life it seems like an insurmountable goal, but, with God's help and the constructive criticism I hope you'll give me, it just might work.


I hope you'll enjoy reading my musings, however few and far between they may be.