First, some background:
Keith just recently changed our can’t-mock-dis Startup service from a plain ol’ Singleton (in the Gang-of-Four sense, not in the Spring sense) to an Abstract Factory so that — woohoo! — we can now mock out the Startup service and its application-context-creatin’ slowness when we want to.
This gives us such great flexibility in the testing department, and the cost is a slightly wordier syntax when you’re getting an instance of the real StartupSvc. This syntax changed from:
StartupSvc startupSvc = StartupSvc.getStartupSvc();
StartupSvc startupSvc = new StartupSvcFactoryImpl().getStartupSvc();
But these calls aren’t littered throughout the application code — it’s kicked off by ServletContextListeners and such — so there are really only a few places that even have to change. It’s great!
A Happy Move
So anyway, earlier this week when Keith committed his changes, I had eventually Maven Eclipsed a couple of prototype .war projects I was working on and noticed that I needed to update to the new syntax for getting an instance of the StartupSvc. I was glad to see that the abstract factory stuff had been committed.
But then today, I Maven Eclipsed again, and now Eclipse was saying it didn’t know what a StartupSvcFactoryImpl was and trying to get me to return to the old syntax.
It appeared that Keith had reverted his changes and removed the abstract factory. Had he encountered a nasty problem and reverted it until we could figure out a solution? I didn’t want to go back to the old way! Why didn’t he tell me?! (This last one was a bit hypocritical on my part, since I’m not very good yet myself at noticing when my changes are breaking changes that will affect others on the project and notifying them accordingly.)
Then I realized that, oops, hadn’t I just Maven Install’d the Startup module (with a minor change I needed to test with on my other project) to my local Maven repository from my local working copy? And how long had it been since I had updated the source code of that project?
Oopsy oops, I had just made the StartupSvc revert, by installing an older version. I just updated the Startup project from Subversion, then Maven Installed it again, then Maven Eclipsed my .war prototype… and the abstract factory is back.
Silly me! :)