Growable-is-better implementation techniques

From Worse Is Better

Jump to: navigation, search

Like worse-is-better, growable-is-better is not a constructive design philosophy. It suggests a particular set of goals that ought to be achieved while designing software rather than a set of technologies or design process that would accomplish those aims. That said, certain technologies seem to be more useful for building programs with the growable-is-better design in mind. This page details some of the programming technologies used to make programs that can grow in the wild.

Components in Mozilla Firefox

The Mozilla Firefox web browser, as mentioned in in the page on growable-is-better, is an excellent example of growable-is-better, both because it is open-source and because it has rich support for extensions.

One of the reasons that Firefox is so extensible is that its core architecture is based on XPCOM, a component system by which software written in multiple different languages can easily interface with one another. The components are centrally registered by name, much in the way that files are structured in a file system. Different pieces of the browser can load and use components simply by referring to them by name, allowing components to be swapped in and out without recompiling the entire browser.

A key piece of this framework is XPIDL, the XPCOM Interface Definition Language, a framework for specifying an interface in a language-agnostic format. Once the interface has been specified in XPIDL, it can be compiled into an interface specification in a variety of languages, including C, C++, JavaScript, Python, and Perl. Developers who then implement against this interface in a language of their choice can then have code written in any other language with support for XPIDL use their component directly.

Although XPIDL and XPCOM introduce some additional programming complexity, they make Firefox and the other Mozilla products inherently growable. Any major piece of the software can be accessed and manipulated by JavaScript extensions or by new developers interested in extending the codebase.

Facebook: Ensuring Security

Facebook applications greatly expand the scope of what is possible on Facebook. However, as Facebook is written in Javascript, applications also written in JavaScript might be able to destructively interfere with Facebook's internal JavaScript code, breaching security and allowing app authors to take control of the Facebook account.

To prevent this from occurring, Facebook developed a utility, FBJS, to transform raw JavaScript code from app authors into safe JavaScript. This ensures that untrusted JavaScript code cannot "escape" from the application it runs in and cause damage to other applications or the page itself. Developing FBJS must not have been an easy task (JavaScript is a complex language with many subtle edge cases), but it was crucial to giving Facebook application developers the flexibility to build interesting applications.

When designing an application with growable-is-better in mind, it is important to consider the security model. If privacy is a concern or the program will interact with sensitive data, it is important to design the extensible components of the system in a way that restricts what potential extensions can do.

Valgrind: Sharing Powerful Systems

Valgrind is an open-source dynamic analysis tool that can be used to detect runtime errors. The tool works by simulating the execution of the program, allowing Valgrind to introspect on its execution. Most commonly, Valgrind is used to detect memory errors like memory leaks, buffer overruns, and double-frees.

However, Valgrind was designed in order to support a wide array of tools and offers clients the ability to write their own analyses. The current version of Valgrind initially supports ten different tools. However, the tool was clearly intended to be extended by its users. One of the tools provided with Valgrind, "Lackey," does little other than demonstrate what sorts of analyses can be run and how the various features ought to be used. As a result, many researchers have used Valgrind as a platform for developing advanced research tools; some of these papers can be found here.

An important detail about Valgrind is that the tool could have been released simply to monitor memory leaks, hiding its powerful CPU simulation from clients. However, by granting others access to this complex software system, the tool's utility was increased manifold. When designing software that performs a useful tasks by harnessing a more powerful solution, exposing that solution to others can greatly expand the utility of that software and can help ensure its longevity and future growth.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox