The Ultimate Guide to Choosing WordPress Pros and Cons
mvcExpress training course : part1
1. mvcExpress
(simplest and fastest ActionScript 3 MVC framework)
training course
Raimundas Banevicius
raima156@yahoo.com
senior flash developer
2012.03.24
2. About me
● Hi, My name is Raimundas Banevicius, and I love flash!
● I work with flash technology from 2000.07
● I work as senior flash developer, and I build big multiplayer games
● I rely heavily on tools and frameworks to make my work manageable and to stay productive
● In the past I used PureMVC, Robotlegs to build games, but discovered a lot of things I don't like
about those framework.
● I build mvcExpress framework to solve those problems.
3. About this course
● You will learn:
○ How to create applications using mvcExpress framework
○ MVC pattern theory and practice
○ different ways you can approach your problems, and help you pick one that suits your
situation better.
● You will NOT learn:
○ basics of ActionScript 3 programming.
○ Object oriented programming.
● You don't need any knowledge of other frameworks.
4. Learning curve
● Most frameworks has steep initial learning curve...
● ...but then you done with it - you will fly!
● Basic concepts are easy... but grasping all of them at once is challenging
○ learn in in small pieces! Don't try to fit everything in your head from the start!
○ give some time for those small pieces sit in your head.
● you need to learn think in MVC pattern. Not only know MVC. (It will take some time.)
● don't forget to have fun! (start with small-fun application before starting big commercial projects)
6. What will be covered
● What is MVC pattern
● MVC parts
● Model ,View, Controller overview
● Communication overview
● mvcExpress module overview
7. What is MVC pattern
● MVC is architectural pattern used to construct your application.
○ it main purpose is separation of concerns to
■ data domain logic (Model)
■ view interaction and view domain logic (View)
■ business logic (Controller)
○ uses loose coupling (objects don't have to know each other to interact)
■ uses messaging system for that. (Events or Signals for example)
○ comes in many flavours
■ some implementations is more strict, some are more flexible and loose.
■ communications(direct and indirect) can be implemented differently
● mvcExpress is framework that uses MVC principles and tries to pick a golden middle:
○ it leaves options on how to approach a problem but limits it enough to prevent a mess.
○ communications set not only for control but also with convenience in mind
8. MVC parts
Model View
● Stores data ● handles user inputs
● Provides data ● shows view change
● Gives a way to change data ● implements view domain
● Implements data domain logic logic
Controller
● implements application
business logic
● can reacts to view inputs
● can reacts to data changes
9. mvcExpress Model
Model userName:String;
moneyAmmount:int;
mapLayout:MapLayoutVO;
inventory:Vector.<ItemVO>;
qualityLevel:String
videoSettings:VideoSettingVO;
then we write application we have to deal with all kinds of data:
● simple data. (like String and int),
● various Value Object classes.
● complex data, like collections, or compositions of other data.
10. mvcExpress Model
Model userName:String; InventoryProxy
UserProxy moneyAmmount:int;
mapLayout:MapLayoutVO;
inventory:Vector.<ItemVO>;
MapProxy
SettingsProxy
qualityLevel:String
videoSettings:VideoSettingVO;
Model layer of MVC is implemented using Proxy design pattern.
● data is aggregated and 'hidden' inside proxy class.
● proxy provides set of public functions to work with data from outside: (uses direct communication)
11. mvcExpress View
menuBtn:Button;
View
label:TextField;
main:Sprite;
mapLayout:Group;
gameScreen:Sprite;
-menuScreen:Sprite;
-windowScreen:Sprite;
playField:Sprite;
-ships:Vector.<Ship>;
then we write application we have to deal with all kinds of view objects:
● simple view objects, or components. (like Button's or TextField's)
● containers that hold simple views or other containers.
● containers that hold collections or arrays of other views.
12. mvcExpress View
menuBtn:Button;
View
label:TextField;
MainMediator GameScreenMediator
main:Sprite;
mapLayout:Group;
gameScreen:Sprite;
-menuScreen:Sprite;
MapMediator -windowScreen:Sprite; PlayFieldMediator
playField:Sprite;
-ships:Vector.<Ship>;
View layer of MVC is implemented using Mediator design pattern.
● view object is aggregated and 'hidden' inside mediator class.
● mediators does not mediate components(Button's. TextField's), instead they mediate component containers.
● mediator mediates one and only one view object. (often with children of that view object)
● mediator acts as a middleman for view objects communication with rest of application. (uses indirect
communication)
13. mvcExpress Controller
function startNewGame(){
Controller // change game state to represent new game
}
function handleChessMove(){
// check if move is valid,
// update game board data if it is.
// send message to show error if it is not.
}
function addFormData(){
// store new form data
// check if form is compleated
// if it is - change form data state to isCompleated = true...
}
Then we write application we need some code to do business logic for us, or in other words do 'thinking'.
We don't want logic code to be in the View or in the Model layers - we want it separated in Controller layer!
Best way is to imagine controller as set of functions, that work with application state, and do various tasks using
different parts of application.
14. mvcExpress Controller
StartNewGameCommand
Controller
// change game state to represent new game
HandleChessMoveCommand
// check if move is valid,
// update game board data if it is.
// send message to show error if it is not.
AddFormDataCommand
// store new form data
// check if form is compleated
// if it is - change form data state to isCompleated = true...
Controller layer of MVC is implemented using Command design pattern.
● Best way to look at it as class-function.
● Command classes are created, performs one task(function), and dies.
15. mvcExpress parts, recap
Model View
Deals with view objects by using
Deals with data by using Proxies.
Mediators
Proxy Mediator
Proxy Mediator
Proxy Mediator
Controller
Deals with business logic by using
Commands
Command
Command
Command
16. mvcExpress communications
Model View
Deals with view objects by using
Deals with data by using Proxies.
Mediators
Proxy Mediator
Proxy Mediator
Proxy Mediator
Controller
Deals with business logic by using
Commands
Command
Command can get object
Command can send message
17. mvcExpress modules
Module
Model View
Deals with data by Deals with view objects
using Proxies. by using
Mediators
Controller
Deals with business
logic by using
Commands
Module represents:
● stand alone application that uses mvc architecture.
● stand alone module that uses mvc architecture and can be used by application
module or other modules.
18. Thanks for listening!
mvcExress framwork resources:
● mvcExpress homepage:
http://mvcexpress.org/
● Code on GitHub:
https://github.com/MindScriptAct/mvcExpress-framework
● my blog:
http://www.mindscriptact.com/