The Blueprint Analogy

by Haig. Average Reading Time: about a minute.

By creating classes we categorize the data we are representing and give these representations a context by associating them with features in the programming languages API. However a class is never used in the main program, it must first be instantiated as an object and the object is what we would use in our main program. In this sense a class is more like a blueprint, that describes the complex relationships between the data we are representing, like the blueprint of a house can describe how tall a wall will be or how far a window will be from the ceiling. If you can imagine a class to be like a blueprint then a software object is like a house made from that blueprint. For example, a class only describes the possible objects that can be instantiated from it, taking the blueprint analogy further we cannot live in a blueprint yet it has all the information we need to build a house which would be something that we use as a functional object. In other words we use the blueprint to build a house, this is just like instantiating an object from a class. The class only describes the possibilities of an object that can be instantiated from it and when we finally do instantiate an object from the class, it is the object that we use in our main program.

Just like a blueprint describes a structure it does not say anything about how the structure can be used for example a blueprint can be used to build somebody’s home or the same blueprint can be used to build an office. The purposes the buildings serve are different, but the structure of the buildings remains the same. The relationship between classes and software objects is very similar, in that one object instantiated from class can serve a certain purpose and another object instantiated from the same class can serve a different purpose, but because both objects are instantiated from the same class the context in which they are used will tend to have similarities.

No comments on ‘The Blueprint Analogy’

Leave a Reply