Name and reference objects. Not IDs

Written by mcsee | Published 2017/06/30
Tech Story Tags: programming | object-oriented-design | object-oriented | software-engineering | software-development

TLDRvia the TL;DR App

Name and reference objects. Not IDs

It’s the indirection, stupid !

Object Oriented Design Tip # 1

Tired of IDs

I_dentifiers are (almost) never present on the real world. So why should you build your models with them ?_

Objects can send messages to other objects only if they know them.

Knowledge can be accidental (temporary) or essential (strong).

Object1 knows essentially object2 and that relation must be named. And naming is very important when dealing with objects.

Role naming is extremely important.

Never qualify a relation exposing referenced object implementation.

object1 should not name the variable object2id.

Making such thing would imply a relational database implementation and thus mixing essential model specification with an accidental relational implementation.

Objects should know other objects, not ids !


Written by mcsee | I’m senior software engineer specialized in declarative designs and S.O.L.I.D. and Agile lover.
Published by HackerNoon on 2017/06/30