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 / Public Demos, Tools and Applications / Re: Flex client and Google App Engine server on: August 23, 2008, 10:39:46
Thanks for the support, Cliff. I hope my example can help other people.
2  Announcements and General Discussion / Public Demos, Tools and Applications / Flex client and Google App Engine server on: August 23, 2008, 08:47:38
I've published a sample application that shows how a Flex client can use a Python service hosted in Google App Engine to create, read, update and delete objects. The Flex application is built with PureMVC.

I hope it can help people learning these tools and techniques. Also, feedback on how to do things better is most welcome.

The source code is hosted on github so anyone can easily fork it. I also authorize it to be included in the PureMVC samples area if it is deemed good enough for this.

More information here:

3  Announcements and General Discussion / Getting Started / Sample project with Google App Engine on: August 13, 2008, 05:53:23
I've been working for some time on a sample application with a Flex client and a Google App Engine service. It is based on a PureMVC example, but with many modifications.

This sample application is able to show, create, edit and delete projects and also project participants.

Although I still plan to improve it to learn about other approaches, it is already working and maybe it can help others learn about PureMVC, Flex, Python, GAE or PyAMF.

The source code is hosted on github:

I've also been publishing several articles describing the approach I am taking:

I hope this helps. Feedback is welcome.
4  Announcements and General Discussion / Getting Started / Re: Learning application documented and published on: July 31, 2008, 08:29:28
I took some time to look again at the Python GAE Blog demo. I'm not sure if my CRUD service is complex enough that it would benefit from PyAMF. This is my current structure:

The view (boundary) is mostly handled by the PyAMF library. My view code is this:

services = {
    'EchoService': EchoService.EchoService,
    'ProjectService': ProjectService.ProjectService,

def main():
    application = WSGIGateway(services)

This is my model code:

class Project(db.Model):
    code = db.IntegerProperty()
    name = db.StringProperty()
    department = db.IntegerProperty(default=0)
    created_at = db.DateTimeProperty(auto_now_add=True)
    modified_at = db.DateTimeProperty(auto_now=True)

This is the controller code for the Update command:

class ProjectService:
    def update(self, project):
        existing_project = Project.get(project._key)
        existing_project.name = project.name
        existing_project.department = int(project.department)
        return Project.get(project._key)

And that's it. To use PyAMF, that update() method would raise a notification, that would be handled by a command, that would use a proxy to retrieve the current VO and store the updated VO. It seems quite a lot of indirection for something I currently do in 5 lines of sequential code. And even that code could be generalized to a helper class and become a single line.

Maybe a more complex service could benefit from PyMVC. I will look into this when my service starts to handle more kinds of objects.
5  Announcements and General Discussion / Architecture / Re: The role of value objects on: July 31, 2008, 08:07:41
Andrew, I will use Python with PyAMF. I can happily use anonymous Object instances as DTOs. Or I could create DTO classes to use on the service requests. My post actually is asking if it is a good idea to tie the client-side view to a data structure that makes sense to the server but may not be the best one on the client.

And also I am confused by the talk about VOs being the preferred choice on PureMVC, but the example uses a Domain Object. Although it is named as a UserVO, it is not really a VO.
6  Announcements and General Discussion / Getting Started / Re: Learning application documented and published on: July 30, 2008, 06:02:43
Will the GAE Python service be done in PureMVC as well? It'd rock to have a PureMVC Client AND Server demo...

That would be something, wouldn't it?  ;D

Well, it might be. I can't really tell right now. That service is supposed to be quite simple, only exposing CRUD methods and returning the objects. Maybe it might benefit from two layers (view and model). The view might be the service interface, responsible for authentication, validation and data conversion, and the model might be responsible for communicating with GAE's data store. With one or two commands thrown in the middle for the odd server-side business logic. Maybe. I will think a little more about this when I get the client-side figured out.

Thank you for your support.
7  Announcements and General Discussion / Architecture / The role of value objects on: July 30, 2008, 05:56:13
I am really liking PureMVC a lot. It is clean, well thought-out and very flexible.

As I learn it, I still have some doubts about the role of Value Objects in its architecture. For instance, there is a post (http://forums.puremvc.org/index.php?topic=243.0) where Cliff says:

Value Objects should be just that, carriers for data. Proxies should generally have the methods that massage that data, translate it or simply expose it to the app.

The main reason for only having attributes on a value object is that it is intended for shuttling data across tiers of an application.

That includes across client and server tiers. When marshaling and unmarshaling an object into a transfer format like XML, you can only send values. The methods wont go, or necessarily even make sense on the other side.

OK... First of all, in the Employees example, the UserVO is not a pure Value Object in this sense. It has two methods: isValid() and givenName(). So it is more like a Domain Object, which seems to be benefic to the application.

Next, the quote describes a Value Object as a Data Transfer Object that should only contain data, not any behavior, and that will be shuttled between application layers, including between client and server.

Now, it seems I can easily use an anonymous object as a DTO between the client and the server. It also seems that the client application should not be too tied to the way the server represents the data. I would consider the DTO as a kind of calling protocol to the service, that could possibly require conversion to data types more adequate for a client application. Again, it seems odd that a view component would receive the same DTO that would be returned by a remote service.

Let me try to clarify my thoughts with an example.

A "Project" entity could have a "Manager" attribute. That could be represented by an integer key on the service. But on the client I would like it to be an instance of a Manager class, not just an integer. Or at least to have also the manager name, that I would retrieve from another proxy, so it would be easier to sort on grids by the manager's name.

I also could want my project objects to have a collection of milestones. In the service that would be represented by another DTO for the Milestone entity, that would probably have the integer ID of the project and a milestone name and due date. But I would like my client-side project object to have a collection of milestones.

I also could want to go full domain object on this, and have the client-side behavior associated to the project on the project object itself, like the sample does with the User object.

I've read the best practices document three times, read all the other documents I could find on this site, downloaded and browsed the examples, created my own sample application (http://fernandoacorreia.wordpress.com/2008/07/30/flex-client-using-puremvc/), read all articles I could find in blogs about PureMVC, but it is still not very clear to me how we can deal in PureMVC with a database-based scenario like I described (Managers <-> Projects <-> Milestones) and how we can have a client-side abstraction of this objects that is not too restricted by the service interface.

Actually I am not certain if this strategy of using a VO and putting the instance behavior on the proxy is a definite best practice on PureMVC or if it is just a convenience. That is, would I run into trouble if I decided to use anonymous objects as DTOs to the server, use domain objects with attributes and instance methods within the client and kept in the proxy only the methods common in the Repository pattern, like CRUD methods?

The only possible complication I can think of is that the view components would be able to call the methods on the domain objects and that could break the isolation. Then again, that's exactly what the Employees example does with the isValid() and givenName() methods of the User "Domain" object...  :o

Any help will be appreciated.
8  Announcements and General Discussion / Getting Started / Learning application documented and published on: July 30, 2008, 04:51:21
I am learning PureMVC and I hope to use it to build a Flex client that will talk to a Python service hosted on Google App Engine.

I am documenting the progress in my blog:


The source code of the application is published too.

This is not a full-blown example yet because it is a work in progress and I still have to learn a few best practices. If and when I get it done I will offer it to the samples gallery.

Feedback is most welcome. Specially, now I must consider how I will deal with a "has many" relationship: a project has many participants.
9  Announcements and General Discussion / Getting Started / Re: 10 tips for working with PureMVC on: July 23, 2008, 06:21:09
Jens Krause recently posted to his blog this useful list of tips:

Updating the English version URL:

Pages: [1]