A
Avowkind
Andrew, that's very good description, and I totally agree !> if your problem domain is controlling a water works then you may tend
I would go one step beyond that, and state the problem as:
"keep the reservoir full, but not too full"> which in python might turn out to be
And now the solution is less close ;-)
And it becomes even less close,
if we extend your solution somewhat more to a real world implementation,
something like this:
control = True
while control :
if water_level > 10:
pump.start()
if water_level < 5:
pump.stop()
And if you would propose this solution to a control system engineer,
he/she would say: "this solution works very bad" or even "this solution
won't work"
A solution that would work, should incorporate at least a hysteresis and
could look like this:
control = True
State = False
while control :
if State and ( water_level > 10 ) :
pump.start()
State = not ( State )
elif not ( State ) and ( water_level < 5 ) :
pump.stop()
State = not ( State )
and now what's the resemblance to the orginal problem :
"keep the reservoir full, but not too full"
;-)
So an adequate high level language,
should do exactly like a control engineer would do (btw I'm not a
control engineer):
1- asking what do you mean by "full"
2- not asking what's the other level,
but asking what's the intended use: how often and how many water is
added or used,
what are the costs of the pump, etc etc
after which
the control engineer
or
the high level language
can calculate the optimal hysteresis.> of course with the addition of some brackets C++ could be this clear
I agree that some problems are better described in one or the other form,
but it's not the major issue.
e.g. Flowcharts are a perfect high level solution for problems in many
domains.
But flowcharts, just like computer languages, visual design languages
and math,
are only valuable in the hands of domain experts.
What the major issue is,
that makes a computer language or a design environment in general,
really high level,
is the availability of the domain expertise.
Therefor the only high level language I'm aware of is ...
... LabView
Labview offers a lot of domain expertise in almost any domain,
so anyone
with just a little knowledge of the problem domain,
and
with just a little programming experience or math knowledge,
can solve any problem in every domain with Labview.
Possibly I'm exaggerating a bit ;-)
cheers,
Stef
creating a short example to illustrate a point is always dangerous
<digression>
I chose the pumping station because many years ago I used to do plant
control programs in Forth. One engineer I worked with had described
the requirements in such terms as you give.
e.g keep the tank not too full or empty, but run the pumps at least 4
hours a day.
I considered writing a declarative rule based language to express
this. but on further conversation I found that the engineers already
had a semi formal procedural notation used for manual instructions
which it was very easy to adapt Forth to parse.
Forth's defining words allowing the creation of new language
constructs always made writing domain specific programs easy.
I mention this as, having been writing C++ for 15 years since those
days. Python is the first new language that I really feel comfortable
with and that carries that same feeling of expressiveness.
</digression>