Board index » delphi » Re: Delphi vs Web/Scripting Languages

Re: Delphi vs Web/Scripting Languages


2008-05-30 02:30:06 PM
delphi263
Craig Stuntz [TeamB] writes:
Quote
m. Th. writes:

>...and don't you think that these qualities can be adopted by 'a
>certain language which we all know'? (even if we can speak about
>their 'maintainability' - you mention it due their expression power,
>isn't?)

I'm pretty much certain that no one language will ever be appropriate
for all tasks. In particular, domain-specific languages can have
really compelling advantages in terms of maintainability and
expressivity in the areas they target. Moreover, the question is much
bigger than the language; the frameworks which come with the languages
are every bit as important.

Yes, of course. But my point was/is 'what can we borrow, if we can
borrow something'.
--
m. th.
 
 

Re: Delphi vs Web/Scripting Languages

Brian Moelk writes:
Quote
m. Th. writes:
><quote>
>
>The gap between the best software engineering practice
>and the average practice is very wide—perhaps wider than in
>any other engineering discipline. A tool that disseminates
>good practice would be important.
>
>—Steve McConnell citing Fred Brooks in 'CodeComplete 2nd Edition'
>
></quote>

But Delphi allows as many variables as you want declared at the top of a
huge OnClick handler...how is that any more good practice than inline
variable declaration within a {*word*99}py C routine?

No, is not better. But the experience shows that 'huge OnClick handlers'
are much more harder to find than '{*word*99}py C routines'.
Quote
The bottom line here is that good practice cannot realistically be
imposed by a tool or language, but is more likely to be encouraged by a
community.

...and let's say that 'tools and languages' doesn't matter in achieving
better code, as you say. Then, wouldn't more logical to choose a tool
which gives you
- greater speed - ie. a native code compiler
- better usage of resources (memory, CPU) - ie. no Garbage collectors,
no VM to occupy memory etc.
- more easier deployment - single exe compared with a bunch of files
(the 'runtime') and source code which must be obfuscated in order to
protect your IP?
Imho, your position is in favor of a compiler. And if this compiler is
made x-platform thing which is certainly doable, and it was done by
several projects already (I don't mean now Delphi necessarily) then
where is the advantage of the family of languages which you support?
...but my intent isn't to win a language war, is to enhance my tool in
which it happens to do our programs, knowing very well that this tool
cannot be 'the best of everything for everyone' (btw, Delphi tried that
in the past, as you know - with well known results).
Also, I am afraid to 'win a language war' because there are 'some people'
which can easy say "What I would told you? Our Delphi is the best one. Let's
leave it as a cash cow in a splendid isolation self contemplating it's
eternal glory in the light of the leader of the open ALM revolution."
Not that this can happen, but just to be sure...
I just try to see what are the goods and the bads of this tool from a
critical POV in order to leverage the work which is done by other
communities. And, yes, imho, a tool, as a result of a thinking process
of a team (which is a small community inside in a company/foundation
etc.), can influence the 'outside' community. And, also, the other
informational stream must exist: The community feedback must influence
the tool. that is why I do all these posts. In fact, the most daunting
thing in all this thread (and the 'crux' of it - to cite you) for me was
Robert's statement when I have asked him to vote on certain QC entries:
<quote>
Why would I want that? Do you really believe they would add anything of
this into Delphi?
</quote>
Why a logical developer, as he seems to be, to have reasons to post such
a statement? Because we all know that he have reasons to post it...
Concretely, what/which features do you find useful in Ruby (with which
it seems that you have a certain experience) which, based on your
experience as a programmer, can be 'imported/adapted/implemented (etc.)'
in Delphi?
--
m. th.
 

Re: Delphi vs Web/Scripting Languages

Robert Giesecke writes:
Quote
James K Smith writes:
>
>// introducing create-assign "::="
>procedure EvilAndConcise;
>f:= 0.0d; // compiler error, declaration does not exist
>f::= 0.0d; // ok
>f:= 0.1d; //ok
>f::= 0.1d; // compiler error, declaration already exists
>end;
>

Why not put a "var" in front? Solving this by a symbol rather than a
keyword is fortunately as un-pascal-ish as it is ever gonna get. IOW:
creating vars by a hard to spot double colon won't find its way into any
language that I will be using.
If it will be inline variables in Delphi, for sure I support your POV.
--
m. th.
 

Re: Delphi vs Web/Scripting Languages

m. Th. writes:
Quote
Robert Giesecke writes:
>
>Did you just use a safecast to provide a local alias?
>

AFAIU ListBox1.Items.Objects[i] are TObject and hence MyStuff.DoThis
cannot be executed ('DoThis' isn't defined in TObject). If you speak
about a form of let's say type inference/dynamic typing, then this
cannot be checked at design time AFAIS now.

Not at all what I meant.
He did provide a hardcast to TMyType, and then something that looks like a safecast ( "as MyStuff") to
create a variable.
 

Re: Delphi vs Web/Scripting Languages

Keith Latham writes:
Quote
Robert Giesecke writes:
>
>Phewww.... Someone seems to have a real dogma problem right there...
>

Sorta like my drinking 'problem'. I drink. I get drunk. I fall down. I
throw up. I pass out. What's the problem?

Bad for your teeth, go ask Rudy! *g*
Quote
>
>What in hell lets you think, that moving variable declarations away
>from their actual uses, and forcing them to be scope not only to a
>small block, but to the whole method is anything but *less* readable
>and *less* manageable?

Because they become HIDDEN. Unobvious. Unclear. Invisible.

Have you ever heard of the koan: Where is the best place to hide a book?
Answer: In a library.

And where's the problem? you only need to know the vars when you read code that is using them.
Having usage and declaration as close together as possible, pretty much makes this a non-issue.
Quote

Also because the Compiler cannot easily separate modifiable data areas
from unmodifiable code areas.

The compiler should know that very well, no matter which syntax was used to get the variables.
I can not possibly see how that could be an issue.
Quote

Could it be that YOU have been so steeped in C-like syntax that you
think its many glaring defects are actually advantages?

Nope, don't like it, actually. ;-)
I am just not dogmatic about what my language must not be capable of.
Not in the religious kind of way.
I am happy that is has no "goto", isn't needed anymore by the plethora of smart jump statements.
(method, if, for, while, case, ...)
Quote
>
>var miep := 1;

This is just a minor variation on a constant declaration and
initialization. But since it is a variable, what is your objection to
declaring the data type? Type checking is a VITAL advantage of Pascal.
If this syntax were added to Pascal, I'd suggest that miep should
end up as a variant.

It is an Integer;
Quote
>
>with xyz := GetSomeValue() do
>begin
>//xyz only lives here
>end;
>

So all xyz is, is an alias for the GetSomeValue() function result?
It is a variable that holds the result. I used "alias" more in a way to distinguish it from the
horrible with-statement that Wirth had removed from Pascal's successors.
Quote
You are just causing more work for the compiler and putting more strain on
the stack for no good reason. Pascal has ways to do solve the problem of
repeated calls to a function with the same parameters. Why beat your
head against the wall? Who's dogmatic now?

It is just a local var, but limited in scope in a way that is easier to read, compared to:
begin
var xyz := GetSomeValue();
end;
Quote
>using xyz := GetSomeValue() do
>begin
>// xyz only lives here
>// and gets disposed at the end
>end;
>

Why should it even come into existance? It just causes more trouble than
it is worth. By forcing it to be surfaced as a variable, you are
eliminating the possibility that the compiler might be able to keep it
in a register or something and requireing the executable to keep track
of resources that serve no purpose.

Do you actually know what you are writing, or did you just mixed some random technical terms in a
paragraph?
Have you ever had a try-finally-free block?
This is exactly the same thing, just without the need to declare the var for the whole method or state
its type. And w/o the rather noisy syntax of try-finally-free.
The type gets inferred from the assignment. (no problem, if you actually want to specify the type)
Quote

Don't get me wrong. Its perfectly OK for Pascal to change over time. But
a language has a 'feel', and "Pascal-ness" is a definate positive feel.

<snip>

It really makes no sense to complain that a hoe isn't a rake, but if we
just cut a few slots into it then it would be just like a rake. You
might come up with some improvements for a hoe, but if you turn it into
a rake it isn't a hoe anymore.
You do know, that I am using these constructs in my code on a daily basis?
And the language I am using feels very much like Pascal should have felt, just w/o most of the
tediousness and noise.
 

Re: Delphi vs Web/Scripting Languages

m. Th. writes:
Quote
....and let's say that 'tools and languages' doesn't matter in achieving
better code, as you say. Then, wouldn't more logical to choose a tool
which gives you
- greater speed - ie. a native code compiler
- better usage of resources (memory, CPU) - ie. no Garbage
collectors, no VM to occupy memory etc.
- more easier deployment - single exe compared with a bunch of files
(the 'runtime') and source code which must be obfuscated in order to
protect your IP?
This depends entirely on the application/domain. And don't assume that
resources don't include human ones, and that greater speed doesn't
include time to market.
[...]
Quote
....but my intent isn't to win a language war, is to enhance my tool in
which it happens to do our programs, knowing very well that this tool
cannot be 'the best of everything for everyone' (btw, Delphi tried that
in the past, as you know - with well known results).
[...]
Certainly, I can understand your intent. How many times can the Delphi
community repeat the requests? :)
Quote
Concretely, what/which features do you find useful in Ruby (with which
it seems that you have a certain experience) which, based on your
experience as a programmer, can be 'imported/adapted/implemented (etc.)'
in Delphi?
Hard to say off the cuff...Delphi is Delphi and Ruby is Ruby. My point
is that simply because they take different approaches to building an
application, IMO, that doesn't mean that one is more suited to large
scale projects than the other.
--
Brian Moelk
Brain Endeavor LLC
XXXX@XXXXX.COM
 

Re: Delphi vs Web/Scripting Languages

m. Th. writes:
Quote
But my point was/is 'what can we borrow, if we can borrow something'.
1. Variable type inferencing. Not as good as a dynamic language in
terms of reducing typing, but it helps a lot and retains all of the
advantages of static typing.
2. First class frameworks for certain problem domains. Easier said
than implemented.
3. The ability to use dynamicism in the cases where there really
aren't any alternatives and it helps a lot (compare Ruby's ActiveRecord
with Delphi's TDataSet with regards to accessing individual field
values).
Plus there are things that are done well by non-dynamic languages, but
which are apropos to this discussion:
1. Optimizations of virtual function performance. The fact that we can
use static functions has perhaps kept us from questioning why virtual
function performance must be worse than static function performance in
all cases. In time-critical situations (e.g., inside a loop), there
are optimizations which can bring virtual function performance close to
static function performance. Java already does this, in the academic
work on the technique is decades old.
2. Garbage collection or some other method of automated memory
management. There are a lot of reasons for this. I have discussed some
of them on my blog. But insofar as this discussion is concerned, the
killer feature here is reduced typing and maintainability of code.
3. First-class functions, lambda expressions, code and types as
objects, etc.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
IB 6 versions prior to 6.0.1.6 are pre-release and may corrupt
your DBs! Open Edition users, get 6.0.1.6 from mers.com
 

Re: Delphi vs Web/Scripting Languages

Keith Latham writes:
Quote
>My code is way less verbose (in the sense of noisy) and I can read
>it much faster. Type inference allows me to change the return
>type of a method to be an interface w/o needing to change any
>code... And with inline vars, I don't have to check where a var is
>used, because I can limit its scope to 2 or 3 lines.
>
>var miep := 1;

This is just a minor variation on a constant declaration and
initialization. But since it is a variable, what is your objection to
declaring the data type? Type checking is a VITAL advantage of
Pascal. If this syntax were added to Pascal, I'd suggest that
miep should end up as a variant.
Now, that is entirely wrong. Type inferencing *is* static typing.
With dynamic typing you don't need type inferencing. When you
inference a type, you have *all* of the advantages of static type
checking.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Everything You Need to Know About InterBase Character Sets:
blogs.teamb.com/craigstuntz/articles/403.aspx
 

Re: Delphi vs Web/Scripting Languages

Craig Stuntz [TeamB] writes:
Quote
Now, that is entirely wrong. Type inferencing *is* static typing.
With dynamic typing you don't need type inferencing. When you
inference a type, you have *all* of the advantages of static type
checking.
FWIW, "inferencing" should be "inferring" and "inference" (in this
context) should be "infer" (and it wouldn't be you doing it, rather the
compiler <g>).
infer, inferring, inference, inferred, inferable(/inferible/inferrible),
inferably, inferrer, infers, aneurysm.
 

Re: Delphi vs Web/Scripting Languages

Craig Stuntz [TeamB] writes:
Quote
m. Th. writes:

>But my point was/is 'what can we borrow, if we can borrow
>something'.

1. Variable type inferencing. Not as good as a dynamic language in
terms of reducing typing, but it helps a lot and retains all of the
advantages of static typing.

Sure. But while in case of procedures, the definition is quite
straightforward (imho) like Write(a, b, c) (see, we was one of the first
ones to have type inference! <g>), in the case of functions how do you
see the syntax? Or we should rely only on var parameters like let's say
ReadLn(var a, var b, ...)
Also, if I will open a QC on this, would you vote for it?
Quote
2. First class frameworks for certain problem domains. Easier said
than implemented.

100% agree. 'Certain problem domains' from top of my head:
- parallel programming (including distributed/cloud computing)
- database access/data binding
- containers, data structures.
Quote
3. The ability to use dynamicism in the cases where there really
aren't any alternatives and it helps a lot (compare Ruby's
ActiveRecord with Delphi's TDataSet with regards to accessing
individual field values).

Definitely. IIRC, Uwe Schuster put something like this in CC, using
variants. (Nick featured it in his blog, btw). Perhaps CG guys will do
something similar, but faster and feature richer, since they have
'everything' (compiler, language specification, IDE, VCL etc.). Only a
little bit of determination perhaps is required...
Btw, I see this in accessing fields (as you noted) like in eg.
MyDataSet.Field1.AsString and in other database actions Eg. locating -
MyDataSet.Field1.Locate('MyVal') - this would improve a lot the
maintainability and as a 2dary effect, speed imho. (QC #56798 - vote for
it! :-) ) Also, the main locate method can be overloaded in
MyDataSet.Locate(aFields: Array of Fields; aValues... ) - with the same
benefits in code quality. (QC #56797 - vote also here!)
Quote
Plus there are things that are done well by non-dynamic languages,
but which are apropos to this discussion:

1. Optimizations of virtual function performance. The fact that we
can use static functions has perhaps kept us from questioning why
virtual function performance must be worse than static function
performance in all cases. In time-critical situations (e.g., inside
a loop), there are optimizations which can bring virtual function
performance close to static function performance. Java already does
this, in the academic work on the technique is decades old.

+1. And if they'll work on this, perhaps they'll have a look also to
virtual methods 'problem' in class helpers..
Quote
2. Garbage collection or some other method of automated memory
management. There are a lot of reasons for this. I have discussed some
of them on my blog. But insofar as this discussion is concerned,
the killer feature here is reduced typing and maintainability of
code.

...hummm.... ...mmmmm.... Even if it happens that the QC #52966 ('Add
Programmer controlled Garbage Collection in Delphi') to be submitted by
your truly (did I mention to vote for it?), I have a cold feeling about
the 2ndary effects which a GC can induce. In that report I tried to find
a way in which such an engine can be configurable in order to not
'harm'. What do you think?
Quote
3. First-class functions, lambda expressions, ...
QC #49996. Vote for it (well, now we can vote on 'unlimited' reports),
even if my nose tells me that we'll have this in Tiburon.
Quote
code and types as objects, etc.

Can you expand it? Some ideas: Having an expanded (in which way?)
TMethod/TProcedure or perhaps a TCode like in QC #62319 - 'Add the
posibility of metaprogramming / runtime evaluation / runtime compiler'?
And, oh, btw did I mention to vote for it? :-)
HTH,
PS: I am reading a little bit about comprehension lists & tuples in
Python. Can you 'prepare' a little bit on Haskell? I will try (if I'll
have time) to 'attack' you there after we'll advance with this... :-)
--
m. th.
 

Re: Delphi vs Web/Scripting Languages

m. Th. writes:
Quote
Can you 'prepare' a little bit on Haskell?
I don't understand what you're after here.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Useful articles about InterBase development:
blogs.teamb.com/craigstuntz/category/21.aspx
 

Re: Delphi vs Web/Scripting Languages

Keith Latham writes:
Quote

Have you ever heard of the koan: Where is the best place to hide a book?
Answer: In a library.
Koans are not supposed to be answerable easily. They are meant to
enlighten someone!
 

Re: Delphi vs Web/Scripting Languages

Robert Giesecke writes:
Quote
>

Not at all what I meant.
My fault. Please forgive me.
--
m. th.
 

Re: Delphi vs Web/Scripting Languages

"Yogi Yang 007" <XXXX@XXXXX.COM>writes
Quote
Keith Latham writes:

>
>Have you ever heard of the koan: Where is the best place to hide a book?
>Answer: In a library.
Koans are not supposed to be answerable easily. They are meant to
enlighten someone!
True. I used the word incorrectly (and I knew it), but I couldn't think of a
better one at the time.