M320:Ch 3: Attribute Pattern is orthogonal to Polymorhpism

What does orthogonal mean in this context?
I know that its root is “at right angles” so height, width and length are said to be orthogonal to each other and are clearly attributes of an object that exist independently of one another while serving to describe the size of the whole.
Polymorphism in computer-land enables the ability to process different types of similar object through a single interface. So it appears to me that the Attribute pattern enables Polymorphism in mongoDB rather than being something at right angles to it.

Hi @Neil_01783,

Note sure if I understand your query. But here is what I found helpful in understanding the meaning of “orthogonal” in patterns:


Thankyou for the response.

Unfortunately I am not familiar with the Scala programming language, but to me, when the linked article says: ‘The term "orthogonal” refers to a pattern that selected class attributes are taken out from the base class to form an independent typeclass.’ that sounds to me like it is describing polymorphism. Further, maybe because I do not understand Scala, the assertion: ‘It’s being constructed “orthogonally” in a designated typeclass’ leaves me none the wiser.

Of course, I can still appreciate mongoDB without understanding what orthogonal means.
Thanks again for this and other contributions.

Hi @Neil_01783,

Please find below explanation from our team of experts:

So the Polymorphic pattern is used for documents with a similar, but not identical structure. The Attribute pattern is used where:

  1. there is a subset of fields we want to query the document on
  2. Or the fields we want to query on exist only in a subset of documents
    Or Both 1&2.

This means that while they might have a degree of overlap that are dealing with different concerns or working towards different goals. Typically, that’s how you would frame orthogonal with relation to those two patterns.
In the context of a use case like a product catalog you might use both patterns when you design your schema. Bringing that back to orthogonal, whilst both patterns have an impact on the document and on the schema together they will likely improve performance for a use case like a product catalog.

Multiple patterns can be used together within a schema. This composition of patterns, each of which may have different goals or support slightly different aspects for a query but where all of the patterns can be combined to support the query requirements for an application.

I hope this helps. :slight_smile:


Thank you Kanika for providing this expert explanation. I learn from this that orthogonal can refer to the interaction of different methods working in a complimentary fashion to achieve an overall goal.

1 Like