Sometimes, it seems so odd to call code a model. Why? Well, true it has the characteristics of a model, but I once thought, it is also more appropriate to say that code is at a higher level than machine code, but it is still "code".
Then the question arises what is "code" and it does it have to be textual? For the most part, yes. Once upon a time, code meant humans writing instructions that a machine can understand. There could be layers of transformers and compilers in between, but eventually it was for the machine to process and execute. And generally humans are more precise in wrting in text than drawing pictorial models, so computer scientists always resorted to a textual form for "code". Not that graphical models wouldn't work. I can imagine having machine level instructions generated from squares and circles and arrows between them. But as you can imagine this is not productive. Also, historically computer scientists were always very technical and had a math or physics mindset. And hence graphical models again never enticed them.
So, it always came to understanding in the computing industry that when someone says "code", alarms ring in the brain shouting, some textual representation understood by a computer by either consuming directly or by transforming it in layers in different intermediate languages. But even these intermediate languages are always perceived as to be textual.
So the next obvious question arises is "Whether all that is said above is true ? - Was it right to always perceive code as of some textual form".
Or whether code is nothing but a model representation of a programming language which eventually is a model of an intermediate language which in turn is a model of machine code? Are they all truly "models"? Just taking the avatar of textual representation? In theory, this statement seems right. But in practice, when the "how" comes into play, suddenly we are confused again. So is thinking in "how" really evil, and the textual form thinking, we have adopted "code" is a just a fallacy? Maybe, maybe not. Or maybe it is just one of the many buzzwords our industry is known to create. Or maybe "model" is just a word, that has a vague meaning in our industry.
Harry Pierson's this blog entry inspired me to write this entry. After reading it, for the most part, he convinced me to think of code in terms of model. And I also agree with the "tenets" he mentioned in his weblog. Also, I personally cannot imagine working on an enterprise level project without modeling the design and architecture level artifacts using some diagram like UML. And I also agree that models are of little value, if they are not used to transform and generate into code.
So yes, I think it is accurate to say, that code is model. It is theoretically sound and can be proved easily using Mathematical induction. Although I personally think that this distinction isn't as important as it seems. But I agree, it is good to get the vocabulary straightened out. So when someone speaks of a model, our brain tells us that he/she is just speaking of a high level abstraction to some low level abstraction, be it in text form or graphical or 3-dimensional - although that would be interesting - having each co-ords represent some special artifact :)
Before, I had always thought of UML diagrams as models, just because they were graphical. And there was a correction needed in my comprehension.
You can share your opinions in the comment section of Harry's weblog.
© 2008 Vishal V. Shah. All rights reserved. Contents of this web site reflect my personal work and is not representative of my employer.