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

Pages: [1]
Print
Author Topic: PureMVC is time-wasting code -NOT  (Read 8875 times)
earmountaina
Jr. Member
**
Posts: 14


View Profile WWW Email
« on: November 03, 2008, 12:19:42 »

Hi All,

In our company we use PureMVC for all our Flex projects and I strongly recommended it to a contract programming firm that I've hired to build a Flex application. This app has a call to a database when it fires up that hydrates some objects and then a call when it shuts down to update dirty objects otherwise it is mostly client side graphic object generation and movement. I'd like to hear what others here have to say about why they don't wish to follow my advice. Here is what they said:

There are two existing widely used Flex architecture frameworks:
- Cairngorn
- PureMVC
We choose to not use them guided by the following aspects:
- Both of them are very data-service oriented as they are designed to work with database CRUD functionallity applications. This is not the case as this is a document editing application.
- Have a poor Domain Model witch is based only on Value Objects (a DTO Flex renaming), all the domain logic must be on Controller Commands or in the server side data-service handler.
- They are centralistic. This means that they are designed to work at application level for the event flow. This may not be desiderable as application widgets may be separated later for the creation of the document viewer.
- Specifically PureMVC is designed to work "out" of ActionScript / Flex envirioment as it tries to be more general and be implemented on many other languages. As a downside it does not use the databinding capabilities of AS3, but using a Mediator object beetween the view and the model. This is just time-wasting code.
« Last Edit: November 07, 2008, 01:57:47 by earmountaina » Logged
earmountaina
Jr. Member
**
Posts: 14


View Profile WWW Email
« Reply #1 on: November 03, 2008, 02:13:42 »

Here is my response so far. It's meager given the accusations but I'm very busy. Comments are much appreciated:

- PureMVC is data-driven > I don't agree. MVC came out of Smalltalk; about as object oriented as a  programming language was ever designed to be non-data-driven. MVC decouples the view from the model. I think you are confusing data brokering with MVC. Data brokering decouples the business objects from their possible data sources.  We use WebORB and nHibernate to manage this side of the decoupling problem.

- Poor Domain Model > Again I disagree. I see nothing in the framework that enforces the use of VOs for all business objects. We use VO's for hydrating BOs and then based on security and client side performance issues we decide just how much more behavior we deploy to the client's well-formed BOs. Sometimes a VO is all that needed and then I'd agree that the application is somewhat data-driven. Although you can push all the domain logic of a BO into simple and complex Commands, you don't have to. We do and don't based on a balance between decoupling and encapsulation.

PureMVC has to admit to the complexity of web applications and therefore puts objects into the framework like the VO that can cause one to see it as data driven. I see the framework as data agnostic. After reading and re-reading the Best Practices, I modify the framework to meet my data brokering needs. If you look at the WebORB codegen of PureMVC AS code you will see their bias, but since they give you access to the XSLT you don't have to live with that bias.

- PureMVC is centralistic > I'm not sure what you mean by this.  I'll just need you to be more specific. In case you are talking about deploying the Flex through a browser or as an Adobe Air app, we see no reason to believe that PureMVC would cause a problem here.

- Out[side] of AS/Flex [event model] > I've seen a lot of bad object oriented code, but some of the worst has been written in Flex/AS right here in my company. This code bound the UI so tightly to the business objects that we had to abandon the code once we tried to expand it for a similar flex-editable product. Had that programmer worked within the PureMVC framework he may have had a fighting chance to see how to decouple the UI from the business objects. One of the things I like most about PureMVC is how richly and rigorously it deals with events. I'd suggest that you read page 13 of the PureMVC Best Practices or read this post by the author of PureMVC http://forums.puremvc.org/index.php?topic=60.0.

PureMVC, like WebORB is a powerful framework. It deserves a much hard look that you've obviously given it. Please read the Best Practices document. I'll be happy to give you a Flex/AS code base that uses the PureMVC, WebORB, nHibernate and nUnit. Please review this code and tell me how you think it could be improved by discarding PureMVC.

Thanks.

-- Mike
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: November 04, 2008, 06:07:24 »

I think you're holding your own in this argument, Mike.

Unfortunately its not possible to create a framework so perfect that everyone likes it. Different strokes, and all that.

PureMVC was designed to support any kind of model or no model at all. You can't say its 'data-driven', or rather, you could but it wouldn't be accurate or in fact mean anything. To call PureMVC notification- driven (or when used with Flex, Flash or AIR, event driven. Nothing happens until an event/notification like creationComplete/startup happens. Or a service returns a value. These boundary events necessarily cause data to flow around the app, but let's be clear about basic causaility. 

On the document editor, I have a hard time imagining one without a data model. What would it be good for, writing campaign speaches?

-=Cliff>
Logged
earmountaina
Jr. Member
**
Posts: 14


View Profile WWW Email
« Reply #3 on: November 04, 2008, 11:15:38 »

Cliff,

Campaign speech editor... that's one for the elastic compute cloud.

They are using PureMVC.

-- Mike
Logged
Pages: [1]
Print