Yin Yang Principle

A principle of language design, associated with SymmetryOfLanguage.

SymmetryOfLanguage describes how features feed back into one another in a FirstClass manner. This is usually achieved by having a 'symmetry' of feature that accomplishes some sort of duality. A 'duality' is a mechanism that is reversed, all arrows turned around... a simple example is how RealMacros build up a program even as compilers break them down, another example of which is the definition of objects and the composition of objects, another example of which is having triggers cause events and events result in triggers (ObserverPattern, EventDrivenProgramming).

But SymmetryOfLanguage is achieved most easily in a TuringTarpit. Since there are few 'features' to such a language, it becomes trivially symmetrical.

YinYangPrinciple says: if two patterns are duals, they should be separated rather than blended at the language level.

YinYangPrinciple combined with SymmetryOfLanguage: separate the duality, then allow both aspects to interweave and feed off of one another in a VirtuousCircle aimed at achieving some class of NonFunctionalRequirements.

Following these principles, one should consider it a LanguageSmell if a language supports half of a duality (e.g. 'local' data and objects) without also supporting the other half (e.g. 'global' data and views).

It is worth noting many DesignPatterns following both principles: SeparatePolicyFromMechanism? (e.g. ResumableException), AlternateHardAndSoftLayers (especially within a single language, e.g. via staged compilation), ObserverPattern, RealMacros, DependencyInjection, SeparateIoFromCalculation, and many more. As with others, these DesignPatterns suggest MissingFeatureSmell.


See EconomyOfExpression for a rant on the subject.


See also: EconomyOfExpression, SymmetryOfLanguage, ObjectVsModel


EditText of this page (last edited July 9, 2010) or FindPage with title or text search