Sometimes the best way to solve a particular family of problems is to create a domain specific language, which may be implemented as an extension to a standard language.
For example (and once again, quite early in my career), I worked for an
organisation – I'll call it Vector Products – which specialised in solid
geometry software. Vector Products developed and actively maintained a
proprietary extension to C – I'll call it C-cubed – which provided native
support for various domain-specific primitives: vectors (the sort you find in
3D mathematics, not
std::vector), ranges, axis-aligned boxes; and for
domain specific operators to work with these primitives.
I should stress that this C extension pre-dated standard C++. C++ classes and operator overloading can now handle much of what C-cubed provided. Nonetheless, Vector Products' investment paid off: C-cubed allowed programmers to write vector mathematics in a clean and legible way, thereby freeing them to concentrate on the real solid geometry problems they needed to solve.
I get the impression that the earliest incarnations of C++ were essentially domain-specific extensions to C. For early C++, the domain would be Object Oriented Programming. See Stroustrup for more.
This again is metaprogramming, though (particularly with respect to the supplied examples) it is closely related to compilation.
|Copyright © 2005 Thomas Guest|