250 likes | 369 Views
Towards a Practical Composition Language. Oscar Nierstrasz Software Composition Group University of Bern. Roadmap. The problem: Software Evolution What about OOP? Components? … Approach: understanding composition Piccola — a small composition language Where are we? Where do we go?
E N D
Towards a PracticalComposition Language Oscar Nierstrasz Software Composition Group University of Bern
Roadmap • The problem: Software Evolution • What about OOP? Components? … • Approach: understanding composition • Piccola — a small composition language • Where are we? Where do we go? • Evaluation; research agenda FMCO, Leiden, 2002-11-07
1. Thesis — Focus on Software Evolution Software evolution is the key problem in software development Not purely a technical issue • Lehman’s Laws • What’s wrong with OOP? • What’s wrong with Components? FMCO, Leiden, 2002-11-07
Lehman’s Laws Continuing change • A program that is used in a real-world environment must change, or become progressively less useful in that environment. Increasing complexity • As a program evolves, it becomes more complex, and extra resources are needed to preserve and simplify its structure. • Lehman and Belady, 1985 FMCO, Leiden, 2002-11-07
The Myth of Software Maintenance Between 50% and 75% of global effort is spent on “maintenance”! (= “continuous development 17.4% Corrective (fixing reported errors) 60.3% Perfective (new functionality) 18.2% Adaptive (new platforms or OS) • Lientz, 78 4.1% Other FMCO, Leiden, 2002-11-07
What’s wrong with OOP? (I) OOA and OOD are domain driven • Designs are based on domain objects, not available components • Objects end up with rich interfaces, not plugs • Hard to reconfigure and adapt objects FMCO, Leiden, 2002-11-07
What’s wrong with OOP? (II) Implicit Architecture • Source code exposes class hierarchy, not run-time architecture! • Objects are wired, not plugged together • How the objects are wired is distributed amongst the objects • Hard to understand and hard to evolve FMCO, Leiden, 2002-11-07
What’s wrong with OOP? (III) Implicit Reuse Contracts • Idioms and patterns are hidden in the code • Hard to learn frameworks and conventions FMCO, Leiden, 2002-11-07
What about Components? stable ^ A software component is a unit of independent deployment without state • We know how to build components! • We don’t understand how to compose flexible applications from components. • We should be thinking more about composition than about components. FMCO, Leiden, 2002-11-07
2. Composition A composition language would support flexible, high-level composition of applications from components according to various styles. • Applications = Components + Scripts • Piccola: A Small Composition Language • Forms + Agents + Channels • Styles as Component Algebras FMCO, Leiden, 2002-11-07
Applications = Components + Scripts Components both export and import services Scriptsplug components together FMCO, Leiden, 2002-11-07
Towards a Composition Language Scripting languages Configure applications from components ADLs Specify compositional styles Coordination languages Configure applications from distributed services Glue languages Adapt components to new contexts FMCO, Leiden, 2002-11-07
Piccola — A Small Composition Language Piccola agents compose and coordinate external components FMCO, Leiden, 2002-11-07
Piccola Layers FMCO, Leiden, 2002-11-07
Forms + Agents + Channels Forms embody structure • immutable, extensible records • they unify components, services and namespaces Agents embody behaviour • concurrently executing scripts • they unify concurrency and composition Channels embody state • mailboxes for communicating agents • unify synchronization and communication. FMCO, Leiden, 2002-11-07
Piccola in a Nutshell A form consists of a sequence of bindings: helloForm = # a form Label = "hello world" # a binding do: println Label # a service A script composes components by invoking services makeFrame Title = "Demo” makeButton(helloForm) ? Action(helloForm) High-level connectors hide details of object wiring. FMCO, Leiden, 2002-11-07
Hello World FMCO, Leiden, 2002-11-07
Component Algebras A style can be viewed as a many-sorted algebra: • connectors as operators over components: source | filter is also a source • contrast the procedural view: a.in() -- b.out() doesn’t yield a new component ... FMCO, Leiden, 2002-11-07
Some Piccola Styles Many frameworks can be expressed as component algebras • Pipes and filters (both push & pull flow) • GUI composition • Event listeners • Actor groups • Regulated coordination (law-governed interaction) • Mixin layer composition FMCO, Leiden, 2002-11-07
3. Where are we? Where do we go? What would be a practical composition language? • How explicit namespaces support composition • Results and shortcomings • The future FMCO, Leiden, 2002-11-07
How forms support composition FMCO, Leiden, 2002-11-07
Results so far • Piccola implementations for Java and Squeak • Sophisticated language bridging • Partial evaluation • Various experimental composition styles • Formal semantics • π calculus with first-class namespaces • Limited reasoning about styles and composition Publications and software: www.iam.unibe.ch/~scg FMCO, Leiden, 2002-11-07
What’s missing? • Explicit components, connectors & styles • Type-checking provided and required services • Reasoning about styles and compositions • Adapting/reengineering existing services FMCO, Leiden, 2002-11-07
The future of composition? • Dynamic composition of ubiquitous services • Service discovery and negotiation • Reconfiguration validation and run-time monitoring FMCO, Leiden, 2002-11-07