introduction.lisp 16.9 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;;
;; Copyright 2002, 2009, 2012 Genworks International
;;
;; This source file is part of the General-purpose Declarative
;; Language project (GDL).
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;; 
;; This source file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; Affero General Public License for more details.
;; 
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file.  If not, see
;; <http://www.gnu.org/licenses/>.
;;

22
23
24
25
(in-package :gendl-doc)

(defparameter *introduction*
    `((:chapter :title "Introduction")
26
27

      ((:section :title "Welcome")
28
       "Congratulations on your decision to work with Genworks\\textsuperscript{\\textregistered} GDL\\texttrademark"
Dave Cooper's avatar
Dave Cooper committed
29
30
31
32
33
34
35
36
37
38
       (:footnote "From time to time, you will also see references to
``Gendl.'' This refers to ``The Gendl Project'' which is the name of
an open-source software project from which Genworks GDL draws for its
core technology. ``The Gendl Project'' code is free to use for any
purpose, but it is released under the Gnu Affero General Public
License, which stipulates that applications code compiled with The
Gendl Project compiler must be distributed as open-source under a
compatible license (if distributed at all). Commercial Genworks GDL,
properly licensed for development and/or runtime distribution, does
not have this ``copyleft'' open-sourcing requirement.")
39
40
41
42
43
       ". By investing time to learn this system you will be investing
in your future productivity and, in the process, you will be joining a
quiet revolution. Although you may have come to Genworks GDL because
of an interest in 3D modeling or mechanical engineering, you will find
that a whole new world, and a unique approach to "
Dave Cooper's avatar
Dave Cooper committed
44
45
       (:emph "computing")
       ", will now be at your fingertips as well.")
46
      
47
48
49
50
      ((:section :title "Knowledge Base Concepts According to Genworks")
       "You may have an idea about Knowledge Base Systems,
or Knowledge "
       (:emph "Based")
Dave Cooper's avatar
Dave Cooper committed
51
52
       " Systems, from college textbooks or corporate marketing
literature, and concluded that the concepts were too broad to be of
53
practical use. Or you may have heard criticisms implicit in the
Dave Cooper's avatar
Dave Cooper committed
54
55
pretentious-sounding name, ``Knowledge-based Engineering,'' as in:
``you mean as opposed to "
56
57
58
       (:indexed "Ignorance-based Engineering")
       "?'' 

59
60
61
62
To provide a clearer picture, we hope you will concur that Genworks'
concept of a KB system is straightforward, relatively uncomplicated,
and practical. In this manual our goal is to make you both comfortable
and motivated to explore the ideas we have built into our flagship
Dave Cooper's avatar
Dave Cooper committed
63
system, Genworks GDL.
64

Dave Cooper's avatar
Dave Cooper committed
65
Our informal definition of a "
66
       (:emph (:indexed "Knowledge Base System"))
Dave Cooper's avatar
Dave Cooper committed
67
68
69
       " is a hybrid " 
       (:emph "Object-Oriented") 
       (:footnote "An " (:emph "Object-Oriented")
Dave Cooper's avatar
Dave Cooper committed
70
71
72
73
74
		  " programming environment supports named collections
		  of values along with procedures to operate on that
		  data, including the possibility to
		  modify (``mutate'') the data. See
		  https://en.wikipedia.org/wiki/Object-oriented_programming")
Dave Cooper's avatar
Dave Cooper committed
75
76
77
       " and "
       (:emph "Functional")
       (:footnote "A pure " (:emph "Functional")
Dave Cooper's avatar
Dave Cooper committed
78
79
80
81
		  " programming environment supports only the
evaluation of Functions which work by computing results, but do not
modify (i.e. ``mutate'') the in-memory state of any objects. See
http://en.wikipedia.org/wiki/Functional_programming")
Dave Cooper's avatar
Dave Cooper committed
82
       " programming environment, which implements the features of "
83
84
85
       (:emph (:indexed "Caching"))
       " and "
       (:emph (:indexed "Dependency tracking"))
86
87
88
89
       ". Caching means that once the KB has computed something, it
generally will not need to repeat that computation if the same
question is asked again. Dependency tracking is the flip side of that
coin --- it ensures that if a cached result is "
90
91
92
93
       (:emph "stale")
       ", the result will be recomputed the next time it is "
       (:emph "demanded")
       ", so as to give a fresh result.")
Dave Cooper's avatar
Dave Cooper committed
94
95

      ((:section :title "Classic Definition of Knowledge Based Engineering (KBE)")
Dave Cooper's avatar
Dave Cooper committed
96
97
98
99
100
101
102
103
       "Sections "
       (:ref "sec:classicdefinitionofknowledgebasedengineering(kbe)")
       " through "
       (:ref "sec:object-orienteddesign")
       " are sourced from "
       (:cite "LaRocca")
       "."
       (:quote
104
105
106
107
108
       "Knowlege based engineering (KBE) is a technology predicated on
the use of dedicated software tools called KBE systems, which are able
to capture and systematically re-use product and process engineering
knowledge, with the final goal of reducing the time and costs of
product development by means of the following:"
Dave Cooper's avatar
Dave Cooper committed
109
       (:ul (:li "Automation of repetitive and non-creative design tasks;")
110
	    (:li "Support of multidisciplinary design optimization in all  
Dave Cooper's avatar
Dave Cooper committed
111
phases of the design process"))))
Dave Cooper's avatar
Dave Cooper committed
112
113


Dave Cooper's avatar
Dave Cooper committed
114
115
116
      ((:section :title "Runtime Value Caching and Dependency Tracking")
       (:quote
	(:p "Caching refers to the ability of the KBE system to memorize at
Dave Cooper's avatar
Dave Cooper committed
117
118
119
120
121
122
123
124
runtime the results of computed values (e.g. computed slots and
instantiated objects), so that they can be reused when required,
without the need to re-compute them again and again, unless necessary.
The dependency tracking mechanism serves to keep track of the current
validity of the cached values.  As soon as these values are no longer
valid (stale), they are set to unbound and recomputed if and only at
the very moment they are again demanded.")

Dave Cooper's avatar
Dave Cooper committed
125
	(:p "This dependency tracking mechanism is at the base of associative
Dave Cooper's avatar
Dave Cooper committed
126
127
128
129
modeling, which is of extreme interest for engineering design
applications. For example, the shape of a wing rib can be defined
accordingly to the shape of the wing aerodynamic surface. In case the
latter is modified, the dependency tracking mechanism will notify the
Dave Cooper's avatar
Dave Cooper committed
130
system that the given rib instance is no longer valid and will be
Dave Cooper's avatar
Dave Cooper committed
131
132
133
134
135
eliminated from the product tree, together with all the
information (objects and attributes) depending on it. The new rib
object, including its attributes and the rest of the affected
information, will not be re-instantiated/updated/re-evaluated
automatically, but only when and if needed (see demand driven
Dave Cooper's avatar
Dave Cooper committed
136
instantiation in the next section)")))
Dave Cooper's avatar
Dave Cooper committed
137
138

      ((:section :title "Demand-Driven Evaluation")
Dave Cooper's avatar
Dave Cooper committed
139
140
141
       (:quote
	"KBE systems use the "
	(:emph "demand-driven")
Dave Cooper's avatar
Dave Cooper committed
142
	" approach. That is, they evaluate only those chains of
Dave Cooper's avatar
Dave Cooper committed
143
expressions required to satisfy a direct request of the user (i.e. the
Dave Cooper's avatar
Dave Cooper committed
144
evaluation of certain attributes for the instantiation of an object),
Dave Cooper's avatar
Dave Cooper committed
145
146
147
148
149
150
151
152
153
154
or the indirect requests of another object, which is trying to satisfy
a user demand. For example, the system will create an instance of the
rib object only when the weight of the abovementioned wing rib is
required. The reference wing surface will be generated only when the
generation of the rib object is required, and so on, until all the
information required to respond to the user request will be made
available.

It should be recognized that a typical object tree can be structured
in hundreds of branches and include thousands of attributes. Hence,
Dave Cooper's avatar
Dave Cooper committed
155
156
157
158
159
160
the ability to evaluate "
	(:emph "specific")
	" attributes and product model branches at demand, without the
need to evaluate the whole model from its root, prevents waste of
computational resources and in many cases brings seemingly intractible
problems to a rapid solution."))
Dave Cooper's avatar
Dave Cooper committed
161
162

      ((:section :title "Object-oriented Systems")
Dave Cooper's avatar
Dave Cooper committed
163
       (:quote "An object-oriented system is composed of
Dave Cooper's avatar
Dave Cooper committed
164
165
166
167
168
169
170
171
172
173
174
       objects (i.e. concrete instantiations of "
	       (:emph "named")
	       " classes), and the behavior of the system results from
       the collaboration of those objects. Collaboration between
       objects involves them sending messages to each other. Sending a
       message differs from calling a function in the sense that when
       a target object receives a message, it decides on its own what
       function to carry out to service that message. The same message
       may be implemented by many different functions, the one
       selected depending on the current state of the target
       object."))
175
      
Dave Cooper's avatar
Dave Cooper committed
176
      ((:section :title "Object-oriented Analysis")
Dave Cooper's avatar
Dave Cooper committed
177
178
       (:quote
	(:p "Object-oriented analysis (OOA) is the process of analyzing
Dave Cooper's avatar
Dave Cooper committed
179
180
181
182
183
       a task (also known as a problem domain) to develop a conceptual
       model that can then be used to complete the task. A typical OOA
       model would describe computer software that could be used to
       satisfy a set of customer-defined requirements. During the
       analysis phase of problem-solving, the analyst might consider a
Dave Cooper's avatar
Dave Cooper committed
184
       Written Requirements Statement, a formal vision document, or
Dave Cooper's avatar
Dave Cooper committed
185
186
187
       interviews with stakeholders or other interested parties. The
       task to be addressed might be divided into several subtasks (or
       domains), each representing a different business,
188
       technological, or other area of interest. Each subtask would be
Dave Cooper's avatar
Dave Cooper committed
189
190
191
192
       analyzed separately. Implementation
       constraints (e.g. concurrency, distribution, persistence, or
       how the system is to be built) are not considered during the
       analysis phase; rather, they are addressed during
Dave Cooper's avatar
Dave Cooper committed
193
       object-oriented design (OOD) phase.")
Dave Cooper's avatar
Dave Cooper committed
194

Dave Cooper's avatar
Dave Cooper committed
195
	(:p "The conceptual model that results from OOA will typically consist of a
Dave Cooper's avatar
Dave Cooper committed
196
set of use cases, one or more UML class diagrams, and a number of
197
interaction diagrams. It may also include some form of user interface.")))
Dave Cooper's avatar
Dave Cooper committed
198
199

      ((:section :title "Object-oriented Design")
Dave Cooper's avatar
Dave Cooper committed
200
201
202
203
       (:quote 
	"During the object-oriented design (OOD) phase, a developer
applies implementation constraints to the conceptual model produced in
object-oriented analysis. Such constraints could include not only
Dave Cooper's avatar
Dave Cooper committed
204
205
206
207
208
209
210
those imposed by the chosen architecture but also any non-functional
--- technological or environmental --- constraints, such as data
processing capacity, response time, run-time platform, development
environment, or those inherent in the programming language. Concepts
in the analysis model are mapped onto implementation classes and
interfaces resulting in a model of the solution domain, i.e., a
detailed description of "
Dave Cooper's avatar
Dave Cooper committed
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
	(:emph "how") 
	" the system is to be built."))

      ((:section :title "The Object-Oriented Paradigm meets the Functional paradigm")
       "In order to model very complex products and efficiently manage
large bodies of knowledge, KBE systems tap the potential of the object
oriented nature of their underlying language (e.g. Common
Lisp). ``Object'' in this context refers to an instantiated data
structure "
       (:emph "of a particular assigned data type")
       ". As is well-known in the computing community, unrestricted state
modification of objects leads to unmaintainable systems which are
difficult to debug. KBE systems manage this drawback by strictly
controlling and constraining any ability to modify or ``change state''
of objects.

In essence, a KBE system generates a tree of inspectable objects which
is analogous to the function call tree of pure functional-language
systems.")
Dave Cooper's avatar
Dave Cooper committed
230
231
232

      ((:section :title "Goals for this Manual")
       "This manual is designed as a companion to a live two-hour
Dave Cooper's avatar
Dave Cooper committed
233
234
235
236
237
GDL/GWL tutorial, but you may also be relying on it independently of
the tutorial. Portions of the live tutorial are available in
``screencast'' video form, in the Documentation section of "
       (:texttt "http://genworks.com")
       " In any case, our fundamental goals of this Manual are:"
238
       ((:list :style :itemize)
Dave Cooper's avatar
Dave Cooper committed
239
	(:item "To get you motivated about using Genworks GDL")
Dave Cooper's avatar
Dave Cooper committed
240
241
242
243
	(:item "Enable you to ascertain whether Genworks GDL is an appropriate tool for a given job")
	(:item "Equip you with the ability to state the case for using GDL/GWL when appropriate")
	(:item "Prepare you to begin authoring and maintaining GDL
applications, or porting apps from similar KB systems into GDL."))
244
       
Dave Cooper's avatar
Dave Cooper committed
245
       "The manual will begin with an introduction to the "
246
       (:indexed "Common Lisp")
Dave Cooper's avatar
Dave Cooper committed
247
248
249
250
251
252
       " programming language. If you are new to Common Lisp: welcome!
You are about to be introduced to a powerful tool backed by a
rock-solid standard specification, which will protect your development
investment for decades to come. In addition to the overview provided
in this manual, many resources are available to get you started in CL
--- for starters, we recommend "
253
254
255
256
       (:underline (:indexed "Basic Lisp Techniques") )
       (:footnote (:underline "BLT")
		  " is available at "
		  (:texttt "http://www.franz.com/resources/educational_resources/cooper.book.pdf"))
Dave Cooper's avatar
Dave Cooper committed
257
       ", which was written by the author. ")
258
      
Dave Cooper's avatar
Dave Cooper committed
259
260
      ((:section :title "What is GDL?")
       "GDL is an acronym for
Dave Cooper's avatar
Dave Cooper committed
261
262
263
264
``General-purpose Declarative Language.''"
       (:ul
	(:li
	 "GDL is a superset of ANSI Common Lisp, and consists largely of
265
automatic code-expanding extensions to Common Lisp implemented in the
Dave Cooper's avatar
Dave Cooper committed
266
form of macros. When you write, for example, 20 lines in GDL, you
Dave Cooper's avatar
Dave Cooper committed
267
268
might be writing the equivalent of 200 lines of Common Lisp. Given
that GDL is a superset of Common Lisp, you of course still have the
Dave Cooper's avatar
Dave Cooper committed
269
full power of the CL language at your disposal whenever you are
Dave Cooper's avatar
Dave Cooper committed
270
working in GDL.")
271
272
273
274

       (:index "compiled language!benefits of")
       (:index "macros!code-expanding")
       
Dave Cooper's avatar
Dave Cooper committed
275
276
       (:li
	"Since GDL expands into CL, everything you write in GDL will be
277
compiled ``down to the metal'' to machine code with all the
Dave Cooper's avatar
Dave Cooper committed
278
279
280
281
optimizations and safety that the tested-and-true CL compiler provides
[this is an important distinction as contrasted to some other
so-called KB systems on the market, which are essentially nothing more
than interpreted "
Dave Cooper's avatar
Dave Cooper committed
282
283
284
	(:emph "scripting languages") 
	" which often impose arbitrary limits on
the size and complexity of the application.")
285

Dave Cooper's avatar
Dave Cooper committed
286
287
       (:li "GDL is also a "
	    (:emph (:indexed "declarative"))
288
	    " language in the fullest sense. When you put together a
Dave Cooper's avatar
Dave Cooper committed
289
290
291
292
293
294
295
GDL application, you think and write mainly in terms of "
	    (:emph "objects")
	    " and their properties, and how they depend on one another
in a direct sense. You do not have to track in your mind explicitly
how one object or property will ``call'' another object or propery, in
what order this will happen, and so forth. Those details are taken
care of for you automatically by the embedded language.")
296

Dave Cooper's avatar
Dave Cooper committed
297
       (:li "Because GDL is object-oriented, you have all the features you would normally expect
298
299
300
301
302
303
from an object-oriented language, such as "
       ((:list :style :itemize)
	(:item "Separation between the " (:emph "definition")
	       " of an object and an " (:emph "instance") " of an object")
	(:item "High levels of data abstraction")
	(:item "The ability for one object to ``inherit'' from others")
Dave Cooper's avatar
Dave Cooper committed
304
305
	(:item "The ability to ``use'' an object without concern for
	its ``under-the-hood'' complexities"))
306
307
       
       (:index "object-orientation!message-passing")
Dave Cooper's avatar
Dave Cooper committed
308
309
310
       (:index "object-orientation!generic-function"))

       (:li "GDL supports the ``message-passing'' paradigm of object
Dave Cooper's avatar
Dave Cooper committed
311
orientation, with some extensions. Since full-blown ANSI CLOS (Common
Dave Cooper's avatar
Dave Cooper committed
312
313
314
315
Lisp Object System) is always available as well, you are free to use
the Generic Function paradigm too. Do not be concerned at this point
if you are not fully conversant of the differences between Message
Passing and Generic Function models of object-orientation."
316
317
318
       (:footnote "See Paul Graham's "
		  (:underline "ANSI Common Lisp")
		  ", page 192, for an excellent discussion of the Two Models 
Dave Cooper's avatar
Dave Cooper committed
319
320
321
of Object-oriented Programming. Peter Siebel's "
		  (:underline "Practical Common Lisp")
		  "also covers the topic; see http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html.")
Dave Cooper's avatar
Dave Cooper committed
322
       ".")))
323
      
324
      ((:section :title "Why GDL (i.e., what is GDL good for?)")
325
       ((:list :style :itemize)
326
	(:item "Organizing and integrating large amounts of
Dave Cooper's avatar
Dave Cooper committed
327
328
329
information in ways which are impossible impractical using
conventional languages, CAD systems, and/or database technology
alone;")
330
331
	(:item "Evaluating many design or engineering alternatives and 
performing various kinds of optimizations within specified design
Dave Cooper's avatar
Dave Cooper committed
332
333
spaces, and doing so"
	  (:emph "very rapidly;"))
334
	(:item
Dave Cooper's avatar
Dave Cooper committed
335
336
	 "Capturing, i.e., implementing, the procedures and rules used
to solve repetitive tasks in engineering and other fields;")
337
338
	
	(:item
Dave Cooper's avatar
Dave Cooper committed
339
340
341
	 "Applying rules you have specified to achieve intermediate
and final outputs, which may include virtual models of wireframe,
surface, and solid geometric objects.")))
342
343
344
345
346
      
      ((:section :title "What GDL is not")
       ((:list :style :itemize)
	(:item "A CAD system (although it may operate on and/or generate geometric entities);")
	(:item "A drawing program (although it may operate on and/or generate geometric entities);")
Dave Cooper's avatar
Dave Cooper committed
347
	(:item "An Artificial Intelligence system (although it is an
348
349
excellent environment for developing capabilities which could qualify
as such);")
350
351
	(:item "An Expert System Shell (although one could be easily embedded within it).")))
      
Dave Cooper's avatar
Dave Cooper committed
352
      "Without further description, let's turn the page and get
Dave Cooper's avatar
Dave Cooper committed
353
      started with hands-on GDL..."))
354