mojito
05-31-2009, 10:43 AM
I have had a simple single purpose project develop into a dual purpose project. Luckily I had used good MVC I hope to help keep things organised.
But here is a specific question
package src.photo
{
import com.adobe.webapis.flickr.FlickrService;
import com.adobe.webapis.flickr.PagedPhotoList;
import flash.display.Sprite;
import flash.events.*;
public interface IPhotoModel extends IEventDispatcher
{
//specific to PHOTOMODEL
function setPage(val:uint):void;
function getFs():FlickrService;
function getPhotoList():PagedPhotoList;
function getThumbs():Array;
function getImageView(id:String):void;
function setRemainder(): void;
function getRemainder(): uint
//all types of model to have the following....
function hideOthers(keep:Sprite):void;
function setFlashVars(vars:String):void;
function registerView(v:Sprite):void;
function getAViews():Array;
function enterFullScreen():void;
function leaveFullScreen():void;
}
}
I want my interface to just have the bottom half declarations so that at run time I can type in the type of model as now I have two models.
I think I am right in wanting 2 models, as there is strict separated business logic for each of the component parts. And I had already done a single model as it was orginally a project for a single component purpose.
What I want to have is an AbstractView class that can at runtime get populated with a type of model. At runtime we will know which type of model it is but not until then. And this is what I thought interfaces were for. So I can provide a type to the model at runtime. So its a kind of model, but we don't know which until runtime. This would mean I can have a single abstract view class, instead currently i have one in each package pretty much identical except for the typing described above. If I can get the typing then I can shift the abstract view class to the higher folder level and use it from the folders beneath.
folder structure
src/photos/
src/map/
src/
currently here are the two component parts working independently. But I would like to abstract some common view stuff out into the src/ folder like AbstractView for example.
So back to the interface why cant I delete the lines that are specific to certain types of model; well compiler issues as if the lines aren't there then the methods aren't available public wise. But interfaces force the methods to be available in all classes using them, in my map model I dont want to have to have an empty signature for photo type methods for example.
there is a lot here sorry folks, but I thought this is a very good question.
:cool:
But here is a specific question
package src.photo
{
import com.adobe.webapis.flickr.FlickrService;
import com.adobe.webapis.flickr.PagedPhotoList;
import flash.display.Sprite;
import flash.events.*;
public interface IPhotoModel extends IEventDispatcher
{
//specific to PHOTOMODEL
function setPage(val:uint):void;
function getFs():FlickrService;
function getPhotoList():PagedPhotoList;
function getThumbs():Array;
function getImageView(id:String):void;
function setRemainder(): void;
function getRemainder(): uint
//all types of model to have the following....
function hideOthers(keep:Sprite):void;
function setFlashVars(vars:String):void;
function registerView(v:Sprite):void;
function getAViews():Array;
function enterFullScreen():void;
function leaveFullScreen():void;
}
}
I want my interface to just have the bottom half declarations so that at run time I can type in the type of model as now I have two models.
I think I am right in wanting 2 models, as there is strict separated business logic for each of the component parts. And I had already done a single model as it was orginally a project for a single component purpose.
What I want to have is an AbstractView class that can at runtime get populated with a type of model. At runtime we will know which type of model it is but not until then. And this is what I thought interfaces were for. So I can provide a type to the model at runtime. So its a kind of model, but we don't know which until runtime. This would mean I can have a single abstract view class, instead currently i have one in each package pretty much identical except for the typing described above. If I can get the typing then I can shift the abstract view class to the higher folder level and use it from the folders beneath.
folder structure
src/photos/
src/map/
src/
currently here are the two component parts working independently. But I would like to abstract some common view stuff out into the src/ folder like AbstractView for example.
So back to the interface why cant I delete the lines that are specific to certain types of model; well compiler issues as if the lines aren't there then the methods aren't available public wise. But interfaces force the methods to be available in all classes using them, in my map model I dont want to have to have an empty signature for photo type methods for example.
there is a lot here sorry folks, but I thought this is a very good question.
:cool: