Which is better for a model service?

I have a “core” service model that all service models should inherit. Which is a better choice. All services are singletons, technically including what the “core” service does. Which is better?

Extend all Services with the Core Service?
Inject the Core Service into all Services?

The former makes more sense so if that is the best option, I have to remove the singleton option from the component declaration right?

Mike Craig


I would say ask yourself the following:

If inheritance, is it an is a relationship or has a relationship? Does it provide a taxonomy of objects?


Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Of course…good question. These would be considered “is a” relationship so extending is the way to go.