^1640740824843
@
sname
ThingModel
slabel
ThingModel
sdescriptors
xworker.ide.guide.narrator.NarratorSpeaks
sth_createIndex
false
sth_registMyChilds
false
sth_mark
false
  @/@start
  sname
  start
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@modelSwt
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 事物模型来自于对世界和事物的理解，在技术上可以看到各种编程方法的影子，因此除了哲学上难以理解外，事物模型还是一个比较容易明白和使用的编程方法。</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 我们先从连个简单的示例讲起。</span></p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  start
  @/@modelSwt
  sname
  modelSwt
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@modelWeb
  Sdescription
#$@text#$@
<p><span style="font-size:16px">比如这是一个SWT模型，你可以通过点击&ldquo;运行&rdquo;按钮来运行它。</span></p>

<pre class="brush:xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;

&lt;Shell name=&quot;HelloWorld&quot; _xmeta_id_=&quot;&quot; descriptors=&quot;xworker.swt.widgets.Shell&quot; 
&nbsp;&nbsp;&nbsp; text=&quot;Hello World&quot; RESIZE=&quot;true&quot; width=&quot;400&quot; height=&quot;300&quot; label=&quot;HelloWorld&quot;&gt;
&nbsp;&nbsp;&nbsp; &lt;FillLayout&gt;&lt;/FillLayout&gt;
&nbsp;&nbsp;&nbsp; &lt;Browser url=&quot;http://www.baidu.com&quot;&gt;&lt;/Browser&gt;
&lt;/Shell&gt;</pre>

<p>&nbsp;</p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  modelSwt
    @/@modelSwt/@Buttons
    sname
    Buttons
    sdescriptors
    xworker.ide.guide.actions.NarratorActions/@NarratorSpeak/@Buttons
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    Buttons
      @/@modelSwt/@Buttons/@runButton
      sname
      runButton
      stext
      运行
      stype
      SWT.PUSH
      sflat
      false
      sborder
      false
      sselected
      false
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      sdescriptors
      xworker.swt.Widgets/@Button
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      runButton
        @/@modelSwt/@Buttons/@runButton/@Listeners
        sname
        Listeners
        sdescriptors
        xworker.swt.widgets.Widget/@Listeners
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        Listeners
          @/@modelSwt/@Buttons/@runButton/@Listeners/@Listener
          sname
          Listener
          stype
          Selection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Listener
            @/@modelSwt/@Buttons/@runButton/@Listeners/@Listener/@ThingAction
            sname
            ThingAction
            sdescriptors
            xworker.lang.actions.Actions/@ThingAction1
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            ThingAction
  @/@modelWeb
  sname
  modelWeb
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@model
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;模型还可以用于编写WEB应用，比如：</span></p>

<pre class="brush:xml;">
&lt;SimpleControl name=&quot;helloword1&quot; descriptors=&quot;xworker.web.ControlSet/@SimpleControl&quot;&gt;
&nbsp;&nbsp;&nbsp; &lt;view&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;otherHeads&gt;&lt;![CDATA[...]]&gt;&lt;/otherHeads&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;htmlCode htmlCode=&quot;&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Hello World！&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&quot;&gt;&lt;/htmlCode&gt;
&nbsp;&nbsp;&nbsp; &lt;/view&gt;
&nbsp;&nbsp;&nbsp; &lt;result name=&quot;success&quot; value=&quot;xworker.example.orgweb.http.HellowWord/@helloword1/@view&quot;&gt;&lt;/result&gt;
&lt;/SimpleControl&gt;</pre>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  modelWeb
    @/@modelWeb/@Buttons
    sname
    Buttons
    sdescriptors
    xworker.ide.guide.actions.NarratorActions/@NarratorSpeak/@Buttons
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    Buttons
      @/@modelWeb/@Buttons/@runButton
      sname
      runButton
      stext
      打开这个应用
      stype
      SWT.PUSH
      sflat
      false
      sborder
      false
      sselected
      false
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      sdescriptors
      xworker.swt.Widgets/@Button
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      runButton
        @/@modelWeb/@Buttons/@runButton/@Listeners
        sname
        Listeners
        sdescriptors
        xworker.swt.widgets.Widget/@Listeners
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        Listeners
          @/@modelWeb/@Buttons/@runButton/@Listeners/@Listener
          sname
          Listener
          stype
          Selection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Listener
            @/@modelWeb/@Buttons/@runButton/@Listeners/@Listener/@Begin
            sname
            Begin
            schangeSelf
            false
            sinterpretationType
            Self
            sattributeTemplate
            false
            schildsAttributeTemplate
            false
            svarScope
            Local
            sisSynchronized
            false
            sthrowException
            true
            suseOtherAction
            false
            screateLocalVarScope
            false
            ssaveReturn
            false
            sdisableGlobalContext
            false
            sdescriptors
            xworker.lang.actions.Actions/@ActionGroup
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            Begin
              @/@modelWeb/@Buttons/@runButton/@Listeners/@Listener/@Begin/@actions
              sname
              actions
              sdescriptors
              xworker.lang.actions.Begin/@actions
              sth_createIndex
              false
              sth_registMyChilds
              false
              sth_mark
              false
              sid
              actions
                @/@modelWeb/@Buttons/@runButton/@Listeners/@Listener/@Begin/@actions/@OpenUrl
                sname
                OpenUrl
                surl
                do?sc=xworker.example.orgweb.http.HellowWord/@helloword1
                surlIsTemplate
                false
                sxworkerUrl
                true
                sinterpretationType
                Self
                sattributeTemplate
                false
                schildsAttributeTemplate
                false
                svarScope
                Local
                sisSynchronized
                false
                sthrowException
                true
                suseOtherAction
                false
                screateLocalVarScope
                false
                ssaveReturn
                false
                sdisableGlobalContext
                false
                sdescriptors
                xworker.ide.worldexplorer.actions.ExplorerActions/@OpenThing11
                sth_createIndex
                false
                sth_registMyChilds
                false
                sth_mark
                false
                sid
                OpenUrl
  @/@model
  sname
  model
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@mdoelStructure
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 可以看到事物模型是类似于XML这样的数据，因此事物模型可以简单的用XML来理解，而XML已经是一个非常普及的技术了，在这里就不详细说明了。</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 下面说一下事物模型编程的基本方法和步骤。</span></p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  model
  @/@mdoelStructure
  sname
  mdoelStructure
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@mdoelMain
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 事物模型的编程方法是一个面向对象的编程方法，因此可以用面向对象的方法来理解事物模型的编程方法。</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 首先事物模型也存在类和对象的概念，类的概念对应于事物模型中的描述的概念，但和普通的面向对象编程不同，事物模型编程里不是首先定义类，而是首先用已有的类实例化对象，即使用描述者事物去编辑新的事物。</span></p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  mdoelStructure
  @/@mdoelMain
  sname
  mdoelMain
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@modelDesc
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 因此首先要认识到事物模型虽然是一个面向对象的编程方法，但是和传统的面向对象语言的做法很不相同，事物模型编程的步骤和它们是不同的。</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 前面说我们用描述者事物来创建一个事物，实际上描述者事物相当于类，因此创建事物的过程就是实例化对象的过程。</span></p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  mdoelMain
  @/@modelDesc
  sname
  modelDesc
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@modelRun
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 你可能会想现在都还没有类，那我们如何用类来创建对象呢？</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 实际上事物模型认为类也是对象，类这个对象本身也应该存在一个类，使用类的类就可以实例化类了。</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 在事物模型编程里类的类是元事物，元事物是一开始就存在的，使用元事物可以编辑各种其他具体的类。</span></p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  modelDesc
  @/@modelRun
  sname
  modelRun
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@modelEdit
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 使用元事物编写而了具体的描述者事物（类）之后，就可以用这些事物来编写更具体的事物。</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 比如可以用元事物来编写人、动物、按钮等抽象的类事物，然后再用人、动物和按钮等编写具体的人、动物和按钮等。</span></p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  modelRun
  @/@modelEdit
  sname
  modelEdit
  snarrator
  default
  snextNarratorSpeak
  xworker.sharedatas.xworker.ThingModel/@end
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 以上是使用事物模型编程的基本方法，可以看到这里强调的是类和对象的实例化关系，至于类和类之间的关系，比如动物和人的关系，在事物模型里同样可以使用继承来实现。</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 最后在事物模型里事物是和动作等价的，</span>任何事物都可以转化为动作，<span style="font-size:16px">其中动作是可以执行的程序，因此事物本身也可以是行为。</span></p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  modelEdit
  @/@end
  sname
  end
  snarrator
  default
  snextNarratorSpeak
  xworker.example.ide.guide.XWorkerGuideNarratorSpeaks/@start
  Sdescription
#$@text#$@
<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 事物模型的基本概念就讲到这里了，虽然它也是一种面向对象，但做法不太相同，希望可以理解。</span></p>

<p><span style="font-size:16px">&nbsp;&nbsp;&nbsp; 谢谢。</span></p>
#$@text#$@
  sinterpretationType
  Self
  sattributeTemplate
  false
  schildsAttributeTemplate
  false
  svarScope
  Local
  sisSynchronized
  false
  sthrowException
  true
  suseOtherAction
  false
  screateLocalVarScope
  false
  ssaveReturn
  false
  sdisableGlobalContext
  false
  sdescriptors
  xworker.ide.guide.narrator.NarratorSpeaks/@NarratorSpeak
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  end
