Unless you are a programmer that only follows specifications written by others when you program, you have designed several languages already, even if you didn't think of it that way. "But I haven't written any programming languages," you say. "I don't even know how an interpreter or compiler works." But that is not what I mean. Let me explain.
Whenever you work with your computer, you are using one or more languages. Languages define the way you as a user interact with components in the computer, and how components interact with each other. "I have actually implemented a couple of user interfaces. Is that what you mean?" Yes. "And one of my programs could be configured with a property file. Do you mean the property file is a language too?" Almost. I would say the property file is written in a language of your design, but the property file itself is a component in the software architecture, not a language. The property language is also implemented by the application reading the file. "But I was only using the standard Java property file format. I didn't design anything." Yes you did. You choose the parameters and what impact they will have on the application. Your property language is, as you correctly point out, an extension of the standard Java property files, but also a unique language. It would be impossible to interpret the meaning of your properties with only the Java property file definition as a reference.
When designing a language, I start to think about what I want to be able to do with the language. I write some statements a potential user would write, or think through a couple of use cases. At the same time, I start to define the nouns and verbs in the language with a model of the terminology used. The language then evolves to handle all requirements from the initial user. I always have an initial user, or I would not design the language at all. The hard part is then to make the language useful for others. If I only have one user, I will have to guess where to generalize and when to specialize. I definitely want to be as specific as possible, or the users will find the language useless for its purpose.
Then, if not earlier, comes the question if the language should be a standalone language with its own syntax and semantics or if it should extend some existing language. In the latter case it could be a programming language API, an XML schema, a GUI, a BEEP protocol, and so on. Another decision is if the language should be defined using a formal language like IDL or ASN.1, or if the language should have an informal description only. In the extreme case, a new formal language description language is developed in parallel. Another popular way to describe the language is to write an interpreter for it using itself, but this only work for Turing complete languages, and probably needs an informal description as well, for anyone to understand it.
The conclusion is that whenever you write a program on your computer, you implement some language at the same time. It doesn't have to be a state of the art generic programming language with the latest type theory, even a simple graphical user interface counts. If you always know which language you are implementing, you have come a long way towards being a successful programmer.
And now something to think about. If the property file is a component, which language does it implement? "Sigh, I don't know. Wait! Don't tell me. It is extending one of my other languages, right?" Right.
No comments:
Post a Comment