Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

| * |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Architecture / Logging inside of PureMVC - Where to place it? on: October 26, 2007, 07:40:03
I was wondering where the best place to put "logging" code would be inside of the PureMVC framework?  To clarify "logging", I mean a class that listens for events and then communicates with a remote server to log this event.  A good example is code that keeps track of user statistics (i.e. how many users performed a specific action inside of the app).


Since it involves data and communication with a remote server I thought a proxy would be a good place... but they can't receive notifications, so they're out.

A mediator could work, but it wouldn't be managing a view component so it seems to break the philosophy behind PureMVC.

Commands work but I'm running into some limitations there as well.  Since only a single command can be registered to a given notification, this requires me to place code inside of other commands that should be unrelated (i.e. if I wanted to "log" applicaiton startup, then I need to place code inside the command that currently initializes the components).  Also, since commands do not specify which notifications they want to respond to, that means placing more code in an unrelated class (typically ApplicatonFacade).  Yet another problem with commands is what happens if I wanted an additional logger that wanted to respond to the same Notification as another logger (i.e. if one wrote info to a db for archiving purposes, and another one wrote info to a db to compile usage statistics), then I would need to have a MacroCommand that called two separate SimpleCommands.... this makes maintainability an issue.


Any thoughts?


Thanks,

Mike
Pages: [1]