PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: jerry on October 31, 2008, 08:33:39



Title: AppSkeleton not conform FAQ?
Post by: jerry on October 31, 2008, 08:33:39
I am starting a new test project to get the feel how PureMVC is working in a development environment.

So I was reading the FAQ particular this article ( http://puremvc.org/content/view/93/188/ )
It is stating:
Therefore, the Model tier (Proxies) should not reference anything specific to your Controller/View tiers or your ApplicationFacade/ApplicationConstants.

While the ApplicationSkeleton Demo is doing that inside the ConfigProxy, LocaleProxy and the StartupMonitorProxy.



Title: Re: AppSkeleton not conform FAQ?
Post by: puremvc on November 02, 2008, 05:25:46
True, it does this and shouldn't. This was pointed out and I thought the author was fixing it, but I haven't heard back on that in awhile so I'll ping him again about it.

Thanks and good catch!

-=Cliff>


Title: Re: AppSkeleton not conform FAQ?
Post by: Joel Hooks on November 06, 2008, 10:24:05
Proxies shouldn't access ApplicationFacade constants?


Title: Re: AppSkeleton not conform FAQ?
Post by: puremvc on November 06, 2008, 04:46:41
@joel, No, they shouldn't. Think of the Model as the crown jewels of your app. If the Model is free of any coupling to your application, then you can use it in another application.

This is a particularly important thing to keep in mind with Flex and Air. A common model could be reused in both, but the use cases of the actual apps might be quite different.

It is the reason in life for the View and Controller tiers to present and expose ways for the user to update the Model.

The Model should not be concerned with the business of the other two tiers or to the concrete Facade which is also specific to the application.

-=Cliff>


Title: Re: AppSkeleton not conform FAQ?
Post by: Joel Hooks on November 07, 2008, 07:25:37
It makes sense now that I think about, but makes me sad because everything I have written violates this principle ;)

Now where did I put my "can't talk refactoring" hat...


Title: Re: AppSkeleton not conform FAQ?
Post by: puremvc on November 07, 2008, 07:49:02
Well, its not really such a big deal, and something that is easy to refactor should you ever need to reuse your model elsewhere.

-=Cliff>


Title: Re: AppSkeleton not conform FAQ?
Post by: Jason MacDonald on November 07, 2008, 07:56:52
It makes sense now that I think about, but makes me sad because everything I have written violates this principle ;)

Now where did I put my "can't talk refactoring" hat...

I have to admit that I break this rule too. I use Constants from my App definition all over my proxy's for notifications :(


Title: Re: AppSkeleton not conform FAQ?
Post by: marek on November 07, 2008, 08:14:25
interesting...


Title: Re: AppSkeleton not conform FAQ?
Post by: danieleUg on November 10, 2008, 06:33:16
Hi jerry,
good catch!
I will commit the fixed version in the next days.

@Cliff: About the use of constant in Proxy we have to stick the FAQ, but I found usefull to define the notification constants in the proxy for a couple of reason:

- if the proxy can used in more projects, I have to move less files, in the case of ConfigProxy I must to move only this file. Otherwise if I have more proxies that are reused in differents projects, for each proxy I have 2 classes: one for the proxy and one for the constants.

- if the notification is send only from proxy and the other tiers listen it, I found convenience to define in the  proxy this will help me to understand the notification role, if is defined in ConfigProxy I know that is something about Config. I found it usefull when I work in a team.

Best
  Daniele



Title: Re: AppSkeleton not conform FAQ?
Post by: puremvc on November 10, 2008, 07:15:16
@Daniele,

Defining constants in the Proxy is good. Using them in the Proxy if they have been defined in the ApplicationFacade is bad, because it makes ties the Proxy to that application. Or it must be defined in the ApplicationFacade of the app you reuse it in. So the logical place for any constant related to a given Proxy is in the Proxy itself.

-=Cliff>