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 [3]
31  Announcements and General Discussion / Getting Started / Re: Using the ApplicationFacade when sending notifications of events? on: May 01, 2009, 05:56:28
Ok I have got a mini application (my first using pmvc) running- but it isnt really leveraging the framework yet other than it starts up at a basic level.

Its a simple addition calculator that adds two text field together when you click "do sum"

And it looks like this so far

facade(kind of like old skool frame1, some stuff happening here)
model: (yet to make)
view:StageMediator
controller:StartUpCommand and DoSum

That's all so far. I have my view elements created in StageMediator at the moment and not really separated into views though I'm using composite classes for text fields and simple buttons.

Flow of the application

I have Main.as as a document level class which is getting the facade going by passing in a refference to the stage...
The facade upon startup launches StartUpCommand

StartUpCommand :Then registers and creates the StageMediator and builds the view elements into itself.

StageMediator:Actions - handlers exist in this Mediator (viewish thing) and I could even do the application logic here- was before I moved it into DoSum (a command) .

My question is with regular MVC I should perform the calculation in the model, so I guess I create one (or do i create a proxy instead) and do the calculation there. And then update the result in the view.

Bigger question - what is the correct way in pseudo code to do the communication.

In the view I have the two values in the text fields that I place into and object and I send that object to my doSum command with sendNotification(LandedFacade.DO_SUM,obj);

In the execute method of DoSum I get the values as obj... or does the frame work allow me to pass this object straight to the model (I thought the facade allows me to do this). This is what im still unclear about. But currently im trying to send it to the DoSum controller then that sends it to the model for actually doing the sum ??? Its this extra chain of responsibility that is the decoupling of MVC.

I would love to get help on understanding this last paragraph in the context of this very simple application. Thanks

 
32  Announcements and General Discussion / Getting Started / registering first then sending.... on: April 29, 2009, 04:40:25
I post this question within this thread as it seems appropriate

I have in my concrete facade the following 2 lines separated however

:
registerCommand( STARTUP, StartupCommand );
       
sendNotification( STARTUP,stage);


So indeed when we sendNotification in this case the class StartupCommand class has its 'execute' method involked ? (execute being a necessary method for the Interface)

So if I want to communicate from no matter where to no matter what I can use this way. The above comes from an Ifacade. I just would like to know how to communicate for example from mediator a to mediator b... (mediator is like a view and should only really be concerned with displaying its self correctly so bad example ?) what about communication between a model proxy e.g. (as some business logic has been done) to mediator a - where we want to see this data visually.

thanks for following
33  Announcements and General Discussion / General Discussion / Re: Observations and a Question on: April 28, 2009, 10:20:04
Thanks cliff yes im getting there, it looks simpler than it indeed sounds as I was reading, if I for example assume that mediators are kinds of views and proxies are sort of models then we almost have halved my confusion already. I will hope to clear the air as a noob sees things sometimes its good to write from this perspective, it may help some people but I will do that when I do indeed have a fuller understanding so as for the partial sighted leading the blind...
34  Announcements and General Discussion / Getting Started / run into first errors on: April 27, 2009, 12:30:42
I have tried to start off on the right foot with my facade. It is failing and I would like to work out the next step. It kicks off as the compiler errors have been commented out

I have
:
package at.landed
{

import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.patterns.facade.*;
//import at.landed.view.*;
//import at.landed.model.*;
//import at.landed.controller.*;
// A concrete Facade for MyApp
public class LandedFacade extends Facade implements IFacade
{
// Define Notification name constants
public static const STARTUP:String = "startup";
public static const LOGIN:String = "login";
// Singleton LandedFacade Factory Method
public static function getInstance() : LandedFacade
{
if ( instance == null ) instance = new LandedFacade( );
return instance as LandedFacade;
}
// Register Commands with the Controller
override protected function initializeController( ) : void
{
super.initializeController();
//registerCommand( STARTUP, StartupCommand );
//registerCommand( LOGIN, LoginCommand );
//registerCommand( LoginProxy.LOGIN_SUCCESS, GetPrefsCommand );
}
// Startup the PureMVC apparatus, passing in a reference to the application
public function startup( app:MyAp ) : void
{
sendNotification( STARTUP, app );
}
}
}

so for example StartupCommand is undefined and I dont have any views models or controllers created yet in my application.

Do I just create a view for example, but what should it extend etc...there seems to be little documentation on this kind of thing, once I get started I will be ok. I would like just a simple view say a button which when I click does a sum in the model via a dispatched command. and the view updates by showing something.

What is the next step.thanks
35  Announcements and General Discussion / General Discussion / Observations and a Question on: April 27, 2009, 06:09:52
I have possibly recently at last got to grips very well with (as I have used MVC for some time) the concept of MVC. So I start to look at your framework in the context of actionscript.

You use the term 'pure' yet it seems that this variation of the pattern is less clean and more complex. I will give my reasons why as a possitive Criticism of at least the Documentation.

You introduce a 4th top level class - Singleton called Facade (I understand that it is supposed to simplify things however so await to try it out but it seems I can do everything here (going against the idea of modularity facade=frame1 stick all my code here type of thing)  and undermines the strict chain of command and decoupling that MVC originally set out to do)

You introduce Proxies to the model (I suppose to encapsulate the model further- I always when using proxies think its an unnecessary step on many occasions too far - too many wrappers).

You Introduce mediators as a part of the view which itself is a Singleton, I assume the main view is a singleton but obviously there is a need for multiple view classes, so then are there each time a view its a Singleton ? Perhaps I need a view not to be a Singleton. For me I could understand the top level view being a Singleton but I don't like views being Singletons for no good reason. And back to Mediators they seem like views to me ? Confusion here. Events dispatching would be done from the views to the controller traditionally and I can understand this. Are views Abstract mediators ? So the concrete is the mediator and the abstract the view and in fact then a mediator is just another view or nested view ?

Can you see how a beginner to patterns is getting lost here. I hope so this is mostly what I want the point of this post to be. As I'm sure this is a great framework and there are benefits, just that the documentation is a bit well confusing.

e.g. You state that with Commands and the Controller "They are the home of your application’s Business Logic." well I thought and was comfortable knowing that (in MVC) the business logic is with the Model and ONLY here ! I would like an answer to this.

You are using the "ç" character in the code examples given in façade is this good practise ? I cant type it quickly and will myself substitute it.

It is just stuff stopping me from trying out the framework.

http://calvincrane.com

 ???
36  Announcements and General Discussion / Getting Started / Re: flashdevelop and puremvc on: March 23, 2009, 05:32:41
yes that sounds about right to me, what if I were publishing using CS3 or 4 ?  I guess we just instantiate the main class you were talking about and there we go.

Im just wondering if we are not talking flex which is the class to instantiatewhich kicks it all off.
thanks

ps im not getting email notification of replies for this forum so far...
37  Announcements and General Discussion / Getting Started / flashdevelop and puremvc on: March 20, 2009, 10:52:24
I have a couple of initial questions

How can I start to use to try puremvc with flash develop and perhaps the flex sdk so as to keep open source ?

Normally I have to declare an entry point class in fd, no problem but what is it that I need to instantiate first.

I would secondly like to know how to start using flash cs3 and having assets in the library.

thanks in adv.
Pages: 1 2 [3]