Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
- root - util (This is the namespace for all non MVC related code. General framework classes for useful functionality) Pathfinding.as Collision.as Debug.as Math.as RenderUtils.as - mvc (This is the PureMVC application structure) - Main.as <- entry point - AppFacade.as - controller - startup InitCoreCommand.as InitDataCommand.as InitGameCommand.as LaunchGame.as StartupCommand.as - model - game GameProxy.as - world - vo (I have VOs for objects that tend to get passed across application boundaries) - entities EntityVO.as PlayerVO.as EnemyVO.as EntityProxy.as WorldProxy.as - util (Theses are utility classes that related to functionality not appropriate for MVC) EntityCollision.as EntityVisibility.as - view - components uiView.as UIMediator.as WorldMediator.as
The fact is libraries/utilities/helpers have a place in programming languages. They are a form of encapsulation, isolating an outside world from knowing about their innards, in a a reusable form.
From the perspective of PureMVC application design, I'd suggest putting those utilities into a separate library project and importing them into the project.
package org.puremvc.as3.multicore.utilities.*
You might start by simply creating separate util packages under each of the model, view, and controller packages in your app
Basically I'll keep all of the application itself in PureMVC, with any truly decoupled helper libraries separated out into their own SWC. Is this what you meant? If so, that's very natural, and standard, way to code. I feel much happier with that.
However, after hunting around, I've seen other examples of people putting a 'utilities' namespace under their project. One example is Renju I found here: http://www.emanueleferonato.com/2008/03/25/full-renju-game-with-source-code/. He has a utils folder as a sibling of his mode/view/controller folders, which just holds a couple of filters. This is an example of what I was talking about, in that these are small helpers, that don't live in the MVC pattern...Or... based on your initial feedback... Would you suggest, in this case, putting the utils folder under view, given they're view related filters anyway? If so, I could live with that.
VO: A small simple object, like money or a date range, whose equality isn't based on identity.
DTO: An object that carries data between processes in order to reduce the number of method calls.
MyMediator extends Mediator{ private var _crazyView:CrazyView; onEnterFrame():void { var ep:EntityProxy = EntityProxy(facade.retrieveProxy(EntityProxy.NAME)); var player:MyCrazyPacman = ep.getEntityByName("player"); var _crazyView.renderPlayer(player); // Or I could put all of this in a command, but feels like overkill to me given it's so specific to this mediator. }}
Further reading found more detail, but basically boiled down to VOs being small, mostly data-only, immutable structures;
So now we've got an encapsulated entity which is more than just data, it has its own personal brain (logic) too. So that means it's more than just a VO. Should it still be called a VO? e.g. MyCrazyPacman.as or MyCrazyPacmanVO.as ?