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 / General Discussion / Nested Mediator Typing on: January 14, 2009, 12:01:15
Hello all,

I am trying to figure out the best way to handle the grouping of mediators. For example, let's assume that we have a library with books, book chapters and book pages.

BookMediator_AtlasShrugged
ChapterMediator_1
ChapterMediator_2
PageMediator_1
PageMediator_2
BookMediator_AnarchistsCookbook
ChapterMediator_1
ChapterMediator_2
PageMediator_1
PageMediator_2

It seems that the only way to ensure that notifications are sent to the proper PageMediator is to have a naming schema established. Something like this:

"BookMediator_AtlasShrugged_ChapterMediator_1_PageMediator_1"

However, this requires that the name of any "parent" mediators be available to PageMediator when it is instantiated. I must be missing something here.

As an example, let's step through an "Add Page" command followed by a "Set Page Font" command with some psuedocode.

:

PageVO:
text:String = "It was the worst of times, it was the..."
FontVO:
font:String = "WingDing"

---------------------------------------

BookProxy.addPage(pageVO):
facade.sendNotification(ApplicationFacade.ADD_PAGE_CMD, pageVO)

AddPageCommand:
// HOW DO WE DETERMINE THE NAME TO GIVE TO THE MEDIATOR HERE?
facade.registerMediator(new PageMediator("BookMediator_AtlasShrugged_ChapterMediator_1_PageMediator_3"));

// HOW DO WE DETERMINE WHICH BOOK AND CHAPTER TO ADD THE PAGE TO HERE?
facade.sendNotification(ApplicationFacade.ADD_PAGE_VC, pageVO, "BookMediator_AtlasShrugged_ChapterMediator_1_PageMediator_3")

---------------------------------------

PageMediator.setPageFont(fontVO):
facade.sendNotification(ApplicationFacade.SET_PAGE_FONT_CMD, fontVO,  this.getMedatorName())

SetPageFontCommand:
// HOW DO WE DETERMINE WHICH PAGE TO SET THE FONT OF HERE?
facade.sendNotification(ApplicationFacade.SET_PAGE_VC_FONT, fontVO,  "BookMediator_AtlasShrugged_ChapterMediator_1_PageMediator_3")

---------------------------------------

What techniques is everyone using to deal with this sort of issue? Should I add the grouping information to the Value Objects? Should I be trying to retrieve the grouping info from a Proxy?

Thanks,
Derek Basch

2  Announcements and General Discussion / General Discussion / Notification types and commands on: January 14, 2009, 10:11:47
Hi all and Cliff,

I often need to have a command execute against specific mediators. Is it incorrect to use notification typing in a command?

:
public class AddAssetCommand extends SimpleCommand implements ICommand {

override public function execute( note:INotification ):void {

var newAssetVO:Asset = note.getBody() as Asset;

var mapInstanceUID:String;

// if we didn't get a map instance Id
// then use all the viewable maps
if (note.getType() != null) {
mapInstanceUID = note.getType();
} else {
var mapProxy:MapProxy = facade.retrieveProxy("MapProxy") as MapProxy;
for each (var mapItem in mapProxy.mapCollection) {
facade.sendNotification(ApplicationFacade.ADD_ASSET_CMD, newAssetVO, mapItem.mapUIComponent.map.name);
}
return;
}
3  Announcements and General Discussion / Architecture / Mediator to Proxy coupling on: March 14, 2008, 09:33:38
A quick question for everyone. There seem to be two ways for Mediators to interact with Proxies in PureMVC

1) A Mediator responds to a Notification and uses the body of the Notification within the Mediators view level logic.

2) A Mediator responds to a Notification and calls a public function of a Proxy. The functions return value is used within the Mediators view level logic.

Which is better? It seems to me that method #1 couples the view to the model pretty heavily. Is it simply up to the developer depending on the level of layer decoupling that is desired?

Thanks,
Derek Basch

4  Announcements and General Discussion / General Discussion / Proxy granularity on: March 12, 2008, 04:50:16
Is it good practice to have a Remote (asynchronous) Proxy manage a large Data Object and expose functions to manipulate that large Data Object?

Or, is it better to dynamically register new Remote Proxy Objects with the facade that manage a subset of that large Data Object?

For instance, say I have a large Data Object that represents all of the students in a classroom. Every student has their own large Data Object representing the scores of every test they have ever taken, their address, their favorite color, etc, etc... The teacher wants to be able to retrieve the Data Object for several students simultaneously.

Should every student have their own Student Remote Proxy Object instance that is created when they enter the classroom?

Or, should their be only one Classroom Remote Proxy that has a searchStudents() function?

Kind of a silly question but I would love to hear everyone's opinions.

Thanks,
Derek Basch
Pages: [1]