What is metaphor technique in programming?

A metaphor is a literary technique where one thing is compared to another by stating they share the same qualities. Let me give you some examples:

When we think about STACK. What will we think ?

Yes, this will be a box that you put tennis ball inside or box of plates. This also describe the behavior of STACK concept: When we put a new ball or want to get a ball from stack that similar with Push and Pop in Stack.

You can see a same picture with Queue that we can metaphor it with Line of people.

A good metaphor is simple, relates well to other relevant metaphors, and explains much of the experimental evidence and other observed phenomena. A software metaphor is more like a searchlight than a road map. It doesn’t tell you where to find the answer; it tells you how to look for it. A metaphor serves more as a heuristic than it does as an algorithm(From Code Complete Book).

It domain driven design concept we have a thing call Ubiquitous language : is a model that acts as a universal language to help communication between software developers and domain experts. This metaphor technique can be a brilliant way that help each team can transfer their idea in easy way.

Sometime, without providing a same knowledge domain in property language, that can lead us to wrong target and build something that customer don’t need.

%d bloggers like this: