Handle your dependencies

Handle your dependencies

Benefits

Description

Nobody wants to be too dependent on others, and in an ideal world your application should have as few dependencies as is reasonably possible. That’s not to say that you should ship every possible dependency in your shrink-wrapped product, just be intelligent about what you really depend on.

Sometimes handling dependencies is as easy as abstracting features from feature requirements. For example, an image manipulation program with scanner support should be able to install and run fine, even if there isn’t a scanner installed. Your application would simply disable those features that depend on the scanner.

Of course this approach doesn’t work for everything. Dependencies on specific libraries, like ODBC are a little harder to handle. A database client application isn’t very useful if it can’t connect to the server, but there could be many different reasons you can’t connect (LAN down, server down, ODBC problem, security, configured incorrectly). While each of these issues has different root causes, the bottom line is that the user can’t do their work. In all of these cases the application should start successfully, and “fail gracefully” by reporting the error and disabling the affected features. Just exiting might be an option, but if there’s anything the user can do to fix the problem inside the application, leave it running. They know how to exit!

Add-ons are more obviously dependent. If the application (or architecture) they extend isn’t present, they aren’t useful, even if successfully installed. In these circumstances you might want to warn the user the application isn’t present, but allow them to continue anyway. Even though the application isn’t there, someone else might be able to use you; it’s also possible that the user just decided to install you first!

Here are the three basic different kinds of dependencies in terms of how it affects install, and suggestions for handling them:

See Also

Support Just-In-Time installation