Code review comment for lp://staging/~tintou/maya/calendar-model-static

Revision history for this message
Victor Martinez (victored) wrote :

This branch looks good.

I've noticed this was already merged into your "snapshot" branch, which is great by the way!

Every programmer has their on opinion on this topic, but singletons can be considered evil as they hide the actual dependencies of each class. They are good because they enforce a single instance, but that's usually not needed because creating additional instances would be pointless in most situations.

When a constructor looks like:
> public MyClassName (TypeA dependency_a, TypeB dependency_b)
it's explicitly declaring which external objects the class depends on (dependency_a and dependency_b).

Defining constructors this way also helps ensure objects are instantiated in the correct order, because their dependencies need to be instantiated before they can be constructed. Singletons usually eliminate this restriction and may lead to obscure class-instantiation bugs.

Of course this branch is not subject to that kind of bugs yet, and there are more good things on this branch besides Singletons.

« Back to merge proposal