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 [2]
16  Announcements and General Discussion / Architecture / Re: Call proxy from VO? on: August 06, 2011, 11:19:37
I would still question implementation...

 Car part should not care about car it is on in any way.

 We talk about data here..

 Lets say property of part changes. this is job of Proxy to alter it as Cliff mentioned. Lets say then part is changed Car data must be affected somehow... now we have 2 options :

 1 logic involved
 2 no logic.. just data.

if logic is needed... that's it.. it's work of command to care about it all.. it should set car data and car part data by using proxy on its own. If action needs some decision making - create command.

if no logic is involved.. but some arbitrary data must be altered... lets say car has weight, every part adds weight for the car... every time then proxy adds part to the car, it could recalculate car weight and just set it. Its data stuff. no logic is needed here.

 even arbitrary check like...

:
if(part[i].hasWeight){
     car.weight += part[i].weight
}

is ok here.. again - data stuff.


in any case.... part is just a part... it should hold part data and should be ignorant on whatever car... shelf... trash-bin it is placed in.

rethink your OOP architecture.


PS : it's the same thing with view, the only difference is that view car-part might be active object, not like car-part data object. And as active object this object can do stuff on its own sometimes. Still it should be ignorant about car it is in' and should send event to talk about jobs it does. If it is in the car... car will be affected by this event somehow. Lets say... radar installed in the car can send signal about police post in front.
 Meanwhile in lot of cases this car-part can't do stuff on its own... lets say... wheel can't spin on its own. Car must spin them, in this cases car should manage its parts and use them.

 Think OOP - it will lead you to most intuitive implementation and in almost all cases - proper architecture.

Have fun.
17  Announcements and General Discussion / Architecture / Persistent commands? on: August 06, 2011, 10:04:55
Hi,

 If I understand correctly - commands are created then they respond to notification, and garbage collected after job is done. Both actions are expensive.

 as long as you read and listen to what everybody tells : commands must be stateless! there should not be a problem to create command once, and keep it in memory for future uses.

 Also keeping one object with execute instruction in memory should not be a problem. It will take couple of bytes.. not more.

 Object creation and destruction could be avoided?

 Apart of danger of creating the state and fail with it, is there any other problems?



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


while I am at it... :) do you think this command is valid, I mean.. it kind of... sort of.. has a state for very short time until file is selected and ether fails or is loaded. (state in dynamic memory... but still)

:
package com.mindscriptact.mapExplorer.controller.fileHandling {

public class LoadZoneFileCommand extends SimpleCommand {

override public function execute(note:INotification):void {
var fileReference:FileReference = new FileReference();
fileReference.browse([new FileFilter("map3d.xml Files", "*.xml")]);
fileReference.addEventListener(Event.SELECT, handleFileSelect);
}

private function handleFileSelect(event:Event):void {
var fileReference:FileReference = event.currentTarget as FileReference;
fileReference.removeEventListener(Event.SELECT, handleFileSelect);
//
fileReference.addEventListener(Event.COMPLETE, handleFileLoadComplete);
fileReference.addEventListener(IOErrorEvent.IO_ERROR, handleIOError);
//
fileReference.load();
}

private function handleFileLoadComplete(event:Event):void {
var fileReference:FileReference = event.currentTarget as FileReference;
fileReference.removeEventListener(Event.COMPLETE, handleFileLoadComplete);
fileReference.removeEventListener(IOErrorEvent.IO_ERROR, handleIOError);

sendNotification(Note.PARSE_MAP_DATA, fileReference.data);
}

private function handleIOError(event:IOErrorEvent):void {
var fileReference:FileReference = event.currentTarget as FileReference;
fileReference.removeEventListener(Event.COMPLETE, handleFileLoadComplete);
fileReference.removeEventListener(IOErrorEvent.IO_ERROR, handleIOError);

sendNotification(Note.ERROR_REPORT, " ERRROR: file error " + fileReference.name + " " + event.text);
}

}
}

 would you implement it differently?


Thanks for time.
18  Announcements and General Discussion / Architecture / Why getData() and getViewComponent() exists? on: August 06, 2011, 09:44:22
Hi,

 I am looking to these Proxy and Mediator functions, and don't understand why they are there.

It looks like they should not be there at all... here is my reasoning:

Job of the Proxy - hide and represent data stuff.
Job of the Mediator - hide and represent view stuff.

 Then we create those we want to hide all access to them, and don't let anyone touch it.

 Now then you send data object is super constructor (or view) you automatically create 2 problems, that has no reason (I know of) to exist.

1 - you need to cast it.
 (why not just store in your custom proxy as variable and leave it at it?)

2 - you expose your data(or view) to any actor in application, then in fact you want to do opposite - hide it as much as possible in most cases.
 (in rare cases you actually need to get full data or view, but why not hide it by default, and just create getter function to return data(or view) then you need it?)

 What am I missing?

Thanks for your time.

PS : I guess that this little functions create extra confusion for PureMVC beginners, you start looking for deep meanings that doesn't exists, thinking why you should pass you data to super class.. and create that casting functions.. but without good knowledge of Framework you afraid not to...
19  Announcements and General Discussion / Architecture / Re: There can I find details on Proxy patterns? on: August 02, 2011, 03:35:17
So... these patterns are situational... and has little to do with PureMVC directly. With idea that you just put whatever is needed for your data juggling behind the proxy.

 Thank you for details.
20  Announcements and General Discussion / General Discussion / Re: why german translation? give us "getting started" instead! on: May 19, 2008, 02:31:10
Thanks for honest answer...
 If I find this framework usefull.. I might even write getting started tutorial myself..
but I need to spend more time better understand it myself.. :) This process a bit painful.. ( I understand why so much of my friends give up so easily on PureMVC..)

 Good luck.
21  Announcements and General Discussion / General Discussion / why german translation? give us "getting started" instead! on: May 13, 2008, 12:48:04
Hi... just a quick question...

 whats the point of translating "best practices" if it is poorly usable.?!

 All we need at this point is - good detailed getting started guide.
I am flash developer for 7 years and I find learning pure MVC very time consuming... its a mix of "best practices"/core class exploration/reverse engineering...

 thats not the way one should be learning... :( I usually just read documentation and write code from it.. but as Pure MVC has some complexities. I need nice tutorial.. and I cant find one..
Pages: 1 [2]