UP walks into room and takes off surgeons mask...
I'm sorry, the cancer was too large and had spread throughout the whole application. The further we dug down into the components, the more singletons we saw, far more than preliminary test indicated. We weren't able to remove one without crippling the rest of the application since their interdependencies were so great, creating a sinister web of architectural pick-up sticks.
We administered 100cc of Mate, began Parsley therapy and flew in the best Swizologists in the region but to no avail. We have a grief counselor available to help you through this time on the Photoshop flo...
UP's beeper goes of
I'm sorry, looks like multiple applications have been involved in a PureMVCarousel crash. I have to go...
Hahahaha!!! Thanks for the laugh, unfortunate as my situation is... Yes, indeed there are a TON of Singletons, and trying to remove any of this stuff causes catastrophic failures. It's like a cancer indeed and spread far and wide.
This rather large application was developed by a team in the Fall 2009 / winter of 2010, shortly before Adobe abandoned Cairngorm 2, and during a time they were instead recommending it. I've had to update it with several patches, but moving forward I wanted to be able to use Flex 4 and the Spark components, however this is holding me back from upgrading.
So is the picture really that bleak? I guess this may be a massive undertaking to get it removed, may be easier to redo it entirely with a new MVC? Any suggestions?
1 person found this helpful
I would start by doing some sort of Hierarchical presentation model e.g. move the singleton's as up to the root app, e.g instead of having in view private someOhterProp:SomeOtherProp =model.getInsance().someProp.someOhterProp, have the parent pass someOtherProp in... So every component gets it's model data from it's parent. This will be a little bit ugly but once you get rid of the singletons inside view's you'll be a step closer.... Maybe you don't have the singleton inside view's which will be even better. You need to do it in steps and here Unit tests will help alot ... One you cleaned a view e.g the dependencies can be passed through setters you can put parsley to work e.g inject the dependency into the view, and cut the reference from the parent .... The move towards a componetized presentation model and have that model dispatch the cairngorm event. After this you can move towards parsely manage events ....
This is fairly generic, the whole idea is to do it in steps and most probably for quite sometimes you'll be running with both parsely and gairngorm ...
After you moved to Parsley start moving to flex 4, and swap components...
HTH in some way,
1 person found this helpful
OK, in case anyone else happens to stumble upon this, here is some of the progress I've been making on this as I have time. I've found an easy fix for 2 of the 3 issues:
Both of these classes are quite frankly empty classes, almost nothing in them at all. I was therefore able to create my own versions of these clases, based on what I saw here:
So, I just added a trimmed down version of those empty classes into a util folder in my classes, and changed the reference to that and bam, it works with no reference to cairngorm!! I was floored by how simple that was for the IValueObject and the IModelLocator. They all still work as expected and they're used all over the place.
The other issue however, the CairngormEvent is proving to be more troublesome, especially since I have a multitude of Events and Services tied into a cairngorm FrontController, and so I have a business folder chuck full of a lot of dependent delegates, other related folders with commands, and events. There are also CallBack events, etc. It's a big mess, and so I'm still working on that, will probably have to create an alternate dispatch system for the web service events and write in custom stuff for it. I did find this of great use when researching different ways to make web service calls through Flex without using MXML: http://blogs.4point.com/brad.white/2008/12/4-ways-to-invoke-a-webservice-in-flex-with-mxml -and-actionscript.html
So, hopefully that new info helps someone else stuck in this situation.