Sometimes, when we enter a new technology, we make progress by imposing structure on the chaos in an almost autistic fashion. "Structured programming" enabled a generation of programmers to master challenges during the 1970s when in fact programming was advancing rapidly in such phenomenae as unix.
When I started with .Net objects I realized the difference between stateful and stateless to be key and also needed a coherent way to multithread and the result was the "methodology" found in Build Your Own .Net Language and Compiler.
I found, also, that it gave me a great deal of serenity to implement a "core" set of properties and methods consisting for the most part of ClassName, inspect, test, object2XML and Name.
For me, the ideal object was developed in this Classical methodology and like a tragedy by Racine, the object's development itself, although intense, needed to adhere to the Three Unities of time (developed in a continuous session) place (developed in a single folder of solution files) and of course action (developed with a single mission statement).
However, this high style and all this drama also gets in the way of new experiences.
Today, I needed a crummy little object that would encapsulate EITHER "no limit" OR "a limit >= 0".
In C this would have been a union of an int and bool consistently False, or worse, -1 would have "meant" no limit as it so often does.
Object design liberates us from having to map the non-numeric real world onto the integers like dull fellows and instead our representations can be pure logic, free of unnecessary mathematics and numerization for the sake of it. When sorting cards for the Registrar in 1971, I had an epiphany: the sorter did not "care" about numbers at all. It was sorting grades.
At the same time, I did not want to embark on the High Drama of my development methodology, involving as it would the creation of a Big Boxed Comment with an object reference manual, and the "core" methods. My good taste has probably been questioned by maintenance programmers as I have myself pronounced deep curses on many programmers in turn, but I have enough to adhere to ANOTHER principle, again derived from 17th-century French classicism as well as Salon painting of the French 19th century.
This was the felt need of artists like Racine, and the Salon painters, to address only Serious subjects.
In the 17th century it was in full force. All of Racine's dramas, as opposed to those of the more crowd-pleasing Moliere, are tragedies about people of high state and rank from the "high and palmy days of Rome", and Greece.
Indeed, Racine was even ashamed to write tragedies about Phedre and Britannicus for influenced by the severe French Catholic philosophy of Jansenism, Racine felt that Higher topics would be exclusively religious.
It is a mistake in programming to use a high and classical style for trivial goals and is reminiscent both of the ways in which the "mechanicals" of Shakespeare's Midsummer Night's Dream, and Ancient Pistol of his Histories, are funny when they strike classical poses, as in this scene between Pistol and two "hos":
PISTOL
I'll see her damned first; to Pluto's damned lake, by this hand, to the infernal deep, with Erebus and tortures vile also. Hold hook and line, say I. Down, down, dogs! down, faitors! Have we not Hiren here?
MISTRESS QUICKLY
Good Captain Peesel, be quiet; 'tis very late, i' faith: I beseek you now, aggravate your choler.
PISTOL
These be good humours, indeed! Shall pack-horses
And hollow pamper'd jades of Asia,
Which cannot go but thirty mile a-day,
Compare with Caesars, and with Cannibals,
And Trojan Greeks? nay, rather damn them with
King Cerberus; and let the welkin roar.
Shall we fall foul for toys?
MISTRESS QUICKLY
By my troth, captain, these are very bitter words.
Pistol is funny because he uses overelaborate speech to cheat hos in a ho house. Equally, a program which is written to an over-elaborate standard is amusing, or just annoying.
Of course, few programmers today make this mistake...perhaps for the same reason that the traditional English teacher's complaint of "over-elaborate writing" is seldom encountered in my own teaching experience, where the writing is simple to the point of incoherence. But I have been known to strike Ancient Pistol poses.
I was therefore delighted to remember that in .Net, a simple Structure can actually have state in the form of private variables and expose properties and methods. Declaring the oddly-shaped object as a lightweight (but not stateless) structure seemed an elegant solution.
A while ago, I speculated about the worth of a highly abstract set of objects because many things seemed in ordinary praxis to be, well, ordered pairs
Private Structure TYPorderedPair
Public objX As Object
Public objY As Object
Public Sub setOrderedPair(ByVal objNewX As Object, ByVal objNewY As Object)
objX = objNewX: objY = objNewY
End Sub
Public Overrides Function toString As String
Return "(" & object2String(objX) & "," & object2String(objY) & ")"
End Function
End Structure
[object2String is a method in the stateless utilities.dll shipped as part of the Apress software. It converts all .Net value objects and many reference objects to strings such that those strings can be displayed in common fonts.]
The problem is obvious. Object is overgeneral and too weak because in MOST cases x and y are numbers: yet Double as the type would not address the need, at times, to have an ordered pair of strings or even of two reference objects.
The long-term solution is of course generics in Whidbey.
But another problem is that the above probably needs to be Inherited. Most of us, and me some of the time, don't exist in the world of Bertrand Russell's Principia Mathematica, wherein sets, ordered pairs, and other faeryland creatures cavort. No, we live in the ordered pair of the real, comma, world.
Thus a partnership between two customers, some sort of cahoots, needs to be an object which is-an ordered pair.
You can do everything with delegation and you have to in VB-6 but reading Corey Haines' posts and, last year, my boss' C sharp code, I realize I need to Inherit more and Delegate less.
At the same time, I remain convinced of the utility of the Platonic abstractions. The problem is nobody pays me to write a truly killer diller Set object or else they give me a link to where they say it's been done, and I find some code I don't like.
I still want a book and a kit of really cool abstractions and I drafted a book about such a kit for O'Reilly. It's been canceled twice, once by O'Reilly (as a newbie author I didn't know the game well enough) and once by Addison-Wesley, who seem to be cutting back on VB offerings, plus I was late because of the Apress book. Today I am far too busy in China to present it again and it probably should be C sharp which would entail, for me, a couple of weeks getting completely up to speed in C sharp.
I know the book doesn't exist because the abstractions would be logical, and not mathematical, and would fully exploit threading. For example, I am as I have said working on an abstract class for traversing a tree AS WELL AS an array while emitting threads from a pool.
Programmers have been in my experience encouraged to be less grandiose in their ambitions, and I tried rilly hard to do this, in my patented passive-aggressive style, in the 1970s, only to miss the boat on micros, totally, while being Baxter Travenol's guru in MVS Cobol and quietly going bat shit. But I see in Kant where even the "shadowy notice of Fame" is as dust and nothing and at the end of the day, this stuff is just Fun.