Sunday, March 6, 2005

Adobe Open Source

Sean Parent on Adobe’s Adam and Eve libraries (via Brent Fulgham):

Adam is a modeling engine and declarative language for describing constraints and relationships on a collection of value, typically the parameters to an application command. When bound to a human interface (HI) Adam provides the logic that controls the HI behavior. Adam is similar in concept to a spreadsheet or a forms manager. Values are set and dependent values are recalculated. Adam provides facilities to resolve interrelated dependencies and to track those dependencies, beyond what a spreadsheet provides.

Eve consists of a declarative language and layout engine for constructing an HI. The layout engine in Eve takes into account a rich description of UI elements to achieve a high quality layout—rivaling what can be achieved with manual placement. A single HI description in Eve suffices for multiple OS platforms and languages. This document describes Eve2, the latest version of Eve. Eve2 was developed to work with Adam and to incorporate many improvements that have been requested since Eve1 was written.

I am convinced that writing correct, high performance, and feature rich systems can be orders of magnitude simpler than it currently is. By my estimate, 70% of Adobe’s current code base could be better represented declaratively.

It’s interesting to compare Adobe’s approach with Adam to Apple’s with Cocoa Bindings. It used to be Apple that favored ambitious, heavyweight solutions, and then had trouble getting them adopted. Bindings are lightweight and can be incorporated incrementally, but their uses are more limited and they’re probably less scalable.

5 Comments RSS · Twitter

Bindings are designed to be extremely scalable. A huge amount of effort has been expended ensuring that the minimum number of notifications and updates are spawned by any given binding related operation.

Bindings are certainly not perfect. If you do find a performance related issue (or any other issue, for that matter), file a bug!

Bill: I didn't mean to imply that bindings have performance problems; I was thinking about scaling in terms of connecting and comprehending larger and more complex dependency graphs. My guess is that there comes a point where it's nice to have linguistic support for the dependency concepts.

From the amount of discussion about bindings on the cocoa mailing list people are having a hard time coping with even small dependency graphs. Of course it's debatable whether Adobe's approach would be any better from that point of view.
QT's signals and slots isn't any better so I think he's kidding himself if he thinks this is an easy problem to solve.

Adam and Eve are pretty light weight (the Adam engine is about 1000 lines of code - Eve is about 1500). They can be used together or independently, with or without the language parsers. You could use Adam for a single dialog in your UI (or even a piece of a dialog) - you don't have to convert your entire application to use Adam and Eve. The underlying binding mechanism is boost signals - so they are similar to Apple's Cocoa bindings (or Qt, or XAML) - There are several fundamental differences though - Adam is used between the controller and view logic in a UI, Adam can handle inter-related values elegantly (for example, try and write the code for three related numeric entry fields such as 'mass = force * acceleration' - the goal is that the user can enter any two and the third is calculated. This type of relationship is trivial with Adam. Adam tracks the runtime dependencies of all cells. This is used to automatically handle things like control enable/disable states (a checkbox would be disabled if the cell it is attached to isn't considered in the current state, a button would be disabled if the value of it's action is being contributed to by cells that contribute to an invariant). The contributing information is also used for script recording - if you resize an image, you want to record "set current image size to 3 inches wide constraining proportion" even the the application command is "set image size to 300 pixels by 750 pixels" - the information that is recording is the information contributing to the current result. You can use the same Adam model, without the UI attached, to play the script.

I hope that helps to explain what Adam is about -

Thanks for the positive comments.
Sean

Thanks for the information, Sean. I didn't realize that it was easy to use Adam piecemeal. It sounds like a great technology.

Leave a Comment