动态模型实际上是一个动态面向对象的技术,可以在运行时创建和修改对象(模型),所以系统也是动态的,可以随时修改系统中的各种事物。如下面的示例中掩饰了动态创建类和对象。
交互式编程是XWorker使用模型创建的一个新的编程方法,交互式编程实质是一个函数式的编程方法,它认为一个函数的参数也是一个函数,所以要执行一个函数可以通过选择设置函数的参数来完成,所以是一个不断通过选择(交互)来完成编程的一种编程方法。

<?xml version="1.0" encoding="utf-8"?>
<Shell name="shell" descriptors="xworker.swt.widgets.Shell" text="Button" RESIZE="true"
width="300" height="400" label="Button">
<FillLayout name="shellFillLayout"></FillLayout>
<Composite name="composite" label="Button">
<Resource name="resources">
<Image name="oneImage" imageFile="icons/accept.png"></Image>
<Image name="twoImage" imageFile="icons/add.png"></Image>
<Image name="threeImage" imageFile="icons/anchor.png"></Image>
</Resource>
<FillLayout name="compositeFillLayout" type="SWT.VERTICAL"></FillLayout>
<Group name="textButtonsGroup" text="Text Buttons">
<RowLayout name="textButtosGroupRowLayout"></RowLayout>
<Button name="oneButton" text="One"></Button>
<Button name="twoButton" text="Two"></Button>
<Button name="threeButton" text="Three"></Button>
</Group>
<Group name="imageButtonsGroup" _xmeta_id_="textButtonsGroup1" text="Image Buttons">
<RowLayout name="imageButtosGroupRowLayout" _xmeta_id_="textButtosGroupRowLayout"></RowLayout>
<Button name="oneButton" image="oneImage"></Button>
<Button name="twoButton" image="twoImage"></Button>
<Button name="threeButton" image="threeImage"></Button>
</Group>
<Group name="imageAndTextButtonsGroup" _xmeta_id_="textButtonsGroup2" text="Image and Text Buttons">
<RowLayout name="imageAndTextButtosGroupRowLayout" _xmeta_id_="textButtosGroupRowLayout"></RowLayout>
<Button name="oneButton" text="One" image="oneImage"></Button>
<Button name="twoButton" text="Two" image="twoImage"></Button>
<Button name="threeButton" text="Three" image="threeImage"></Button>
</Group>
</Composite>
</Shell>

<?xml version="1.0" encoding="utf-8"?>
<SimpleControl name="gridPanel" descriptors="xworker.http.controls.SimpleControl" id="'gridPanel'">
<view>
<otherHeads><![CDATA[<meta http-equiv="content-type" content="text/html; charset=utf-8">
<LINK REL ="stylesheet" TYPE="text/css" HREF="fckeditor/2_6beta1/editor/css/fck_editorarea.css" TITLE="Style"/>
<script type="text/javascript" src="js/xworker/InnerBrowserUtil.js"></script>]]></otherHeads>
<ExtJs>
<Viewport name="viewport" varname="viewport" useChildExtThing="false" forceLayout="true" layout="'fit'" id="'viewport'" renderTo="document.body">
<items>
<DataObjectGridPanel name="gridPanel" _xmeta_id_="_gridPanel_" dataObject="xworker.example.app.dataobject.ProvinceDataObject" useChildExtThing="false" title="'表格'" id="'gridPanel'">
<buttons>
<Button name="addButton" text="'添加'" useChildExtThing="false">
<handler useChildsCode="true" useChildExtThing="false">
<GridInsertRecord descriptors="xworker.app.view.extjs.widgets.grid.DataObjectGridFunctions/@GridInsertRecord" gridId="'gridPanel'" insertType="blank"></GridInsertRecord>
</handler>
</Button>
<Button name="deleteButton" text="'删除'" useChildExtThing="false">
<handler useChildsCode="true" useChildExtThing="false">
<GridDeleteRecords descriptors="xworker.app.view.extjs.widgets.grid.DataObjectGridFunctions/@GridDeleteRecords" gridName="'gridPanel'" title="'删除记录'" message="'确定要删除指定的记录么?'"></GridDeleteRecords>
</handler>
</Button>
<Button name="refreshButton" text="'刷新'" useChildExtThing="false">
<handler useChildsCode="true" useChildExtThing="false">
<GridReloadRecords descriptors="xworker.app.view.extjs.widgets.grid.DataObjectGridFunctions/@GridReloadRecods" gridName="'gridPanel'"></GridReloadRecords>
</handler>
</Button>
</buttons>
</DataObjectGridPanel>
</items>
</Viewport>
</ExtJs>
</view>
<result name="success" value="xworker.example.web.extjs.grid.TestGrid/@view"></result>
</SimpleControl>
<?xml version="1.0" encoding="utf-8"?>
<Screen name="AtlasIssueTest" descriptors="xworker.libgdx.Screen" description="<p>测试TextureAtlas。</p>">
<actions descriptors="xworker.lang.MetaDescriptor3/@actions">
<GroovyAction name="render" _xmeta_id_="render batch_begin();">
<code><![CDATA[import com.badlogic.gdx.Gdx;
batch.begin();
sprite.draw(batch);
font.draw(batch, "fps:" + Gdx.graphics.getFramesPerSecond(), 26, 65);
batch.end();]]></code>
</GroovyAction>
</actions>
<Resources>
<FileResource name="atlas" type="textureAtals" file="\data\issue_pack"></FileResource>
<SpriteBatch name="batch" constructor="default"></SpriteBatch>
<AtlasResource name="sprite" _xmeta_id_="sprite1" atlas="atlas" type="sprite" regionName="map"></AtlasResource>
<FileResource name="font" type="bitmapFont" file="\data\font.fnt">
<AssetLoaderParameters>
<BitmapFontParameter flip="false"></BitmapFontParameter>
</AssetLoaderParameters>
</FileResource>
</Resources>
</Screen>
在动态模型中标签和标签的语义都是动态和自定义的,所以实现了动态模型编程的系统里可以不断添加新的模型,也可以随时定义新的类模型,从而可以实现系统功能的无缝成长。
在动态模型中系统的功能即程序就是模型,而模型是数据,所以XWorker中的任何程序都是可分析的,所以将来XWorker会引入大数据和机器学习等来分析模型,也会开发人工智能程序来动态编写模型,从而实现系统的智能化。
模型是数据,特别容易实现分享,XWorker做了一个名为码农的世界的网站来方便开发者分享模型,另外在未来我们也计划实现系统之间的模型分享,从而实现系统之间的功能学习等。