[COREVM-67] Use the factory pattern for creating dynamic objects

Employ the factory pattern to create dynamic objects.