Re: OOPs!! When is a class not a class? (Re: Number/Specificality/Archetypes in Language)
From: | Philippe Caquant <herodote92@...> |
Date: | Saturday, September 25, 2004, 15:28 |
--- Ray Brown <ray.brown@...> skrev:
> > As I understood from Flanagan's "JavaScript" (I'm
> > currently at page 344 of the French edition, and
> there
> > are 955 in all), JavaScript in not a real OOP, but
> it
> > more or less behaves like an OOP.
>
> Either your Flanagan ain't the David Flanagan who
> wrote "JavaScript: the
> Definitive Guide" or he's changed his mind or
> something has gone awry in
> the translation.
Same Flanagan. In chapter 8, paragraph
"Object-oriented JavaScript (seems Flanagan doesn't
know one can can give numbers to paragraphs in a doc
:-( ), he writes (I'll better not translate back to
avoid mistakes): "La conception commune aux langages
de programmation oriente's objet est qu'ils sont
fortement type's et qu'ils prennent en compte
l'heritage de classe. Sur la base de ces criteres,
JavaScript n'est pas un veritable langage oriente'
objet et il est facile de l'exclure de ce groupe". But
two sentences further, "A cet egard, JavaScript est un
vrai langage oriente' objet". So it seems that there
is no definitive definition of what an oriented-object
language is, and thus JavaScript is sometimes one of
them and sometimes not.
In "JavaScript: the Definitive
> Guide" (page 137 of the
> Third edition) he writes:
> "The truth is that JavaScript is a true
> object-oriented language. It draws
> inspiration from a number of other (relatively
> obscure) object-oriented
> languages that use prototype-based inheritance
> instead of class-based
> inheritance."
>
> By 'other' he means other than classic OOP languages
> like C++ and Java,
> which uses class-based inheritance.
Yes. Anyway, be it object-oriented or not, what I want
is to be able to design a formular showing data to the
user and/or allowing him to fill the fields, and
allowing me to check them and to incorporate the data,
when needed, in a database. (This is an example).
> > As I don't know Java
> > neither C++, it's hard for me to explain it
> smartly.
> > What I know is that JS has no types
>
> Is this your first experience of an untyped
> language? You've a lot to
> learn :)
Precisely no: I'm very used at Pick Basic, which is
completely untyped, and is very easy to use. But it
doesn't allow you to make Web applications, AFAIK (or
maybe some recent version does ?)
> > and confuses "+"
> > and "concatenate" (well, it doesn't really confuse
> > them, it only makes it very likely that you will
> have
> > problems with that some day),
>
> Eh?? But "+" is commonly used for concatenation.
> I've used it for years
> and so far have had no problems.
In Pick Basic: concatenation = ":", addition = "+". So
the program performs concatenating or adding,
depending of what *you* told it (by using an operator
meaning what *you* mean, and not what *it* fancies
(because he finds that 1st or 2nd operand happens to
be a number or a string). What is important is the
operator. When Pick Basic finds something like 'x =
"aaa" + "bbb"', it answers you quite logically: hey,
wait, "aaa" is not a number, it is a string, and so is
"bbb", so I cannot perform what you told me, thus I
consider that operands will have a zero value and I
will return 0, plus an error message. Perfectly
logical. But when you write something like 'x == a +
b' in JavaScript (in case this syntax would be ok),
JavaScript will perform, either an addition, either a
concatenation, depending of the current type of the
operands, and signal you no error. Are you always sure
of what are the current types of a and b, in an
untyped language ? I'm not. Thus you can fancy that
you will add 2 + 2, and JavaScript will return you
"22", because one of the operands, or perhaps both,
happen to be considered as strings at this moment.
When you say 'x = "2"+"2"' to Pick Basic, it performs
a type conversion and returns 4. Right, because what I
wanted to do was adding. When you say 'x = 2:2', it
will return "22". Right, because what I wanted was
concatenating.
>
> How can you learn Apache?? It's a webserver (and a
> ood one too IMO) -
Well, I suppose, by buying some nice book at 45 euros
like:
http://www.amazon.fr/exec/obidos/ASIN/284177225X/pd_ka_0/402-6817569-0144140
> unless you actually mean the language of the Apaches
> of North America
> (That's much more interesting!).
Yes, I think so. BTW, I recently learned that Apache
is pronounced like "Apatshee" by the Anglo-Saxon,
while we say "Apash". So my knowledge is not totally
null on that topic :-)
> You sound like a
> carpenter bemoaning having to learn how use all the
> different tools of
> carpentry.
Yes, looks like that. Yet in my different jobs I've
programmed and maintained entire applications in
Basic, Cobol, PL/1 (and also a personal application in
Assembler on Apple II, long ago). But that's not of
any help to me: everything to learn from zero, or
nearly, once again.
>
> I hate to disillusion you, but it is quite easy to
> put a page on the
> Internet that says "Hello World" and you do *not*
> need DHTML, XTHML, XML,
> XSL, PHP, MySQL, Perl, Unix, vi, Apache, or Tomcat
> in order to do it!
Yes, it was a metaphor. I know how to show a message
"Hello, world" on a screen:
<html>
<head>
<title>Hello, world></title>
</head>
<body>
Hello, world
</body>
</html>
(hope I'm right)
But all the tools I mentioned I should *really* know
(more or less) to be efficient in my present job.
Looks like quite a lot, isn't it ? While the
functionalities are (mainly) *still the same ones* I
already programmed 20 years ago (only, not for the
Web). Where is the progress ? Development environments
should be easier and easier (and more and more
intuitive), to gain in efficiency and productivity.
Namely, what took me 3 days, 20 years ago, should take
me 3 hours by now. Actually, it takes me 3 weeks, plus
the risk for a nervous breakdown :-(
(Oh, and I forgot: of course, I have to add Oracle,
SQL and PL/SQL to the list).
=====
Philippe Caquant
Ceterum censeo *vi* esse oblitterandum (Me).
Replies