1. 1

So I have a Registry object.

It gets born via a “new”, and then has a childhood during which things are “added” to it.

Once it is mature, it freeze’s into an adult that gets used for many things.

Often these use cases require the registry to be fully populated first.

For example, in my case, the objects added have dependency’s between them, but those dependencies are expressed as id’s which need to be looked up in the registry once it is fully populated.

What I’m noting here is, during this life cycle, not all methods are available all the time.

During it’s childhood, you can use the “add” method, but not the “adult” methods. Those just plain don’t work yet.

Once it is frozen into an adult, all the methods for which it was built become available…

… but the childhood “add” method doesn’t work.

It feels like there are two objects in there, with two different method sets.

It feels like there is an anti-pattern / pattern lurking down here.

Perhaps I should have two objects, and the transition to adulthood should pass the state that was built up during the childhood of the object to the new adult object of a different class.

Very much like a pupa.

  1.