这几天使劲的学习FLEX前端开发以及COLDFUSION的后端服务开发,还小有成效,YY一下
前端的开发思路依然延续MVP下的PRESENTER FIRST思路,原来没有搞过的后端COLDFUSION也慢慢的有了感觉,很不错的开发平台,原来让我很恼火的TAG语法现在感觉有点亲切了。
做了一个完整的HELLO WORLD题目,贴上来。
体会:只要从一门语言出发,搞清其背后的原理,其他的语言学起来真的很好上手
package mvp.presenter
{
import mvp.model.IhelloModel;
import mvp.view.IhelloView;
public class Hellopresenter
{
private var _view: IhelloView;
private var _model: IhelloModel;
private function onModelUpdateHelloResult(): void
{
_view.resultText = _model.resultText;
}
private function initialization(): void
{
_view.clickButton = onViewClickButton;
_model.updateHelloResult = onModelUpdateHelloResult;
}
private function onViewClickButton(): void
{
_model.getHelloResult();
}
public function Hellopresenter(view: IhelloView, model: IhelloModel)
{
_view = view;
_model = model;
initialization();
}
}
}
package mvp.view
{
public interface IhelloView
{
function set resultText(value:String):void;
function set clickButton(value:Function):void;
}
}
package mvp.model
{
public interface IhelloModel
{
function get resultText(): String;
function set updateHelloResult(value:Function):void;
function getHelloResult():void;
}
}
package mvp.factory
{
import mvp.model.Hellomodel;
import mvp.model.IhelloModel;
import mvp.presenter.Hellopresenter;
import mvp.view.Helloview;
import mvp.view.IhelloView;
public class MVPFactory
{
public function MVPFactory()
{
}
public static function makeHelloview():Helloview
{
var _helloView:Helloview=new Helloview();
_helloView.percentHeight=100;
_helloView.percentWidth=100;
new Hellopresenter(_helloView as IhelloView, new Hellomodel as IhelloModel);
return _helloView;
}
}
}