Objects¶
Unicon Objects and Classes¶
The object oriented features of Unicon stem from an early Icon preprocessor, called IDOL. Unicon supports object oriented design and development, but is not a purely object oriented language. Unlike, for instance, Ruby where everything is an object, Unicon is still very much an everything is an expression language. Native types are native types, and objects are a design and development assistive technology, not a core element of the Unicon programming language.
Objects and classes add another aspect to the multi-paradigm dimensions of Unicon programming.
Unicon supports class declarations, and method definitions within an inherited hierarchy of classes. class defined words create instances of objects that allow method calls in an object oriented fashion.
The Unicon view of object oriented programming (and there are many different points of view regarding OO) starts with encapsulation, inheritance, and polymorphism.
Note
Objects and classes are very much a programming in the large design and development feature. Many of the examples in this document will be small, contrived, and may belittle the powerful potentials of object oriented design and programming. Try and overlook the small, and think big when applying class elements to your programs. On the flip side, as a cautionary warning, don’t try and shoehorn a small problem into objects when the procedural elements of Unicon would be more appropriate.
SOLID¶
There is an object oriented set of principles, with a mnemonic acronym, SOLID.
- Single responsibility
- Open-closed
- Liskov substitution
- Interface segregation
- Dependency inversion
These principles are outlined at SOLID: Wikipedia
The Unicon implementation of objects and classes can be applied to uphold these principles of design. But like many general purpose, flexible, programming languages, they are guidelines to be applied when they are of benefit and suit working habits.
Todo
map out Unicon examples of each SOLID principle
IDOL¶
The Icon Derived Object Language, by Clinton Jeffery, circa 1990.
See https://www2.cs.arizona.edu/icon/ftp/doc/tr90_10.pdf for the initial Idol technical report from January of 1990.
Todo
Much to do regarding the Objects chapter.
Index | Previous: Patterns | Next: Graphics