Wednesday, February 28, 2007

Today I spent some time looking at how OCL can augment interaction diagrams. I will be going back to the OO analysis "City of Plaistow" question and augmenting the sequence diagram with OCL. I know, making the answer to the question even longer. Meaning that I could not possibly use the answer when testing. Well I have some observations about OCL. I have looked at the example of augmenting interaction diagrams. It occurred to me that I continually have to think in an unnatural way to be able to say precisely what I want in a specification. OCL is a side effect free language. It is a declarative language. You say what you want and not how to do it. The side effect free part did not settle in until I saw the interaction diagrams for the thousandth time. The postcondition declaration is a way to express that an operation happened but that the statement associated with the post condition did not do it...have a side effect. For instance I saw that addition of an object to a set is defined in a post condition as the state of the set leaving the operation minus the state of the set upon entering the operation equaling the set containing the new instance object. Right, define addition as subtraction. Why not just use addition. Well it could be confused as being an imperative language. I guess say what you mean and mean what you say don`t really mean anything in computer science. We want to confuse the world. Right? Job security and all that. PhD`s really know what they are talking about right? It is unnatural to think of addition in terms of subtraction. I will look into re-specification with addition but, subtraction is, I think what was intended and has a purpose. Maybe I just don`t see it yet.