> These are not clever tricks, they are the mathematical foundation of our profession.
Perhaps, but many of the best real world programming tools have a theoretically sound base but sufficient abstraction that the programmer does not need to concern himself with it.
> Why do you assume the types fail to model the domain intuitively?
Well, using six classes/interfaces and an enumeration just to describe a 3x3 array is one clue.
The horrific complexity of the proposed BoardLike interface is another.
And I would argue that the very existence of the Position enumeration is a third, betraying an underlying complexity that isn't shown in the interface here but is almost certainly present throughout the underlying implementation.
I was not just trying to be clever. I feel the subject is very applicable here. But more importantly, the horrific complexity is not due to the solution (it really isn't that complex), but is a rather good demonstration of why Java is a rather difficult language to write correct software in.
Perhaps, but many of the best real world programming tools have a theoretically sound base but sufficient abstraction that the programmer does not need to concern himself with it.
> Why do you assume the types fail to model the domain intuitively?
Well, using six classes/interfaces and an enumeration just to describe a 3x3 array is one clue.
The horrific complexity of the proposed BoardLike interface is another.
And I would argue that the very existence of the Position enumeration is a third, betraying an underlying complexity that isn't shown in the interface here but is almost certainly present throughout the underlying implementation.
> Have you ever heard of denotational semantics?
I have! I have! Can I be clever too now, please?