First page Back Continue Last page Overview Graphics

Analogy Patterns in Software Attribute Only [Map]

Map exchangeCountry = new HashMap();

exchangeCountry.put("CBOT","US");

exchangeCountry.put("LIFFE","England");

Na Aa Nv Av

Notes:

In this instance the analogy is a literal similarity between financial derivatives exchanges. Our purpose is such that we only need the country of the exchange (a single attribute).

The hashmap can be used to represent this analogy.

(pause)

Indeed a rule of thumb in identifying analogical structures in code is when you can guess what needs to be coded for an additional variety. for example if we knew that EUREX was a German exchange, the code is easy to guess.

It's important to emphasise here that this isn't a programming skill. Identifying similarities and the corresponding analogies is something we develop in our childhood.