Sunday
Functional programming in OO tutorial
Presented my tutorial. This is an overview of functional programming and how to integrate that paradigm into an OO environment. It contains example code for several key pieces of a Functional programming runtime including: an interface for Function objects, an interface for Lisp style list/streams, implementation of a tiny Functional library (map, foldl, foldr and transpose), a framework for tail-call elimination, and an assortment of little helpers and worked problems. I explain when the Functional style is useful and appropriate, and demonstrate several techniques ranging from Functionally derived Patterns to adopting a pure Functional style. The code, examples and slides are available via SVN at: http://svn.xp-dev.com/svn/
Monday
Barbara Liskov keynote
Barbara Liskov is a systems programmer who, in the mid '70s, developed and/or refined a series of programming language concepts while designing the research language CLU. Among these were: abstract data types, exception handling, iterators and, most famously, the relationship between substitutability and subtyping. She was motivated by a desire to create a language that would facilitate communication between programmers, to both formally define and test her ideas (particularly in the area of abstract data types, a precursor to Objects), and to do so in a way that was also performant. She placed high value on the qualities of expressiveness, simplicity, performance, ease and minimalism. She placed a lot of emphasis on the idea that ease of reading program source is more important than ease of writing it, where comprehension is the key goal of reading. This is the driving force behind the famous _Goto considered harmful_ paper by Dijkstra as well as a long string of developments that followed: structured programming (Hoare & Morris), _Global variables considered harmful_ (Wulf & Shaw), encapsulation, exception handling, etc... She noted the success of languages that support semantic extension (e.g. the introduction of new types, functions and variables) and the general failure of syntactically extensible languages (e.g. operator overloading), calling the latter "write only" languages. It turns out that semantic extensions are generally self-describing and easily assimilated in to a cognitive model, where syntactic extensions are ambiguous at best and misleading at worst. One can infer that the success of a language feature depends critically on the novice readers ability to effectively identify and research items in source code that are both of interest and whose exact nature is unknown. During the Q&A she expressed misgivings about Aspect Oriented Programming, comparing it to the use of goto's. I believe that her discomfort stems from the non-obvious ways in which AOP modifies the behavior of a program. At the end of her talk she called for new abstraction mechanisms and more complete languages to ease the difficulties of programming in the age of the internet. I think that Barbara Liskov will be both intrigued and pleased by Gosu when she encounters it.
Random notes:
Assumptions that one piece of code must make about another are a type of connection that must be included under the general umbrella of "coupling".
Exception handling should include the option to "fail". I'm not sure what she meant by this. Is System.exit() not enough? In Erlang systems, processes in a severe error state shut down and are then restarted by other processes. Part of Ms. Liskov's definition of "fail" included the ability to restart and so the Erlang model may be more in line with her thinking.
On inheritance: Type inheritance is an unequivocally Good Thing, implementation inheritance, not so much. She says that implementation inheritance breaks encapsulation (because subtypes have a view into their parent types). During this segment she mentioned that Smalltalk completely lacks this kind of encapsulation, an assertion to which Ralph Johnson (a thought-leader among Smalltalkers) took some exception during the Q&A. My opinion: In practice, her assertions are proved out. From diamond shaped inheritance hierarchies, to the "fragile base class" problem, to the addition of "mix-ins" to Scala, there is evidence that delegation is a more healthy and durable abstraction than implementation inheritance.
Modularity is based on abstraction.
During the Q&A Guy Steele asked Ms. Liskov for advice about how to design a more advanced iterator mechanism in a new language (which I imagine to be the Fortress language that he is developing to replace Fortran). She demurred, saying that she would content herself with a solution that covered most basic needs and that could be extended by hand in order to cover the rest. I was intrigued by this exchange because in my own talk I introduced the concept of streams borrowed from the Scheme programming language, and this notion seems to be a candidate solution to Mr. Steele's dilemma. Since he is one of the inventors of Scheme I can only assume that he has already considered and rejected this solution, but I am very curious as to why.
A short write-up of this talk along with links to the papers mentioned can be found at: http://cacm.acm.org/blogs/
Random conversations
Don Roberts & John Brant
Working on a project where they are translating a 1.5 million line Delphi program into C#. Their program (written in Smalltalk, of course) parses the source into an AST for analysis and translation targeting, and then fires fairly simple substitution rules to perform the translation. It turns out that they had to translate some of the UI code by hand because the underlying models were too different (despite sharing many elements and names). I understand that a demo of of the engine that the wrote to do this (called SmaCC) can be found at: blazonres.com.
Tuesday
Flapjax
Poster & demo
JavaScript library + (optional) language extensions, for concurrency.
Based in part on the "synchrony hypothesis", but I don't know what that actually means.
A major goal is to make concurrent programs deterministic.
Two new abstractions:
Behavior: a variable whose value changes due to forces that are external to the program. The value of such a variable may always be queried, but cannot be derived by any other means. [I imagine that these values must be frozen at Event boundaries in order for determinism to be achievable.] Events: a special kind of container produces event objects in response to OS events (including timers, interrupts, etc...) Methods can be attached to the container to handle these events as they occur. Alternatively, queued events may be pulled from the container as the program becomes ready to handle them. If no events are queued the default behavior is to block the requestor until one becomes available.
Type and Effect system for Java
Short preso.
I didn't really "get" this, and my notes are spotty: "Deterministic execution with parallelism for optimization"
Functional, SIMD, explicit dataflow
Fork & join style blocks:
- foreach
- cobegin
Data protection mechanisms: region, path list, index parametrized arrays, owner regions.
These each define a data set that must be modified in a transactional manner [my interpretation].
These declarations are structured so that the compiler can make some scheduling decisions based on static typing, e.g. two mutating operations may run concurrently because the memory areas that they affect are disjoint.
Commutative operation: an operation that must be atomic, but does not have to be run in a particular order relative to other operations.
More at: dpj.cs.uiuc.cs