RE: [Flashcoders] MVC style Correction
Maybe I'm off, but I don't think the controller should manipulate data. Jason Merrill Instructional Technology Architect II Bank of America Global Learning ___ -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Mattheis, Erik (MIN-WSW) Sent: Thursday, February 23, 2012 8:26 PM To: Flash Coders List Subject: Re: [Flashcoders] MVC style Correction Ross Sclafani ross.sclaf...@gmail.com wrote: It is very easy to locate any code in one of my projects by ascertaining the domain of the code in question and looking in the appropriate branch. Does it store data? It's in the model. Does it interpret and display data? Try your views. Does it manipulate data? Look in the controller. This thread has been useful, thanks all. I've a ton of questions regarding judgment calls and below I post a class illustrating a few I've struggled with. The comments are intended to be my questions/admissions of bafflement. I'm unsure where in a MVC this class should go as its main purpose is to work with the File class which itself has methods which retrieve (File.applicationDirectory), interpret (File.exists) and display (File.browseForOpen) data. The class also is a dreaded example of allowing the view to listen directly to the model for events, perhaps only because I've misguidedly decided to make it part of the model as it has to do with copying and deleting a SQLite file used in the app. package mvc.model { /* saveFileAs() saves a copy of a SQLite DB for the purposes of transferring data to an instance of this app on another computer. closeDBAndReplace() = replaces the db file if the user is importing data. */ import flash.events.EventDispatcher; import flash.events.Event; import flash.filesystem.File; // class Data works with a SQLite DB import mvc.model.Data; // Where in a MVC should custom event classes // be located? I wish to pass my own objects // along with events, usually Transfer Objects // or a string to be displayed import mvc.controller.CustomDataEvent; public class ManipulateDBFile extends EventDispatcher { private var _data:Data; private var _sourceFile:File; private var _copyToDirectory:File; public function ManipulateDBFile(data:Data) { _data = data; } public function saveFileAs() : void { var docsDir:File = File.desktopDirectory; // This creates a UI element. I would look for this code in the view! docsDir.browseForDirectory('Save File in ...'); // This is asking a UI elemt to inform the Model directly. Big bad no? docsDir.addEventListener(Event.SELECT, copyFile); } private function copyFile(e:Event):void { _sourceFile = File.applicationStorageDirectory.resolvePath(msgDB.db); _copyToDirectory = e.target.resolvePath(msgDB.db); if (_copyToDirectory.exists) { // Passing this event through the Controller seems to create complexity, // or at least unnecessary lines of code. Is there an advantage gained by // communicating to the view through the controller here? var evt:CustomDataEvent = new CustomDataEvent(CustomDataEvent.FILE_ALREADY_EXISTS); dispatchEvent(evt); } else { replaceFile(); } } public function replaceFile() : void { var evt:CustomDataEvent = new CustomDataEvent(CustomDataEvent.COPY_COMPLETE); try { _sourceFile.copyTo(_copyToDirectory, true); dispatchEvent(evt); } catch (error:Error) { evt.param = error.message; dispatchEvent(evt); } _sourceFile = null; _copyToDirectory = null; } public function closeDBAndReplace() : void { // The file cannot be deleted if there is a SQLConnection to it. // The class that is aware of a possible connection also does the // deletion. But deleting the file seems to conceptually // fit into this class better _data.addEventListener(CustomDataEvent.DRILL_RESET, findFile, false, 0, true); _data.deleteDBFile(); } private function findFile(e:CustomDataEvent) : void { _data.removeEventListener(CustomDataEvent.DRILL_RESET, findFile, false); var docsDir:File = File.desktopDirectory; docsDir.browseForOpen('Select msgDB.db file ...'); docsDir.addEventListener(Event.SELECT, replaceDBFile); } private function replaceDBFile(e:Event):void { var sourceFile:File = e.target as File; var destination:File = File.applicationStorageDirectory.resolvePath(msgDB.db); try { sourceFile.copyTo(destination, true); dispatchEvent(new CustomDataEvent(CustomDataEvent.RESTART_REQUIRED)); } catch (error:Error) { trace(Error:, error.message); } } } } On 2/17/12 6:07 PM, Ross Sclafani ross.sclaf...@gmail.com wrote: It is very easy to locate any code in one of my projects by ascertaining the domain of the code in question and looking in the appropriate branch. Does it store data? It's in the model. Does it interpret and display data? Try your views.
Re: [Flashcoders] Flash Platform roadmap released - time to start learning HTML 5 unless you make games.
Have you guys given Adobe edge a try? It's like Flash MX, without easily accessible fonts or drawing tools... My fear is that handwriting HTML will always be cleaner and more structured than using an IDE. Imagine building a robust web application with tons of animation in Edge... It just seems impossible, where as Flash made it easy. On Thu, Feb 23, 2012 at 3:57 PM, Karl DeSaulniers k...@designdrumm.comwrote: +1 On Feb 23, 2012, at 10:49 AM, Kevin Newman wrote: There is this idea that was articulated by an old timer - an ex-bank CEO - on Bill Moyer's show a few weeks ago, that companies and running companies used to be about product and solving customers' problems - great loan products if you are are a banker, or Flash and great tools if you run Adobe. But these days business culture has changed to be primarily about profit, to the point where you actually get Kudos for gloating about how much money you were able to stock pile this quarter, instead of what great products you created, or how many customers you satisfied. This is a sad state of affairs that affects more than just Adobe, though they seem to have slipped into that black hole of profit gloating just like so many other American corporations. And the CEOs probably get real social kudos for that money gloating at their cocktail parties. Personally, I'll stay focused on products and customers, and hope that's enough to help change the culture back. I'm pretty much at the bottom of the totem pole though. I can only hope these old ideas will see some kind of revival at that corporate board and CEO level of American culture. Kevin N. Karl DeSaulniers Design Drumm http://designdrumm.com __**_ Flashcoders mailing list Flashcoders@chattyfig.figleaf.**com Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/**mailman/listinfo/flashcodershttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- James Merrill ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash Platform roadmap released - time to start learning HTML 5 unless you make games.
I only played with Edge briefly on vacation last summer. :) I think that fear about HTML is warranted in terms of the quality of code you'll end up with - but the same can be said for hand written PostScript vs. Illustrator generated PostScript. Personally, I'll be happen when I don't have to edit HTML by hand anymore. That day came for PostScript a generation ago, and with some luck and hard work, it'll come for HTML. Kevin N. On 2/24/12 10:29 AM, James Merrill wrote: Have you guys given Adobe edge a try? It's like Flash MX, without easily accessible fonts or drawing tools... My fear is that handwriting HTML will always be cleaner and more structured than using an IDE. Imagine building a robust web application with tons of animation in Edge... It just seems impossible, where as Flash made it easy. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash Platform roadmap released - time to start learning HTML 5 unless you make games.
It so reminds of the days of Director and Behaviors. There was SO much extra bull coded into them, it was always better to roll your own. :) As if Lingo was verbose enough… :) Have a good day, John John R. Sweeney Jr. Senior Interactive Multimedia Developer OnDemand Interactive Inc Hoffman Estates, IL 60169 On Feb 24, 2012, at 1:42 PM, Kevin Newman wrote: Personally, I'll be happen when I don't have to edit HTML by hand anymore. That day came for PostScript a generation ago, and with some luck and hard work, it'll come for HTML. Kevin N. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] MVC style Correction
Apparently there are no rules. Just call it MVC and it's MVC I guess. Ross P. Sclafani Owner / Creative Director Neuromantic Industries http://www.neuromantic.com http://ross.sclafani.net http://www.twitter.com/rosssclafani 347.204.5714 On Feb 24, 2012, at 10:15 AM, Merrill, Jason jason.merr...@bankofamerica.com wrote: Maybe I'm off, but I don't think the controller should manipulate data. Jason Merrill Instructional Technology Architect II Bank of America Global Learning ___ -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Mattheis, Erik (MIN-WSW) Sent: Thursday, February 23, 2012 8:26 PM To: Flash Coders List Subject: Re: [Flashcoders] MVC style Correction Ross Sclafani ross.sclaf...@gmail.com wrote: It is very easy to locate any code in one of my projects by ascertaining the domain of the code in question and looking in the appropriate branch. Does it store data? It's in the model. Does it interpret and display data? Try your views. Does it manipulate data? Look in the controller. This thread has been useful, thanks all. I've a ton of questions regarding judgment calls and below I post a class illustrating a few I've struggled with. The comments are intended to be my questions/admissions of bafflement. I'm unsure where in a MVC this class should go as its main purpose is to work with the File class which itself has methods which retrieve (File.applicationDirectory), interpret (File.exists) and display (File.browseForOpen) data. The class also is a dreaded example of allowing the view to listen directly to the model for events, perhaps only because I've misguidedly decided to make it part of the model as it has to do with copying and deleting a SQLite file used in the app. package mvc.model { /* saveFileAs() saves a copy of a SQLite DB for the purposes of transferring data to an instance of this app on another computer. closeDBAndReplace() = replaces the db file if the user is importing data. */ import flash.events.EventDispatcher; import flash.events.Event; import flash.filesystem.File; // class Data works with a SQLite DB import mvc.model.Data; // Where in a MVC should custom event classes // be located? I wish to pass my own objects // along with events, usually Transfer Objects // or a string to be displayed import mvc.controller.CustomDataEvent; public class ManipulateDBFile extends EventDispatcher { private var _data:Data; private var _sourceFile:File; private var _copyToDirectory:File; public function ManipulateDBFile(data:Data) { _data = data; } public function saveFileAs() : void { var docsDir:File = File.desktopDirectory; // This creates a UI element. I would look for this code in the view! docsDir.browseForDirectory('Save File in ...'); // This is asking a UI elemt to inform the Model directly. Big bad no? docsDir.addEventListener(Event.SELECT, copyFile); } private function copyFile(e:Event):void { _sourceFile = File.applicationStorageDirectory.resolvePath(msgDB.db); _copyToDirectory = e.target.resolvePath(msgDB.db); if (_copyToDirectory.exists) { // Passing this event through the Controller seems to create complexity, // or at least unnecessary lines of code. Is there an advantage gained by // communicating to the view through the controller here? var evt:CustomDataEvent = new CustomDataEvent(CustomDataEvent.FILE_ALREADY_EXISTS); dispatchEvent(evt); } else { replaceFile(); } } public function replaceFile() : void { var evt:CustomDataEvent = new CustomDataEvent(CustomDataEvent.COPY_COMPLETE); try { _sourceFile.copyTo(_copyToDirectory, true); dispatchEvent(evt); } catch (error:Error) { evt.param = error.message; dispatchEvent(evt); } _sourceFile = null; _copyToDirectory = null; } public function closeDBAndReplace() : void { // The file cannot be deleted if there is a SQLConnection to it. // The class that is aware of a possible connection also does the // deletion. But deleting the file seems to conceptually // fit into this class better _data.addEventListener(CustomDataEvent.DRILL_RESET, findFile, false, 0, true); _data.deleteDBFile(); } private function findFile(e:CustomDataEvent) : void { _data.removeEventListener(CustomDataEvent.DRILL_RESET, findFile, false); var docsDir:File = File.desktopDirectory; docsDir.browseForOpen('Select msgDB.db file ...'); docsDir.addEventListener(Event.SELECT, replaceDBFile); } private function replaceDBFile(e:Event):void { var sourceFile:File = e.target as File; var destination:File = File.applicationStorageDirectory.resolvePath(msgDB.db); try { sourceFile.copyTo(destination, true); dispatchEvent(new CustomDataEvent(CustomDataEvent.RESTART_REQUIRED));
RE: [Flashcoders] MVC style Correction
No rules, you're right, just having the controller manipulate data just seems to go against the spirit of what MVC is all about. Controllers are usually used as communication busses in my experience. Jason Merrill Instructional Technology Architect II Bank of America Global Learning ___ -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ross Sclafani Sent: Friday, February 24, 2012 4:29 PM To: Flash Coders List Subject: Re: [Flashcoders] MVC style Correction Apparently there are no rules. Just call it MVC and it's MVC I guess. Ross P. Sclafani Owner / Creative Director Neuromantic Industries http://www.neuromantic.com http://ross.sclafani.net http://www.twitter.com/rosssclafani 347.204.5714 On Feb 24, 2012, at 10:15 AM, Merrill, Jason jason.merr...@bankofamerica.com wrote: Maybe I'm off, but I don't think the controller should manipulate data. Jason Merrill Instructional Technology Architect II Bank of America Global Learning ___ -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Mattheis, Erik (MIN-WSW) Sent: Thursday, February 23, 2012 8:26 PM To: Flash Coders List Subject: Re: [Flashcoders] MVC style Correction Ross Sclafani ross.sclaf...@gmail.com wrote: It is very easy to locate any code in one of my projects by ascertaining the domain of the code in question and looking in the appropriate branch. Does it store data? It's in the model. Does it interpret and display data? Try your views. Does it manipulate data? Look in the controller. This thread has been useful, thanks all. I've a ton of questions regarding judgment calls and below I post a class illustrating a few I've struggled with. The comments are intended to be my questions/admissions of bafflement. I'm unsure where in a MVC this class should go as its main purpose is to work with the File class which itself has methods which retrieve (File.applicationDirectory), interpret (File.exists) and display (File.browseForOpen) data. The class also is a dreaded example of allowing the view to listen directly to the model for events, perhaps only because I've misguidedly decided to make it part of the model as it has to do with copying and deleting a SQLite file used in the app. package mvc.model { /* saveFileAs() saves a copy of a SQLite DB for the purposes of transferring data to an instance of this app on another computer. closeDBAndReplace() = replaces the db file if the user is importing data. */ import flash.events.EventDispatcher; import flash.events.Event; import flash.filesystem.File; // class Data works with a SQLite DB import mvc.model.Data; // Where in a MVC should custom event classes // be located? I wish to pass my own objects // along with events, usually Transfer Objects // or a string to be displayed import mvc.controller.CustomDataEvent; public class ManipulateDBFile extends EventDispatcher { private var _data:Data; private var _sourceFile:File; private var _copyToDirectory:File; public function ManipulateDBFile(data:Data) { _data = data; } public function saveFileAs() : void { var docsDir:File = File.desktopDirectory; // This creates a UI element. I would look for this code in the view! docsDir.browseForDirectory('Save File in ...'); // This is asking a UI elemt to inform the Model directly. Big bad no? docsDir.addEventListener(Event.SELECT, copyFile); } private function copyFile(e:Event):void { _sourceFile = File.applicationStorageDirectory.resolvePath(msgDB.db); _copyToDirectory = e.target.resolvePath(msgDB.db); if (_copyToDirectory.exists) { // Passing this event through the Controller seems to create complexity, // or at least unnecessary lines of code. Is there an advantage gained by // communicating to the view through the controller here? var evt:CustomDataEvent = new CustomDataEvent(CustomDataEvent.FILE_ALREADY_EXISTS); dispatchEvent(evt); } else { replaceFile(); } } public function replaceFile() : void { var evt:CustomDataEvent = new CustomDataEvent(CustomDataEvent.COPY_COMPLETE); try { _sourceFile.copyTo(_copyToDirectory, true); dispatchEvent(evt); } catch (error:Error) { evt.param = error.message; dispatchEvent(evt); } _sourceFile = null; _copyToDirectory = null; } public function closeDBAndReplace() : void { // The file cannot be deleted if there is a SQLConnection to it. // The class that is aware of a possible connection also does the // deletion. But deleting the file seems to conceptually // fit into this class better _data.addEventListener(CustomDataEvent.DRILL_RESET, findFile, false, 0, true); _data.deleteDBFile(); } private
Re: [Flashcoders] MVC style Correction
Yeah I understand how different the flavors are now. I didnt invent the triangular flow paradigm of my framework, I read it in a book. Lots of books, lots of 'spirits' In the end it's just another 3 letter acronym. Ross P. Sclafani Owner / Creative Director Neuromantic Industries http://www.neuromantic.com http://ross.sclafani.net http://www.twitter.com/rosssclafani 347.204.5714 On Feb 24, 2012, at 4:45 PM, Merrill, Jason jason.merr...@bankofamerica.com wrote: No rules, you're right, just having the controller manipulate data just seems to go against the spirit of what MVC is all about. Controllers are usually used as communication busses in my experience. Jason Merrill Instructional Technology Architect II Bank of America Global Learning ___ -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ross Sclafani Sent: Friday, February 24, 2012 4:29 PM To: Flash Coders List Subject: Re: [Flashcoders] MVC style Correction Apparently there are no rules. Just call it MVC and it's MVC I guess. Ross P. Sclafani Owner / Creative Director Neuromantic Industries http://www.neuromantic.com http://ross.sclafani.net http://www.twitter.com/rosssclafani 347.204.5714 On Feb 24, 2012, at 10:15 AM, Merrill, Jason jason.merr...@bankofamerica.com wrote: Maybe I'm off, but I don't think the controller should manipulate data. Jason Merrill Instructional Technology Architect II Bank of America Global Learning ___ -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Mattheis, Erik (MIN-WSW) Sent: Thursday, February 23, 2012 8:26 PM To: Flash Coders List Subject: Re: [Flashcoders] MVC style Correction Ross Sclafani ross.sclaf...@gmail.com wrote: It is very easy to locate any code in one of my projects by ascertaining the domain of the code in question and looking in the appropriate branch. Does it store data? It's in the model. Does it interpret and display data? Try your views. Does it manipulate data? Look in the controller. This thread has been useful, thanks all. I've a ton of questions regarding judgment calls and below I post a class illustrating a few I've struggled with. The comments are intended to be my questions/admissions of bafflement. I'm unsure where in a MVC this class should go as its main purpose is to work with the File class which itself has methods which retrieve (File.applicationDirectory), interpret (File.exists) and display (File.browseForOpen) data. The class also is a dreaded example of allowing the view to listen directly to the model for events, perhaps only because I've misguidedly decided to make it part of the model as it has to do with copying and deleting a SQLite file used in the app. package mvc.model { /* saveFileAs() saves a copy of a SQLite DB for the purposes of transferring data to an instance of this app on another computer. closeDBAndReplace() = replaces the db file if the user is importing data. */ import flash.events.EventDispatcher; import flash.events.Event; import flash.filesystem.File; // class Data works with a SQLite DB import mvc.model.Data; // Where in a MVC should custom event classes // be located? I wish to pass my own objects // along with events, usually Transfer Objects // or a string to be displayed import mvc.controller.CustomDataEvent; public class ManipulateDBFile extends EventDispatcher { private var _data:Data; private var _sourceFile:File; private var _copyToDirectory:File; public function ManipulateDBFile(data:Data) { _data = data; } public function saveFileAs() : void { var docsDir:File = File.desktopDirectory; // This creates a UI element. I would look for this code in the view! docsDir.browseForDirectory('Save File in ...'); // This is asking a UI elemt to inform the Model directly. Big bad no? docsDir.addEventListener(Event.SELECT, copyFile); } private function copyFile(e:Event):void { _sourceFile = File.applicationStorageDirectory.resolvePath(msgDB.db); _copyToDirectory = e.target.resolvePath(msgDB.db); if (_copyToDirectory.exists) { // Passing this event through the Controller seems to create complexity, // or at least unnecessary lines of code. Is there an advantage gained by // communicating to the view through the controller here? var evt:CustomDataEvent = new CustomDataEvent(CustomDataEvent.FILE_ALREADY_EXISTS); dispatchEvent(evt); } else { replaceFile(); } } public function replaceFile() : void { var evt:CustomDataEvent = new CustomDataEvent(CustomDataEvent.COPY_COMPLETE); try { _sourceFile.copyTo(_copyToDirectory, true); dispatchEvent(evt); } catch (error:Error) { evt.param = error.message;