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] 2 3 ... 6
1  Announcements and General Discussion / General Discussion / Re: ActionScript Developers Guide to PureMVC on: December 29, 2011, 09:32:27
Youre welcome, Cliff :)
I agree, the encapsulation should be preserved.
I really should read the book before making any other changes.
It will take me a while though.

Cheers,
Ondina
2  Announcements and General Discussion / General Discussion / Re: ActionScript Developers Guide to PureMVC on: December 29, 2011, 09:22:41
Last changes: https://gist.github.com/1534767

In case the xml file for this story is empty or if the xml file doesnt exist storyStub.type is null
if (!storyStub.type)
   populateEmptyStory(storyStub);
What do you think? Better?
3  Announcements and General Discussion / General Discussion / Re: ActionScript Developers Guide to PureMVC on: December 29, 2011, 06:35:18
Thanks for the reassurance, Cliff!

Ok, I will post a review for the book, when Im done reading it.

The Bugs:

1.
RangeError: Error #1125: The index -1 is out of range 0.
at ...\StoryArchitect\src\com\futurescale\sa\controller\command\story\EditStoryCommand.as:42]

In Details/ItemInfo View: If you keep deleting all the items until just the parent (Story) remains, then you go on and save the changes, when you try to edit the story again it throws an error like the one above. 
Thats the case of a Simple Story, where a Scene is the direct descendant of a Story. story.scenes.length is 0, therefore story.scenes.length-1 is -1. And thats because the xml file contains no Scenes, just a Cast and a Milieu.

The same happens with a Normal and/or a Complex Story, but this time the arrays in question are story.chapters and story.parts, the first descendants of a Story that EditStoryCommand is trying to set.

- So my first workaround was concentrated on EditStoryCommand and I simply checked the length of the arrays and if it was 0 I added the missing parts to their parents.
For a Simple Story it would look like this:
if (story.scenes.length == 0)
{
scene=new SceneVO();
story.addScene(scene);
}
else
{
scene=story.scenes[story.scenes.length - 1];
}
Here the modified code for EditStoryCommand: https://gist.github.com/1524621

- Then I saw that StoryVO has these methods: getNewScene(),getNewChapter(),getNewPart() and I used them like this:
https://gist.github.com/1533524
It solves the problem, but it doesnt feel quite right.

When you create new stories the flow looks like this:
Simple
StoryVO.getNewScene()
SceneVO.getNewDraft()
SceneVO.addDraft(draft)
StoryVO.addScene(scene)

Normal
StoryVO.getNewChapter()
ChapterVO.getNewScene()
SceneVO.getNewDraft()
SceneVO.addDraft(draft)
ChapterVO.addScene(scene)
StoryVO.addChapter(chapter)

Complex
StoryVO.getNewPart()
PartVO.getNewChapter()
ChapterVO.getNewScene()
SceneVO.getNewDraft()
SceneVO.addDraft(draft)
ChapterVO.addScene(scene)
PartVO.addChapter(chapter)
StoryVO.addPart(part)

So it should be enough to call
scene=story.getNewScene();when story.scenes.length == 0  for a simple story,

chapter=story.getNewChapter (); when story.chapters.length == 0 for a normal story,

or part=story.getNewPart(); when story.parts.length == 0 for a complex story

like when you create a new Story.
But it doesnt work, and right now I cant see why. As I said, Im not familiar enough with the code yet, so I just modified EditStoryCommand to make it work .

Anyway, I think that I made the changes in the wrong class.
Maybe the real solution would be to prevent saving an empty Story in the first place?  Does it make sense to have a Story with no Scene or Chapter or Part, depending on the type of the Story?

I will investigate this chain:
ItemInfo.deleteItem()
DeleteItemCommand
StoryVO.deletePart
StoryTile.changeStorySelection(selection)
StoryTile.removeTiles()
StoryTile.createTiles()

to see what happens in the VOs after deleting an item.

Im sure there is a very simple and more elegant solution to this and Im curious to hear it from you.

2.
Then there were the following situations, which I cant reproduce anymore right now:
a. a totally empty XML file has been saved on the hard disk. If you try to edit it, a new Story, called Story 0, gets created and the xml file is empty. Now there are 2 empty stories, which cannot be deleted or edited (RTE)
Also in StoryProxy. loadStory() storyStub.uid is the id listed in index.xml while story.uid is different (a new uid). I dont understand the logic in there yet.
Quick and dirty solution(no idea if it wont produce other bugs elsewhere):
if (storyStub.uid == story.uid)
cacheProxy=new Proxy(story.uid, story);
else
cacheProxy=new Proxy(storyStub.uid, storyStub);

b. the story/index.xml contains stories that dont exist in that folder. Of course, when you try to load such a story it throws an error.
So my quick and dirty workaround was this:
AbstractProxy
private function readFile(file:File, voStub:ValueObject=null):XML
{
var stream:FileStream=new FileStream();
var xml:XML=new XML();
if (file.exists)
{
stream.open(file, FileMode.READ);
xml=XML(stream.readUTFBytes(stream.bytesAvailable));
stream.close();
}
return xml;
}
I think something goes wrong with the updating of the index file (synchronisation between the list of stories in the index and the files on disk) 

Im sorry that I cant provide more accurate info at this stage. I know that my solutions arent good, and they only show how limited my understanding of the code is, but at least youll have some hints at the vulnerable parts of the app.

Ondina
4  Announcements and General Discussion / General Discussion / ActionScript Developers Guide to PureMVC on: December 28, 2011, 08:16:48
I started reading the e-book a few days ago, and as I usually do with other books as well, I skipped the Preface, anxious to get to the core of the matter. But I was also curious to see how the application works and spent a lot of time going through the code, then running the app and clicking all the buttons before really knowing what they were supposed to do. This way I found a little bug and later a temporarily fix for it. Looking at the code, without reading the accompanying explanations from the book, allowed me to get an uninfluenced first impression: well structured (good hierarchy of packages), self explanatory variables, methods, classes, and packages names, helpful comments throughout the code.
I got a general idea of the responsibilities of the classes, and even though the code is pretty complex, I could identify the repeating behavioural patterns or the intended functionality.
 
I was glad that I found something not working as expected, because, in trying to find the bug, I got involved in the details of the code, which in turn, allowed me to better understand the logic behind some classes and methods and the relations/collaborations between them. I switched from a passive observer to an active investigator (err.. something like that)
Then, when I continued reading the book I was pleasantly surprised to find that each class discussed in the book was accompanied by a description of its responsibilities and collaborations! This way I could easily verify my understanding of the code. Im not done reading yet, but with every page in the book the haze keeps dispersing and the contours of the app are becoming increasingly clear. From what Ive seen so far in the book I like that the main focus is put on

a.   the boundaries of the application , domain logic and views
b.   the process of planning,  architecting the app, the steps described
c.   responsibilities and collaborations of a classes

Because of that it is an almost framework-independent approach, which is a really good thing, especially in the light of today's rapid changes in our world of software development or technology in general.


My initial intention was to share my opinions first after reading the entire book. But yesterday, when I wanted to continue reading it, instead of going to chapter 5, I started from the beginning, absent mindedly flipping through pages, and...well.. no one saw me, but Im sure that the huge surprise made me look utterly funny when I stumbled upon the mention under Collaborations!
First of all, I want to thank you, Cliff! I know it wasnt easy to decide who to put on that list or rather who to omit. I dont think that what I did or said in here could be considered as a contribution at all. There are others whove contributed more substantially to the framework or the community, so what I did was infinitesimally small in comparison with their work. Since yesterday Im having mixed feelings of joy and a kind of guilt at the same time, because I think I didnt really deserve to be mentioned.
So, to correct the situation let me put it in another light: in an open source project like this everyone is part of the project. Every single answer, every demo, example, shared code, and/or utility is a contribution to the project.
Even every question asked on a forum, even if it has been asked before zillions of times, is a valuable resource for learning, or for identifying the weakness of a project, or for seeing a large variety of use cases, or just for keeping your mind alert and fresh, in a state that Id like to call Beginners Mind (keeping oneself free from preconceived ideas, open to dialog).
In this light, mentioning someone like me as a contributor is a very considerate and compassionate gesture, and it is a proof of fairness. But I want to take it rather symbolic than personal, meaning that I represent all the others users who thought their contributions were insignificant. In fact it is a matter of interweaved efforts/actions/nodes where the single nodes can weigh more or less, but without them there wouldnt be a net.
In other words:
-   an open source project is a collaboration of many minds, more or less great, more or less perceptible
-   contributing to an open source project in any form or way is rewarding, the more so when you dont expect it or when your actions werent driven by it
-   the process of learning goes two ways: from the advanced users to the beginners and back

I could continue with my interpretations about open source projects, but Im aware of the fact that such a discourse sounds a little pathetic ;-)

So, Id better go back to talking about the bugs, of course only if you want me to and if this forum is the right place for it. As I said I found a solution, not sure yet if it is the right one, because Im still in the process of understanding the code and its overall logic and maybe later Ill see another way to achieve the same. Let me know if you want to see it (its a gist on github)


Cheers,
Ondina
5  Announcements and General Discussion / General Discussion / Re: Memory management and garbage collection on: July 02, 2009, 01:38:01
I was looking at my other bookmarked links ( referring  to modular applications) and I found this :
http://ultra-web.co.uk/?tag=as3-memory

The author says:
“After reading through most of the module classes in the SDK I found some issues that would not allow a module to fully unload, one being several event listeners in the FlexModuleFactory that never get removed and the other issue being that if you use a component in your module that shares a style with the main application you are royally screwed! “

That was kind of an “aha” moment for me (  paraphrasing Jason again ).
I don't know if the workaround presented in the article is practicable, but at least the info can save you some time while looking for what you did wrong in your code. It's not you, it's Adobe.

6  Announcements and General Discussion / General Discussion / Re: Memory management and garbage collection on: July 01, 2009, 02:51:54
The FlexProfiler gives me an  “ouch” moment , when I discover that there are Classes inside my code I didn't know about.

I have run a test once on 2 applications, one is a Flex app, the other an AIR app, with nothing else inside but the <mx:Application> tag
The Profiler info for both of them:
An empty Flex Application
Class: ModuleManagerImpl Package:ModuleManger.as Cumulative Instances:5(6.49%)
Instances:1(1.25%)  Cumulative Memory:180(4.01%) Memory:52(2.19%)

An empty Air Application
Class: ModuleManagerImpl Package:ModuleManger.as Cumulative Instances:5(4.9%)
Instances:1(12.5%)  Cumulative Memory::188(3.71%) Memory:60(2.44%)

Scary! Because there aren't any modules in those applications. There are no components, not a single line of as3 code, no external libraries and no modules!

Then in a complex AIR application with lots of components(no modules though) I get 1 Instance of the ModuleManagerImpl , about 7456 Cumulative Instances of the Class, Memory: 60, and  Cumulative Memory : 231772!

Where does the ModuleManagerImpl Class come from?
From Application.as, which imports  mx.managers.SystemManager;, which imports mx.core.IFlexModuleFactory; ?¿

Is that happening only to me?
Is there something in the FlexBuilder Properties that I should change?
Actually I just ran a short test in Gumbo too, with original settings, and I'm getting the same info as in FlexBuilder3.
7  Announcements and General Discussion / General Discussion / Memory management and garbage collection on: June 30, 2009, 01:00:18
Memory management and garbage collection - the big deficiency of the FlashPlayer

It seems that many of us are struggling with this issue, so I thought it would be good to share my findings after  my  (desperate) research into this subject.

Here some links to articles, that I found to be somehow useful, even if none of them is giving the ultimate answer to (Flex and AIR) developers' prayers:

1
http://gskinner.com/talks/resource-management/
http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html
http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html

2
http://office.realeyesmedia.com/blogs/jun/?p=61
http://office.realeyesmedia.com/blogs/jun/samples/360Flex/360_Slides/index.htm

3
http://blogs.adobe.com/aharui/2007/03/garbage_collection_and_memory.html
http://blogs.adobe.com/aharui/2008/09/using_the_flex_builder_3x_prof.html

4
http://blog.flexmonkeypatches.com/2007/03/28/flash-player-memory-management-and-garbage-collection-redux-2/

5
http://www.insideria.com/2008/03/flex-performance-memory-manage.html


6
http://www.craftymind.com/2008/04/09/kick-starting-the-garbage-collector-in-actionscript-3-with-air/

7
http://elromdesign.com/blog/2008/03/15/boost-flex-performance-with-object-pooling-manager-api/

8
http://flex.sourceforge.net/manual/The-Default-Memory-Management.html#The-Default-Memory-Management

9
http://roshantitus.blogspot.com/2008/11/flex-memory-management.html

10
http://www.nutrixinteractive.com/blog/?p=132


11  Flash Player Mental Model - The Elastic Racetrack <-interesting
http://www.onflex.org/ted/2005/07/flash-player-mental-model-elastic.php

Does anyone know of any other articles on that subject?

Ondina
8  PureMVC Manifold / MultiCore Version / Re: PureFormSubmission - Deferred Instantiation, StateMachine on: June 29, 2009, 09:16:50
Thank you Cliff for looking at that “thing”:)
As I said, it is not a demo, it is just an application that I used for experimenting with different puremvc aspects, so please excuse the layout and the lack of comments in the code.

I will try to keep this post as short as possible. I explained more on the Google site (urls below) and made some diagrams.

There are 2 things going on:
1. The registration of Mediators for Views in a ViewStack.
2. A StateMachine for a form submission based on the PureMVC TV - FSM .

1. There isn't much to see, except for the messages coming from mediators (onRegister) – similar to the SlackerDemo.  The difference between the SlackerDemo and my example consists in how I use the ChildExistenceChangedEvent and event.relatedObject to make the first View in the stack dispatch an event on creationComplete ( in order to register its Mediator)
You can see more details (explanation and diagram) here:
http://sites.google.com/site/mvc4flex/Home/deferred-instantiation
or  the entire code  here:
http://code.google.com/p/ondina-air-flex-pmvc/source/browse/trunk/pureform/com/

I don't know if this is a “clean” solution or not, but after trying to solve the issue of deferred instantiation of views in a  ViewStack and the registration of puremvc mediators in lots of ways, I decided to go with this one.  I can't have  a SplashView as in the SlackerDemo, meaning I can't have a View without a Mediator.
It would be nice if you could tell me if my solution is: very bad, bad, acceptable, good ...or if you'd give me some hints.

2. Now the StateMachine is the main reason I started the thread.
I took the FSM (Form Submission) from your presentation on PureMVC TV and modified it a bit.
http://sites.google.com/site/mvc4flex/Home/statemachine
My form consists of 5 input fields.  The input fields are scattered over 3 Views, which probably was confusing.
OneView: user-firstname, user-lastname, user-phone
SubOneView: user-sex
SubTwoView: user-language.

This diagram may help understand the structure of my scattered input fields:
http://sites.google.com/site/mvc4flex/Home/the-form

The reason for having those scattered fields :
In my current project  I have several views in some ViewStacks. Each View has several input fields. A View represents a certain category of information, let's say in one view I collect user's personal data ,  in another View data about user's relatives, in another view health related data e.t.c
There are 2 situations I have to deal with:
1 the data from all  the Views has to be sent to the database, when the user hits the submit button
2 the data from a single View has to be saved separately
The Views have also their own VO.

In this example of mine I had only 5 input fields, just to keep it simple - in the beginning when I was trying to see how Notifications would work between different mediators.

Now the “happy path”:
The Form doesn't do much.  A click on the submit form button takes the app from the COLLECTING  state into the VALIDATING state. 
If the form is valid , the data is sent to the proxy and eventually to the database( I couldn't do that on the Google Site of course ) and if everything went well the app goes into the THANKING state.  If the form isn't valid (required fields still empty) a message about this fields appears in the middle of the app.The app is still in the VALIDATING state.
If you press the logout button while the app is still in the VALIDATING state, a confirm alert will appear  asking if you want to quit.
The reset button empties the fields.

The StateMachine Notification are on the bottom of the page. I know, it looks a bit odd, because I wanted to see all the stuff going on on exiting, entering, changed....

So the StateMachine in my example seems to be working, but somehow I have the feeling that there is something  I'm doing that is not quite right.

I tried to have the Validation happening on exiting from the COLLECTING state, as in your FSM. I could cancel the transition to the SAVING state, but then after a successful validation I couldn't  take the app into the SAVING state. It seemed to me as if the app was in no state. I surely did something wrong.
So I decided to have an additional VALIDATING state instead of the exiting thing.

Now, I hope very much that my long post and the stuff on the Google site were comprehensible and you can take a look at the FSM and code and tell me your opinion about it.

Thank you again for your presentation on PureMVC TV. I hope to see more of the like...
Ondina
9  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Flex Gumbo && IT Network Map with PureMVC on: June 28, 2009, 12:19:11
Now I can see what you needed a VSlider for :)
That's some great work you've done there !
Ondina
10  Announcements and General Discussion / Public Demos, Tools and Applications / Re: pureMVC AS3 Game with GAE server on: June 23, 2009, 02:25:13
Do you think I should use it for my game's elements ?

No, no. The StateMachine has indeed to be used when you need to describe  the states of the application not the states of  visual components in the view.
I was just curious if there was some implementation of the StateMachine in your code, since this is what I'm focusing on right now.
And from your description I can't tell if there is a need for a StateMachine or not :)

Ondina
11  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Edoboard advance whiteboard for Math: PureMVC AFCS Degrafa on: June 22, 2009, 11:07:16
Here is a link to the Wolfram Alpha Developer Site:

http://www.wolframalpha.com/developers.html
http://www.wolframalpha.com/WolframAlphaAPI.pdf

“The Wolfram|Alpha service provides a web-based API for clients to integrate the computational and presentation capabilities of Wolfram|Alpha into their own applications or web sites”

I don't know if it is of any real use for your project or maybe just a source of inspiration...
Or maybe you already know about Wolfram Alpha and Mathematica and the geek mathematician Stephen Wolfram ;-)

Ondina
12  Announcements and General Discussion / Public Demos, Tools and Applications / Re: pureMVC AS3 Game with GAE server on: June 22, 2009, 11:00:03
Thanks for the description, Olivier. It gives me a (very) general idea of what's going on behind the scenes :)
You are not using the StateMachine Utility, are you?
Ondina
13  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Flex modules with PureMVC pipes simple demo on: June 19, 2009, 02:42:23
Just wanted to say thank you for your demo, which  aligns itself   with the best examples from users regarding the Pipe utility. 
When the time will come for me to learn more about puremvc- Pipes I will get back to your demo as well.

As far as I understand the puremvc-pipes right now, your ModuleJunctionMediator looks like a pretty nifty solution.
Ondina
14  Announcements and General Discussion / Public Demos, Tools and Applications / Re: pureMVC AS3 Game with GAE server on: June 19, 2009, 01:33:22
I got stuck at level 4. Was I asleep?

you have to anticipate how the global web will react because of chain reactions, Multicore's pipeline seems easy by comparison

What does the puremvc-logic behind those chain reactions look  like? Could you elaborate on that?
Ondina
 
15  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Edoboard advance whiteboard for Math: PureMVC AFCS Degrafa on: June 18, 2009, 08:05:14
ça, c'est vraiment très "cool" :)
Pages: [1] 2 3 ... 6