Top Banner
Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000
30

Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Dec 31, 2015

Download

Documents

Denis Charles
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Multi-Paradigm Design

James O. CoplienPh.D. Student, VUB18 May 2000

Page 2: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Thesis statement

Building on basic primitives of classic category theory and human cognition—commonality and variation—multi-paradigm design provides a uniform and formal basis for the definition of common programming paradigms, and a common basis for analysis of the application and solution domains, and the translation between them.

Page 3: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Thesis Claims

Abstraction and Intentionality: First Principles of Abstraction

Meta-Design: Paradigm selection as a design activity A formal, domain-based model for paradigm

Commonality Categories Application Domain and Solution Domain Analyses

Multiple paradigms within a domain Dependencies between domains: Limits to

Modularity Theory of Negative Variability: Generalizing

cancellation Regularization of Ad-Hoc Design Patterns

Page 4: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

The Purpose of Design

To solve a problem Design for change and all else follows

Partitioning the Work Domains that follow business structure

Shaping modular structure Choose a paradigm according to a basis

Attentiveness to Aesthetics Solution domain analysis

Page 5: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Commonality and Variability Analysis

The basis of abstraction (classic model)Families: commonalities and regularity in

variabilitiesClaim: Abstraction and Intentionality

Page 6: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Commonality Analysis

The essence of abstraction Commonalities define families from family members We allow partitioning criteria to arise from the abstractions, not

vice versa! Many axes of commonality:

Behavior Data structure Name Code structure

We define these as commonality categories Claims: Meta-design

Page 7: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Variability Analysis

Same dimensions as commonalityA commonality dimension + a variability

dimension form a paradigm Objects: common structure and behavior,

variable structure and algorithm Overloading: common semantics, variable

interface and semantics …

Claims: A basis for paradigm

Page 8: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

The place of paradigm

A way of organizing thingsWe organize by abstractingAbstracting focuses on what is commonWe treat variations separately

Page 9: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

A “Universal Paradigm”

Define a software family (by grouping according to commonalities)

Find the commonalitiesEstablish the parameters of variation

Page 10: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

OO As a Special Case

Arrange by commonalities Collect similar objects into classes Organize classes together using inheritance Establishes a base class interface

Establish parameters of variation Each family member has its own internal data

structure Each family member may implement a behavior

with a different algorithm

Page 11: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Domain Analysis

Traditional domain analysis: study of a subject area, the building of families

Frequently based on commonality and variability analysis

There are many domains: Many application domains Solution domain

Page 12: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

A problem: Negative Variation

In OO, inheritance with cancellationBUT: it is more general

Template specialization: cancels structure Argument defaulting and overriding Many design patterns

Negative variation formalises these exceptions

Page 13: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Solution Domain CV Table

Commonality Variability Binding Instantation C++ Feature

Anything otherthan algorithmstructure

Source N/a Template

Fine algorithm Compile N/a #ifdef

FunctionName andSemantics

Fine or grossalgorithm

Compile N/a Overloading

Value of State Run Time Yes Struct, simpletypes

A small set ofvalues

Run time Yes Enum

DataStructure

Types, valuesand state

Source Yes Template

Value of State Source No Module

Value of State Source Yes struct, class

Data Structureand State

Compile Optional Inheritance

Compile Optional Inheritance

RelatedOperationsand SomeStructure

Algorithm,Data Structureand State Run Optional Virtual

Functions

Page 14: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Negative Variability Table

Kind of Commonality Kind of Variability

C++ Featurefor PositiveVariability

C++ Feature forCorresponding

Negative VariabilityName and Behavior Gross Structure or

algorithm(parametric)

Templates TemplateSpecialization

Structure, algorithm,name, behavior

Fine structure, valueor type

Templates Template argumentdefaulting

Enclosing datastructure

Fine structure and"type"

Inheritance union

Semantics and Name(of function)

Default value in aformula or algorithm

Argumentdefaulting

Overloading

Supply explicitparameter

OverloadingCommonality in some

data structure,perhaps in algorithm

Membership in DataStructure

Inheritance,adding datamembers

Re-factor usingpointers to alternative

implementationsSome commonality in

structure andalgorithm

Behavior Inheritance,overriding oradding virtual

functions

Private Inheritance

Most source code Fine algorithm #ifdef #ifdef

Page 15: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Most GOF patterns… aren’t...

Commonality Variability Binding Instantiation Pattern

Finealgorithm

Run time N/A Template Method

Algorithm Run timewithcompile-timedefault

N/A Unification +Template Method

Functionname andsemantics

Algorithm:Parmeter ofvariation issome state

Run time Yes State

Grossalgorithm

Run time N/A Strategy

Value ofstate

Source time Once Singleton

Relatedoperationsand somestructure

GrossAlgorithm

Source time(or compiletime)

N/A Strategy(templates) orUnification

Relatedoperationsbut notstructure

Incompat-ible datastructure

Any Yes Bridge orEnvelope/Letter

Page 16: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Patterns of Negative Variability

Kind ofCommonality

Kind ofVariability

Binding Instantiation Pattern

Somestructure andalgorithm

Functionname andsemantics

Compileor runtime

Optional Adapter

Relatedoperationsbut notstructure

Cancellationof classmembership

Any Yes Bridge

Page 17: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

TextBuffer Transformational Analysis

Parameters ofVariability Meaning Domain Binding

Default /Technique

Output Type

Character Set

Working SetManagement

Debugging Code

The formatting oftext lines is sensi-tive to the outputmedium

Different buffertypes supportdifferent charactersets

Different applicationsneed to cache dif-ferent amounts ofmemory

Debug in-houseonly, but keep testsin source code

Database,RCS, TTY,UNIX file

ASCII,EBCDIC,FIELDATA

Whole file,whole page,LRU fixed

Debug,production

Run

Compile

Compile

Compile

UNIX File

ASCII

Whole file

None

TextBuffer: Common Structure and Algorithm

Page 18: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

TextBuffer Transformational Analysis

Parameters ofVariability Meaning Domain Binding

Default /Technique

Output TypeStructure,Algorithm

Character Set

Type

Working SetManagementAlgorithm

Debugging CodeCodeFragments

The formatting oftext lines is sensi-tive to the outputmedium

Different buffertypes supportdifferent charactersets

Different applicationsneed to cache dif-ferent amounts ofmemory

Debug in-houseonly, but keep testsin source code

Database,RCS, TTY,UNIX file

ASCII,EBCDIC,FIELDATA

Whole file,whole page,LRU fixed

Debug,production

Run

Compile

Compile

Compile

UNIX FileVirtualFunctions

ASCIITemplates

Whole fileInheritance

None#ifdef (fromNegative variabilityTable)

TextBuffer: Common Structure and Algorithm

Page 19: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Text Buffer Dependency Graph

Text Buffer:Common Structure

And Algorithm

Output Type:Structure and

Algorithm

Working SetManagement:

Algorithm

DebuggingCode: FineAlgorithm

Character Set:Type

Page 20: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

The File Domain

Record TypeStructure and

Algorithm

DebuggingCode: FineAlgorithm

AlgorithmCharacter Set:

Parametric

Output Media

Encryption:

BufferType:Structure and

Algorithm

Page 21: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

The unified design

Text Buffer

Common Structure

and Algorithm

Output Media

Working Setmanagement:

AlgorithmDebuggingCode: Fine

Algorithm

Character Set:Type

Encryption:Algorithm

Debugging Code:Algorithmic Frags

Claim: domain dependencies

Page 22: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Recap of Claims

Abstraction and Intentionality: The code is the design Meta-Design: Doing objects honestly, or using other

techniques when they apply A formal, domain-based model for paradigm

Commonality Categories Application Domain and Solution Domain Analyses

Multiple paradigms within a domain Dependencies between domains: Limits to Modularity Theory of Negative Variability: Generalizing

cancellation Regularization of Ad-Hoc Design Patterns

Page 23: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Thanks!

David J. WeissTheo D’HondtMartine DevosDebbie LaffertyCarine LucasTim BuddThe Committee

Page 24: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Bijstelling: Symmetry and Patterns in Organizations

James O. CoplienPh.D. Student, VUB25 April 2000

Page 25: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Aposition

Pattern theory can be used as a formal basis for organizational models based on social network theory. In particular, current role-based models can be extended to build on the hypothesis that human organizational structures follow the same symmetries and patterns of symmetry-breaking observed in other biological populations, a phenomenon that has deeper roots in more general laws of natural systems in the domains of crystallography, astrophysics, mathematics, subatomic particle physics, and other domains.

Page 26: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Two Architectures

The thesis is about architecturePer Conway, architecture is about

organizationHere we talk of software patterns…… but there are organizational patterns,

too [Kroeber]

Page 27: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

A curious pattern

Patterns in anthropology…Patterns in other natural sciences...Software organizational patterns...Patterns as symmetry breaking…Alexander’s theory of patterns based on

geometry……it’s all related

Page 28: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Aposition

Seek organizational formalisms based on symmetric relationships Individials Instrumental organizations

Establish common patternsTie to cultural invariants and breaking of

those invariants in symmetric configurations

Seek drivers for symmetry-breaking

Page 29: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.

Building Blocks

Organizational Patterns [Coplien et al.]Group theory and symmetry theoryPrior art in ethnography and social

network theory and researchDiadic psychology (family therapy,

distance relationships literature, etc.)

Page 30: Multi-Paradigm Design James O. Coplien Ph.D. Student, VUB 18 May 2000.