Form follows function: Editor GUIs in a functional style

Sander Evers · University of Twente Research Information · 2004

Programming a graphical user interface (GUI) is often time-consuming and boring, requires quite some knowledge about the GUI library, and is likely to result in monolithic, badly readable and inflexible code -even for small and simple programs like editors.These omnipresent GUI parts (for example, all 'Options' and 'Properties' dialogs are editors) allow the user to inspect and update a set of values.We introduce a small abstract language for describing editors in a modular, flexible, compositional and concise way.In this language, an editor is characterized by its subject type, the type of values it can edit.The operators ⊗, ⊕ and C are used to construct new editors with new subject types.We implement this language as a layer of functions upon the Object I/O Library in the purely functional language Clean.Using this functions, it is indeed possible to quickly construct editors in a declarative way, i.e. without defining object identifiers and event handlers.However, the layout structure of these editors is coupled to the structure of their subject type.We investigate two approaches to decouple these two structures: using a monadic style and using references. SamenvattingHet programmeren van een grafische user interface (GUI) is vaak langdradig, vergt veel kennis van de GUI library en resulteert meestal in monolithische, slecht leesbare en niet-flexibele programmacode -zelfs voor simpele programmaatjes zoals editors.Deze alomtegenwoordige GUI-onderdelen (alle windowtjes voor 'Opties' en 'Eigenschappen' zijn voorbeelden van editors) laten de gebruiker een verzameling waarden bekijken en bewerken.We definiëren een abstract taaltje waarmee editors beschreven kunnen worden op een modulaire, flexibele, compositionele en compacte manier.Hierin wordt een editor gekarakteriseerd door zijn subject type, het type van waarden die ermee bewerkt kunnen worden.De operatoren ⊗, ⊕ en C construeren nieuwe editors met nieuwe subject types.We implementeren dit taaltje als een laag functies bovenop de Object I/O Library in de puur functionele taal Clean.Met deze functies kan een programmeur daadwerkelijk snel en declaratief editors specificeren, dus zonder dat hij/zij object identifiers hoeft te gebruiken of event handlers hoeft te schrijven.Van deze editors is echter wel de layoutstructuur gekoppeld aan het subject type.We onderzoeken twee manieren om deze twee structuren los te koppelen: door een monadische stijl en m.b.v.references.

Read the paper · More papers on PaperTik