So I am working with page layout components: Page.DisplayHeader() Page.DisplayFooter()
I have an Abstract page that defines lots of default functionality for the page. Then I have several basic layout components such as SingleColumnPage and TwoColumnPage which both extend AbstractPage. Then, I had individual section pages which extend the appropriate type (ex. AboutUsPage extends TwoColumnPage). The issue was about half way though this process I realized that I needed to pass in my SecurityController and the User instance to the page Init() method to figure out which parts of the global layout would be accessible (based on permissions). The problem was that originally I was doing this sort sort of IoC via Init() argument passing. However, with this new change, I would have to go to all the sub component to change the arguments of all overridden Init() methods. To remedy this, I change my dependency injection strategry to use Setter() methods as opposed to Init() arguments. This way, all the sub class Init methods can just set specific variables and the SUPER class funcitonality can change dependencies via Setter(). In this case, the Setter() method just seems much more flexible. Of course, if I really knew what I was doing, I wouldn't have dependency changes half way through the process - but hey, I am still learning :) So, any comments or suggestions? Blatent mistakes? Thanks, Ben ...................... Ben Nadel Web Developer Nylon Technology 350 7th Ave. Suite 1005 New York, NY 10001 212.691.1134 x 14 212.691.3477 fax www.nylontechnology.com Sanders: Lightspeed too slow? Helmet: Yes we'll have to go right to ludacris speed. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
