( resources home )
summer of lisp past meetings directions contact us join mailing list shop merchandise
( news )
Shop LispNYC, we've got cool items available at cafepress
PyCells -- Porting Cells to Python [Page Under Real-time Construction]
Translate the constraints-like dataflow paradigm of Kenny Tilton's Common Lisp Cells package to Python
Synopis
- Cells is a mature, stable extension to CLOS that allows you to create classes, the instances of which have slots whose values are determined by a formula. Think of the slots as cells in a spreadsheet, and you've got the right idea. You can use any arbitrary Common Lisp expression to specify the value of a cell. The Cells system takes care of tracking dependencies among cells, and propagating values.
- While the absence of macros and multi-statement lambda in Python will make coding more cumbersome, the big win of Cells can still be had, namely, the decomposition of application complexity into so many smaller hence vastly more tractable rules. In any language, that is a Good Thing.
Mentors
- Kenny Tilton (kentilton, gmail)
Discussion
- In 1987, Fred Brooks wrote that no Silver Bullet would be found within ten years of his writing.
- Brooks wrote: "The essence of a software entity is a construct of interlocking concepts: data sets, relationships among data items, algorithms, and invocations of functions...Software systems have orders-of-magnitude more states than computers do...a scaling-up of a software entity is not merely a repetition of the same elements in larger sizes; it is necessarily an increase in the number of different elements. In most cases, the elements interact with each other in some nonlinear fashion, and the complexity of the whole increases much more than linearly."
- Nonlinear bad! Brooks's conclusion: "The complexity of software is an essential property, not an accidental one.". Here Brooks adopts Aristotle's sense of essential, namely, inherent, a.k.a ineluctable.
- Forget about ten years, says Brooks, big software will never get any easier. While lines-of-code grows linearly, the interlocking, interacting states within the application model experience an exponential explosion of dependencies. Someone has to keep the data straight, and nothing can change that. The different states really do depend on each other, and programmers really will have to struggle mightily to keep them self-consistent.
- Well, Brooks was wrong. In 1996, one year under his deadline, this writer reinvented what Guy Steele published in his PhD thesis. In August, 1980, seven years before Brooks's prediction.
- Steele wrote: "One may visualize a constraint 'program' as a network of devices connected by wires. Data values may flow along the wires, and computation is performed by the devices....[Constraints]are restrictive enough to forestall combinatorial explosion in many interesting computational situations, yet permissive enough to allow useful computations in practical situations. Moreover, the paradigm is intuitive...a complete programming system which will implicitly support the constraint paradigm to the same extent that LISP, say, supports automatic storage management."
- Steele, meanwhile, credited Sketchpad in 1962 as the original constraints implementation, so Brooks was really off the mark. More out of whack, however, is the IT industry, which has never capitalized on the idea. Steele himself marvelled at how Sketchpad's example had not been taken up: "Why were not these ideas explored further, rather than waiting ten to fifteen years?". But this writer was reading his question thirteen years later, after having unwittingly stumbled onto the same paradigm.
- Now it is ten years later more, and few Common Lisp devotees have any interest in Cells. But over at Adobe, they take automatic state management seriously. Check out Adam: "The apparent complexity is due to a high degree of interconnected variables." Sound familiar? And: "The real architecture of the system, however, is the structure formed by the individual datum and logical interconnections."
- Pie in the sky poli sci? Not: "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....Realizing even a fraction of this potential would open up a world of opportunities.
- "Why would Adobe give such technology away? The answer is twofold. First, we want to give back to the wonderful open source community which gives us so much. Second, we are releasing ASL because we want these problems to be solved....we realize the problem is far larger than us alone."
- Maybe Python should have something like that, too. The project milestones:
- Determine target syntax for PyCells.
- Translate Cells regression test suite to PyCells.
- Translate Cells from Common Lisp to Python and test.
- Translate the demo applications of Cells-Gtk and Celtk (+ Cells Tcl/Tk) to PyGTk and Tkinter.
- Test on all OSes.
Prerequisite Student Skills
- Very strong Python, including metaclass programming experience.
- Ability to read, run, experiment with an existing Lisp library.