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 ... 8 9 [10]
 on: March 04, 2015, 02:38:44  
Started by dkarten - Last post by dkarten
Hi, thanks for your reply. I understand that PureMVC is hugely flexible, I guess I just see more examples with XML databases, that's all.

For the design problem, I've reached two diverging paths. In one path, we use data access objects. There is a top level data access object which implements database read and write functions, (so select, insert, update, and delete). Then specific DAOs would extend this abstract DAO and override the r/w call with reference to the specific table. Ex: DataAccessObject has an update method, which takes table name, update parameters, and a where query to match the update with. Then CustomerDAO extends DataAccessObject and it's update function returns the super's update function with proper parameters filled in
public function update(params:Object):Promise {
    return super.update("customer", params, "customer_id=:id", {id:uid});
This assumes every DAO has a uid property which references its SQL primary key. If we keep all database operations in the DatabaseProxy, then we have to write cases for every VO/DAO pair we will be working with. Finally the DatabaseProxy would be tasked with responding to the promises and updating the corresponding vo in memory.

The second path, which I am leaning more towards, is not to implement a DAO pattern, but rather have the DatabaseProxy act as the top level DAO with abstract read/write functions. Then specific proxies would extend the DatabaseProxy with specific behavior. Does this violate the idea of isolating all DB interaction to the DatabaseProxy? This design seems better to me, because it still isolates the database dependency to the DatabaseProxy. Changing to a different style of database would require only rewriting the r/w functions in the DatabaseProxy. It also allows me to take advantage of a Proxy's data property. As an example if we had a database of books and publishers, these would likely be two different SQL tables. There would be a BooksProxy and a PublishersProxy. When the BooksProxy is instantiated, it would retrieve all books in the table and store them as an Array or ArrayCollection in the data property. Similarly for the PublishersProxy. Then adds, updates, and deletes would be saved to the DB and tracked in memory. This makes passing data to the view with a mediator much easier.

There's probably no right or wrong way to do this, but I appreciate all the input!

 on: March 03, 2015, 10:11:52  
Started by dkarten - Last post by puremvc
Hi there,

The XMLDatabase is just one utility, it doesn't mean PureMVC is necessarily geared more toward that than SQL. It just means there isn't a utility as of yet. Your idea of a DatabaseProxy is right. DAOs typically don't store data, so I'm not sure about the need for a factory. The data ends up in a VO. A DAO is equivalent to a Delegate on the client side. The DatabaseProxy would be the business object in the pattern: http://www.oracle.com/technetwork/java/dataaccessobject-138824.html

The SQLRunner instance as well as the VOs (or TOs - Transfer Objects if you like) would be maintained as well by the DatabaseProxy. No other actor should be fiddling with it, and should go through the DatabaseProxy for operations. The Proxy should hide ALL of the DB stuff from the app and provide methods for accessing VOs and updating them. Internally it would use the DAOs to reflect those operations on the database.

 on: February 26, 2015, 07:53:15  
Started by dkarten - Last post by dkarten
I'm trying to refactor an existing project into PureMVC. This is an Adobe AIR desktop app taking advantage of the SQLite library included with AIR and building upon it with a few other libraries:

I made my current implementation of the database similar to the websql-js (http://websql-js.googlecode.com/hg/docs/websql.html) promise based SQL access layer and it works pretty well, however I am struggling to see how it can work in PureMVC. The async SQLite library linked above uses a "SQLRunner" which maintains a pool of connections which it opens and closes as necessary.

Currently, I have my VOs that will be paired with DAOs (data access objects) for database access. Where I'm stuck is how to track the dbFile and sqlRunner instances across the entire program. The DAOs will need to know about the sqlRunner, or at the very least, the dbFile. Should the sqlRunner be treated as singleton-esque? Or created for every database query?

Finally, how do I expose the dbFile or sqlRunner to the DAOs? In my head right now I see keeping these in a DatabaseProxy that would be exposed to other proxies, and instantiate DAOs when needed. What about a DAO factory pattern?

I know from some reading and research that Cliff/PureMVC is geared to an XML database and there area already existing utilities for that, but it is too much of a refactor to move from the existing SQLite to XML.

I'm very new to PureMVC but I really like the structure and separation of roles. Please don't hesitate to tell me if this implementation simply will not work.

 on: January 09, 2015, 05:35:59  
Started by turtlebite - Last post by turtlebite
The main reason I decided to go with PureMVC many years ago was exactly what you describe, Cliff, I was fed up with staying up to date with all the new frameworks popping up when in the end they are not better, only different. I guess it also has to do with age, if you have been coding for some years and had the "pleasure" of refactoring your own old code bases, you get to like the value of something stable like PureMVC.
And what simply no other framework can offer is the fact that you can port the architecture to another language painlessly, which helped me tremendously!

I really like the forums here, I believe it would not need much to improve the website itself, maybe just keep the frontpage a little bit more up to date... ;-)

 on: January 09, 2015, 04:47:03  
Started by turtlebite - Last post by philipSe
I'm still a user of PureMVC.

Cliff says "But it is solid, works as advertised, and will not be forcing you to change your code because we decided that there was a better way to do things and we'd better throw everything out and start over with a new grand plan."

Exactly, Bravo!


 on: January 08, 2015, 09:56:35  
Started by turtlebite - Last post by puremvc
Hi there, turtlebite,

The Swift port is not 100% yet, but will be brought into the fold as soon as it is. Saad Shams is actually working on that project as well and has ports of StateMachine and Pipes on the way.

I realize PureMVC isn't burning up the world like frameworks such as Angular (which have massively funded teams behind them and continually reinvent what they are). But it is solid, works as advertised, and will not be forcing you to change your code because we decided that there was a better way to do things and we'd better throw everything out and start over with a new grand plan.

Unlike other frameworks which try to include everything and the kitchen sink, PureMVC is tightly-focused, so it's not continually changing, and thus generating news about the latest features, etc. As someone who was tired of being jerked around by the continual need to upgrade and change as a result of dependencies, I valued the goal of defining a clear scope, reaching stability, and freezing it, over trying to include everything, and therefore never getting it quite right and having to tinker and drag devs along with me on the journey up one side of the mountain and down the other each year. In this, I was inspired by the great Java XML object model XOM http://www.xom.nu/ Since 2002, it has just done the right thing, period. It hasn't exactly burned up the Java world, few people even know about it, but from the start it was always the best option, and continues to be today.
As for the PureMVC website, it would be great if it were redesigned, but the effort to incorporate the forums, where the bulk of our knowledge is housed is difficult, owing to the Simple Machines (not so simple) platform. If someone more talented than myself in the web design space were to offer, I'd gladly do everything I could to help.

And as to support, you ask a question, you almost always get an answer here, or find it already answered by some other thread. I'll admit that being a Flex coder, my personal focus has mostly been in that language, but most framework related questions are applicable across platforms, and the authors of the various ports are usually available for comment.

That said I'm more than open to suggestions that could be readily implemented that could help with the PR image :)

 on: January 08, 2015, 02:53:22  
Started by turtlebite - Last post by turtlebite
Hi all

I'm using PureMVC on a daily basis for projects in PHP, JAVA, AS3 and Javascript. I just love it for the fact that I can reuse my knowledge in all these languages. But more and more I'm having a really hard time convincing others that PureMVC is great. When they check the website here, it looks like it's slowly vanishing... The latest news is more than 2 years old... :-( It would be so nice to see that the PureMVC framework is still alive and kicking. Why don't I see news like the Swift port (https://github.com/mittenimraum/puremvc-swift-standard-framework) on the frontpage? Does anyone have the time to redesign this puremvc.org website and let it shine again? Or do I have to face the fact that it is not supported any longer? Maybe I'm the only one using it these days??

What's your opinion?

 on: December 10, 2014, 09:27:53  
Started by saad - Last post by saad
Generated File Templates for PureMVC actors for different IDE's.


 on: November 19, 2014, 08:38:22  
Started by saad - Last post by puremvc
Good luck. I think you're on the right track now.

 on: November 18, 2014, 10:11:46  
Started by saad - Last post by saad
great, so I'd let it enter the core instead of redirecting from there (I believe the shortcut-redirection in JunctionMediator was leading to this problem), and let the core decide in a command to send it to the auth core. Thanks.

Pages: 1 ... 8 9 [10]