~ubuntu-branches/ubuntu/raring/kiwi/raring

« back to all changes in this revision

Viewing changes to doc/howto/node17.html

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-01-30 09:52:28 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070130095228-n0mkqlt82e74twqc
Tags: 1.9.12-0ubuntu1
* New upstream release.
* debian/patches/03_epyrun_use_local_modules.patch:
  - updated.
* debian/control:
  - moved python-support from Build-Depends to Build-Depends-Indep.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 
2
<html>
 
3
<head>
 
4
<link rel="STYLESHEET" href="howto.css" type='text/css' />
 
5
<link rel="first" href="howto.html" title='Developing applications with Kiwi' />
 
6
<link rel='last' href='about.html' title='About this document...' />
 
7
<link rel='help' href='about.html' title='About this document...' />
 
8
<link rel="next" href="node18.html" />
 
9
<link rel="prev" href="node16.html" />
 
10
<link rel="parent" href="node16.html" />
 
11
<link rel="next" href="node18.html" />
 
12
<meta name='aesop' content='information' />
 
13
<title>2.9.1 Domain Objects (or Models)</title>
 
14
</head>
 
15
<body>
 
16
<DIV CLASS="navigation">
 
17
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
 
18
<table align="center" width="100%" cellpadding="0" cellspacing="2">
 
19
<tr>
 
20
<td class='online-navigation'><a rel="prev" title="2.9 Proxies and Models"
 
21
  href="node16.html"><img src='previous.png'
 
22
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
 
23
<td class='online-navigation'><a rel="parent" title="2.9 Proxies and Models"
 
24
  href="node16.html"><img src='up.png'
 
25
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
 
26
<td class='online-navigation'><a rel="next" title="2.9.2 Using Proxies"
 
27
  href="node18.html"><img src='next.png'
 
28
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
 
29
<td align="center" width="100%">Developing applications with Kiwi</td>
 
30
<td class='online-navigation'><img src='blank.png'
 
31
  border='0' height='32'  alt='' width='32' /></td>
 
32
<td class='online-navigation'><img src='blank.png'
 
33
  border='0' height='32'  alt='' width='32' /></td>
 
34
<td class='online-navigation'><img src='blank.png'
 
35
  border='0' height='32'  alt='' width='32' /></td>
 
36
</tr></table>
 
37
<div class='online-navigation'>
 
38
<b class="navlabel">Previous:</b>
 
39
<a class="sectref" rel="prev" href="node16.html">2.9 Proxies and Models</A>
 
40
<b class="navlabel">Up:</b>
 
41
<a class="sectref" rel="parent" href="node16.html">2.9 Proxies and Models</A>
 
42
<b class="navlabel">Next:</b>
 
43
<a class="sectref" rel="next" href="node18.html">2.9.2 Using Proxies</A>
 
44
</div>
 
45
<hr /></div>
 
46
</DIV>
 
47
<!--End of Navigation Panel-->
 
48
 
 
49
<H3><A NAME="SECTION000291000000000000000">
 
50
2.9.1 Domain Objects (or Models)</A>
 
51
</H3>
 
52
 
 
53
<P>
 
54
Doing Object Oriented (OO) implementation implies the system you are
 
55
creating revolves around objects; in the case of Python applications, we
 
56
use the word `instances'. OO applications call the instances that
 
57
represent your problem's logical entities
 
58
<em class="citetitle"><a
 
59
 href="http://c2.com/cgi/wiki?DomainObject"
 
60
 title="'domain objects'"
 
61
 >'domain objects'</a></em>. In a
 
62
mail application, for instance, you might have Person and Message domain
 
63
objects; in a sales application you could have Product and Sale.
 
64
 
 
65
<P>
 
66
Picking up from our last example, you could say <tt class="class">NewsItem</tt>
 
67
represented a class of domain objects, since its instances held data (or
 
68
`state') that represented a logical container relevant to the task we
 
69
had at hand, browsing news.  This example was very simple, and there was
 
70
no mechanism coded into the <tt class="class">NewsItem</tt> class, but the concept is
 
71
the same.
 
72
 
 
73
<P>
 
74
One very common problem when coding a new UI to manipulate the
 
75
information in a domain object - at the fundamental level, in an
 
76
instance - is the amount of code that needs to be done to alter the
 
77
state of the instance. If you have a small form, with few controls in
 
78
it, it's merely a bother; if you have a complex form, with many controls
 
79
and lots of interaction, it can be a nightmare of accessors and message
 
80
passing. Each widget must have the appropriate signals connected, and
 
81
the handlers must either manipulate the instance directly, or call
 
82
accessors repeatedly. Changing the UI involves more coding and
 
83
complication.
 
84
 
 
85
<P>
 
86
So, in summary:
 
87
 
 
88
<P>
 
89
 
 
90
<UL>
 
91
<LI>I use the terms <B>object, model<A NAME="tex2html6"
 
92
  HREF="#foot272"><SUP>6</SUP></A> and instance</B>
 
93
interchangeably to refer to a <B>domain object</B>.
 
94
</LI>
 
95
<LI>The problem at hand is propagating changes from the UI to the
 
96
domain objects attached to them.
 
97
 
 
98
<P>
 
99
This is the task Proxies attempt to simplify.
 
100
</LI>
 
101
</UL>
 
102
 
 
103
<P>
 
104
<BR><HR><H4>Footnotes</H4>
 
105
<DL>
 
106
<DT><A NAME="foot272">... model</A><A
 
107
 HREF="node17.html#tex2html6"><SUP>6</SUP></A></DT>
 
108
<DD>A note on naming: in
 
109
MVC, one third of the triad is called Model, which (I believe) is short
 
110
for Application Model. In theory, the Application Model represents the
 
111
real-world behavior of your application, just like the domain object;
 
112
synonyms, basically. Some authors, however, defend that the Application
 
113
Model and the domain object should be separate entities. I don't think
 
114
this is necessarily true.  From my experience, in most cases the two are
 
115
functionally equivalent (and separating them showed me that I ended up
 
116
doing was proxying calls from one to the other).
 
117
 
 
118
</DD>
 
119
</DL>
 
120
<DIV CLASS="navigation">
 
121
<div class='online-navigation'>
 
122
<p></p><hr />
 
123
<table align="center" width="100%" cellpadding="0" cellspacing="2">
 
124
<tr>
 
125
<td class='online-navigation'><a rel="prev" title="2.9 Proxies and Models"
 
126
  href="node16.html"><img src='previous.png'
 
127
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
 
128
<td class='online-navigation'><a rel="parent" title="2.9 Proxies and Models"
 
129
  href="node16.html"><img src='up.png'
 
130
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
 
131
<td class='online-navigation'><a rel="next" title="2.9.2 Using Proxies"
 
132
  href="node18.html"><img src='next.png'
 
133
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
 
134
<td align="center" width="100%">Developing applications with Kiwi</td>
 
135
<td class='online-navigation'><img src='blank.png'
 
136
  border='0' height='32'  alt='' width='32' /></td>
 
137
<td class='online-navigation'><img src='blank.png'
 
138
  border='0' height='32'  alt='' width='32' /></td>
 
139
<td class='online-navigation'><img src='blank.png'
 
140
  border='0' height='32'  alt='' width='32' /></td>
 
141
</tr></table>
 
142
<div class='online-navigation'>
 
143
<b class="navlabel">Previous:</b>
 
144
<a class="sectref" rel="prev" href="node16.html">2.9 Proxies and Models</A>
 
145
<b class="navlabel">Up:</b>
 
146
<a class="sectref" rel="parent" href="node16.html">2.9 Proxies and Models</A>
 
147
<b class="navlabel">Next:</b>
 
148
<a class="sectref" rel="next" href="node18.html">2.9.2 Using Proxies</A>
 
149
</div>
 
150
</div>
 
151
<hr />
 
152
<span class="release-info">Release 1.9.12, documentation updated on August, 2006.</span>
 
153
</DIV>
 
154
<!--End of Navigation Panel-->
 
155
 
 
156
</BODY>
 
157
</HTML>