> methods I need related to logging in and logging out, maintaining user
> details, sending e-newsletters, listing users. Is there any advantage or
> disadvantage to having all those functions in one 'Users" cfc or is it
> better to have smaller, more specialised CFCs. Perhaps in this example a
> UserMaintenance CFC and another UserLogin CFC?
There are no hard and fast rules here (unfortunately) so the 'best'
solution will depend on your application. I would probably lean toward
several small CFCs, each doing a very specific job (cohesion) and
possibly having a UserManager CFC that coordinates how they interact.
I'd probably have a NewsLetter CFC which could be told to send itself
to a given user or if several things need to be emailed, maybe a
MailService that can be passed a target User CFC and something that
can be emailed (any CFC that supports renderAsText() and
renderAsHTML() perhaps).
But it's only worth doing all of that if your application needs it.
After all, if you go with fewer bigger CFCs for today's requirements,
you can always refactor into more smaller CFCs for tomorrow's
requirements. Your object design just needs to be going in roughly the
right direction, it doesn't need to be perfect from day one...
In fact, what tends to happen when I design and build stuff is that I
start out with some fairly coarse-grained objects and gradually refine
them into smaller clusters of objects either during the design or
during maintenance...
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

