root/trunk/manuals/userman/nomenclature.html

Revision 4621, 10.1 KB (checked in by pmoura, 6 weeks ago)

Improved navigation bar in the XHTML manual pages.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
7<head>
8    <meta http-equiv="content-type" content="application/xml+xhtml; charset=utf-8" />
9    <title>Logtalk user manual: nomenclature</title>
10    <link rel="stylesheet" href="../screen.css" type="text/css" media="screen"/>
11    <link rel="stylesheet" href="../print.css" type="text/css" media="print"/>
12</head>
13
14<body>
15
16<div class="top-left">Logtalk user manual</div> 
17<div class="top-right">Nomenclature</div>
18<div class="bottom-left"><span class="page"/></div> 
19<div class="bottom-right"><span class="page"/></div>
20<div class="navtop"><a href="../index.html">Contents</a> &gt; <a href="index.html">User Manual</a> &gt; Nomenclature</div>
21
22<h1 id="nomenclature_nomenclature">Nomenclature</h1>
23
24<p>
25Depending on your Object-oriented Programming background (or lack of it), you may find Logtalk nomenclature either familiar or at odds with the terms used in other languages. In addition, being a superset of Prolog, terms such as <em>predicate</em> and <em>method</em> are often used interchangeably. Logtalk inherits most of its nomenclature from Smalltalk, arguably (and somehow sadly) not the most popular OOP language nowadays. In this section, we map nomenclatures from popular OOP languages such as C++ and Java to the Logtalk nomenclature.
26</p>
27
28<h2 id="nomenclature_cpp">C++ nomenclature</h2>
29
30<p>
31There are several C++ glossaries available on the Internet. The list that follows relates the most commonly used C++ terms with their Logtalk equivalents.
32</p>
33
34<dl>
35    <dt><strong>abstract class</strong></dt>
36        <dd>Logtalk uses a <em>operational</em> definition of abstract class: any class that does not inherit a method for creating new instances is an abstract class. Moreover, Logtalk supports <em>interfaces</em>/<em>protocols</em>, which are often a better way to provide the functionality of C++ abstract classes.</dd>
37</dl>
38<dl>
39    <dt><strong>base class</strong></dt>
40        <dd>Logtalk uses the term <em>superclass</em> with the same meaning.</dd>
41</dl>
42<dl>
43    <dt><strong>data member</strong></dt>
44        <dd>Logtalk uses <em>predicates</em> for representing both behavior and data.</dd>
45</dl>
46<dl>
47    <dt><strong>constructor function</strong></dt>
48        <dd>There are no special methods for creating new objects in Logtalk. Instead, Logtalk provides a built-in predicate, <code>create_object/4</code>, which is often used to define more sophisticated object creation predicates.</dd>
49</dl>
50<dl>
51    <dt><strong>derived class</strong></dt>
52        <dd>Logtalk uses the term <em>subclass</em> with the same meaning.</dd>
53</dl>
54<dl>
55    <dt><strong>destructor function</strong></dt>
56        <dd>There are no special methods for deleting new objects in Logtalk. Instead, Logtalk provides a built-in predicate, <code>abolish_object/1</code>, which is often used to define more sophisticated object deletion predicates.</dd>
57</dl>
58<dl>
59    <dt><strong>friend function</strong></dt>
60        <dd>Not supported in Logtalk. Nevertheless, see the manual section on <em>meta-predicates.</em></dd>
61</dl>
62<dl>
63    <dt><strong>instance</strong></dt>
64        <dd>In Logtalk, an instance can be either created dynamically at runtime or defined statically in a source file in the same way as classes.</dd>
65</dl>
66<dl>
67    <dt><strong>member</strong></dt>
68        <dd>Logtalk uses the term predicate.</dd>
69</dl>
70<dl>
71    <dt><strong>member function</strong></dt>
72        <dd>Logtalk uses predicates for representing both behavior and data.</dd>
73</dl>
74<dl>
75    <dt><strong>namespace</strong></dt>
76        <dd>Logtalk does not support multiple identifier namespaces. All Logtalk entity identifiers share the same namespace (Logtalk entities are objects, categories, and protocols).</dd>
77</dl>
78<dl>
79    <dt><strong>nested class</strong></dt>
80        <dd>Logtalk does not support nested classes.</dd>
81</dl>
82<dl>
83    <dt><strong>template</strong></dt>
84        <dd>Logtalk supports <em>parametric objects</em>, which allows you to get the similar functionality of templates at runtime.</dd>
85</dl>
86<dl>
87    <dt><strong>this</strong></dt>
88        <dd>Logtalk uses the built-in context method <code>self/1</code> for retrieving the current instance. Logtalk also provides a <code>this/1</code> method but for returning the class containing the method being executed. Why the name clashes? Well, the notion of <em>self</em> was inherited from Smalltalk, which predates C++.</dd>
89</dl>
90<dl>
91    <dt><strong>virtual member function</strong></dt>
92        <dd>There is no <code>virtual</code> keyword in Logtalk. By default, Logtalk uses dynamic binding for locating both method declarations and method definitions. Moreover, methods that are declared but not defined simply fail when called.</dd>
93</dl>
94
95<h2 id="nomenclature_java">Java nomenclature</h2>
96
97<p>
98There are several Java glossaries available on the Internet. The list that follows relates the most commonly used Java terms with their Logtalk equivalents.
99</p>
100
101<dl>
102    <dt><strong>abstract class</strong></dt>
103        <dd>Logtalk uses a <em>operational</em> definition of abstract class: any class that does not inherit a method for creating new instances is an abstract class. I.e. there is no <code>abstract</code> keyword in Logtalk.</dd>
104</dl>
105<dl>
106    <dt><strong>abstract method</strong></dt>
107        <dd>In Logtalk, you may simply declare a method (predicate) in a class without defining it, leaving its definition to some descendant sub-class.</dd>
108</dl>
109<dl>
110    <dt><strong>assertion</strong></dt>
111        <dd>There is no <code>assertion</code> keyword in Logtalk. Assertions are supported using Logtalk compilation hooks.</dd>
112</dl>
113<dl>
114    <dt><strong>extends</strong></dt>
115        <dd>There is no <code>extends</code> keyword in Logtalk. Class inheritance is indicated using <em>specialization</em> relations. Moreover, the <em>extends</em> relation is used in Logtalk to indicate protocol or prototype extension.</dd>
116</dl>
117<dl>
118    <dt><strong>interface</strong></dt>
119        <dd>Logtalk uses the term <em>protocol</em> with the same meaning.</dd>
120</dl>
121<dl>
122    <dt><strong>callback method</strong></dt>
123        <dd>Logtalk supports <em>event-driven programming</em>, the most common use context of callback methods.</dd>
124</dl>
125<dl>
126    <dt><strong>class method</strong></dt>
127        <dd>Class methods may be implemented in Logtalk by using a metaclass for the class and defining the class methods in the metaclass. I.e. class methods are simply instance methods of the class metaclass.</dd>
128</dl>
129<dl>
130    <dt><strong>class variable</strong></dt>
131        <dd>True class variables may be implemented in Logtalk by using a metaclass for the class and defining the class variables in the class. I.e. class variables are simply instance variables of the class metaclass. Shared instance variables may be implemented by using the built-in database methods (which can be used to implement variable assignment) to access and updated a single occurrence of the variable stored in the class (there is no <code>static</code> keyword in Logtalk).</dd>
132</dl>
133<dl>
134    <dt><strong>constructor</strong></dt>
135        <dd>There are no special methods for creating new objects in Logtalk. Instead, Logtalk provides a built-in predicate, <code>create_object/4</code>, which is often used to define more sophisticated object creation predicates.</dd>
136</dl>
137<dl>
138    <dt><strong>final</strong></dt>
139        <dd>There is no <code>final</code> keyword in Logtalk; methods may always be redefined in subclasses (and instances!).</dd>
140</dl>
141<dl>
142    <dt><strong>inner class</strong></dt>
143        <dd>Inner classes are not supported in Logtalk.</dd>
144</dl>
145<dl>
146    <dt><strong>instance</strong></dt>
147        <dd>In Logtalk, an instance can be either created dynamically at runtime or defined statically in a source file in the same way as classes.</dd>
148</dl>
149<dl>
150    <dt><strong>method</strong></dt>
151        <dd>Logtalk uses the term <em>predicate</em> interchangeably with the term <em>method</em>.</dd>
152</dl>
153<dl>
154    <dt><strong>method call</strong></dt>
155        <dd>Logtalk usually uses the expression <em>message sending</em> for method calls, true to its Smalltalk heritage.</dd>
156</dl>
157<dl>
158    <dt><strong>method signature</strong></dt>
159        <dd>Logtalk selects the method/predicate to execute in order to answer a method call based only on the method name (functor) and number of arguments (arity). Logtalk (and Prolog) are not typed languages in the same sense as Java.</dd>
160</dl>
161<dl>
162    <dt><strong>reflection</strong></dt>
163        <dd>Logtalk supports both <em>structural reflection</em> (using a set of built-in predicates and built-in methods) and <em>behavioral reflection</em> (using event-driven programming).</dd>
164</dl>
165<dl>
166    <dt><strong>static</strong></dt>
167        <dd>There is no <code>static</code> keyword in Logtalk. See the entries on <em>class methods</em> and <em>class variables</em>.</dd>
168</dl>
169<dl>
170    <dt><strong>super</strong></dt>
171        <dd>Instead of a <code>super</code> keyword, Logtalk provides a <em>super</em> operator, <code>^^/1</code>, for calling overridden methods.</dd>
172</dl>
173<dl>
174    <dt><strong>synchronized</strong></dt>
175        <dd>Logtalk supports <em>multi-threading programming</em> in selected Prolog compilers, including a <code>synchronized/1</code> predicate directive and a <code>synchronized/0</code> object (and category) directive. Logtalk allows you to synchronize a predicate, a set of predicates, or all object predicates using  per-predicate and per-object <em>locks</em>.</dd>
176</dl>
177<dl>
178    <dt><strong>this</strong></dt>
179        <dd>Logtalk uses the built-in context method <code>self/1</code> for retrieving the current instance. Logtalk also provides a <code>this/1</code> method but for returning the class containing the method being executed. Why the name clashes? Well, the notion of <em>self</em> was inherited from Smalltalk, which predates Java.</dd>
180</dl>
181
182<div class="footer">
183    <div class="copyright">
184        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/> 
185        <span>Last updated on: October 16, 2008</span>
186    </div>
187    <div class="navbottom">
188        <span><a href="features.html">previous</a> | <a href="../glossary.html">glossary</a> | <a href="messages.html">next</a></span><br/>
189        <span><a href="http://validator.w3.org/check/referer">XHTML</a> + <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></span>
190    </div>
191</div>
192
193</body>
194
195</html>
Note: See TracBrowser for help on using the browser.