A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: MVC with true OOP

  1. #1
    Junior Member
    Join Date
    Feb 2007
    Posts
    2

    Question MVC with true OOP

    I have been building some simulations for online training content. I always try to use OOP with AS2 (and now sometimes AS3). So everything is strong typed and use inheritance whereever possible which allows us to take one control and reuse it somewhere in a different simaulation

    Now I've been reading about the MVC pattern in Moock's Essential Actionscript 2.0 and am thinking of how to implement it as I can see some benefits. But the example he uses with the clock means that everything is very loose and not strong typed.
    I would say that I probably use more of an Event-Listener model so that parts can be reused easily. I suppose this gives a model - controller type structure as the view and controller are all one item which pass data to the model using event listeners

    Has anyone got examples or experience of using the MVC with true OOP?
    Is it even worth trying to implement a MVC pattern if I'm already using OOP and event-listeners to pass data about?

  2. #2
    Junior Member
    Join Date
    Mar 2001
    Posts
    2

    mvc for a website?

    hmmm i'm wondering if mvc can be used to supply the logic for a flash website. what do you think?
    --

    mitrzne

  3. #3
    Junior Member
    Join Date
    Mar 2001
    Posts
    2
    hmmm i'm wondering if mvc can be used to supply the logic for a flash website. what do you think?
    --

    mitrzne

  4. #4
    Junior Member
    Join Date
    Feb 2007
    Posts
    2
    Since my original post I now use AS3 for any new projects. If I need the MVC pattern then I tend to use a Model -ViewController (all-in-one) pattern which is more commonly called the Document View implementation

    Having the View and Controller as one still obeys the main MVC idea which is that the model doesn't know about anything else and is just a data store.
    Then in AS3 I have found it much easier to keep strong types

    The logic for a Flash website could be done using the MVC pattern. There could be a model to store data - then a VC to update the server side scripts, and several VCs for any user input. This would allow to add controls easier at a later time

    Really the M-VC idea can be applied to anything but the key thing is planning it through and decide if it really should be used (maybe you're making things over complicated?)

  5. #5
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,986
    I've been using PureMVC within Flex... and I'll be honest. At times, it's a bit overkill for most things.

    [ Hello ] | [ gerbick ] | [ Ω ]

  6. #6
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    Quote Originally Posted by gerbick
    I've been using PureMVC within Flex... and I'll be honest. At times, it's a bit overkill for most things.
    I have not actually used PureMVC, but from my experience, a true MVC pattern in Flash (in practical use) is rare. MVC is more well suited for an application with distinct states, and has more of an "application" feel to them. Flash just tends to have too many bleeding edges and it's hard to clearly separate your logic from visuals and such. I find more of a Singleton approach works for me, but again, I don't stick with it. I tend to mix and match various techniques and just make something work. Don't worry so much about symantics, just put out a nice quality product, with easily maintainable code, and you'll be fine.

  7. #7
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506
    I've seen it used on several projects, and it is overkill, the only exeptions were sites I wouldn't have built in flash to begin with.

    I've used a pattern that kinda mixed the model/view but it ended up being more of a mediator pattern in the end. In fact that's exactly what it ended up being - All child objects of the main singleton object corresponded to visual components on screen. It worked pretty well and suited flash development quite nicely, but that was AS2.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center