[
Lists Home |
Date Index |
Thread Index
]
Hello Douglas
Douglas said:
> Quick question, what are you classifying as procedural and functional
languages.
>
> IOW what is the break down of what you mean.
>
> Douglas
Didier replies:
In procedural languages you say *how* to do things. In functional languages
you say *what* you want. For instance, languages like Visual Basic are
procedural language because you specify to the system a sequence of actions
to perform, something like "display", "calculate", "store", "recall". In the
case of functional language, you do not have to say "display" you specify
what you want as final result. For instance by specifying a template. There
are also other more subtle elements to consider but these two elements catch
the essential spirit of procedural vs. functional or the opposition of "how"
vs. "what". In one case you tell the system what kind of action to perform,
in the other case you specify what you want as final result.
Off course, Visual basic is a strange beast since you visually specify the
visual end result by placing components in a form. And this could be
considered as specifying "what" we want in terms of visual layout [1]. So
probably we would have to use a more precise definition for both concepts.
For the quest of precision let say that on the one hand you have languages
like XSLT used to manipulate document structures. So to speak, as input
there is a document and as output an other document (but structured in a
different way and probably based on a different domain language). On the
other hand, you visually lay components on a finite plane (i.e. a form) and
use procedural code to specify the sequence of actions the system has to
perform.
An other way to see things is to say that languages like XSLT are used to
implement interpreters. As an example, XHTML is a domain language based on
the XML syntax and structural rules. An XSLT template provides a domain
language interpreter allowing to interpret a language, for instance FinML.
The result of this interpretation (i.e. the output) is not a sequence of
actions but an other document structured in accordance with a different
domain language, XHTML.
So, in final analysis we can say that one approach is to create interpreters
that will interpret (i.e. transform) a domain language. The result (i.e.
output) is another domain language. This permits to provides different
interpretation from the same domain language. For instance to interpret a
finML document into different rendering language.
On the other hand, visual basic do not provide an interpretation, a visual
basic program is a sequence of action, not an interpretation context. Visual
basic leads to a direct connection to instructions to be performed by the
processor. XSLT is a script/template to be executed, the execution is a
sequence of action. We can say that XSLT leads to meta programming since
what is created is a document containing the "what" to do. XSLT adds an
extra step but allows the versatility of meta programming. For instance, it
offers the protential of "just in time" programming based on a particular
context. This is a feature not well documented nor well known by our
community.
Two completely different approach. Two completely different paradigms. If
you want to dig more on the two approaches, read some my previous articles
[2]. In the near future I'll write another series of articles about this
topic.
Cheers
Didier PH Martin
[1] this is also called visual programming.
[2] http://www.xml.com/pub/au/16
|