C++, C# or Java.

C

Chris Smith

Roedy Green said:
I think it means you can handle much larger loads simply by increasing
the speed and capacity of the hardware, or the number of cpus, or
expense of the container software and database engine, without a
fundamental rewrite of the code.

What do you think it means?

I'll butt in. I think I'd choose a slightly narrower definition of
scalability. Off the top of my head, here's what I'd say. Scalability
is the property of code that its performance increases commensurately as
certain architectural changes are made to the platform.

Increasing speed is really a degenerate form of scalability, in that I'd
have a tough time writing code that doesn't perform better when running
on a machine that's 150% as fast (in CPU, disk access time, network
throughput, etc.) as the baseline. Such a piece of code would have to
include an artificial limit on performance, for example by frequently
calling Thread.sleep. For that reason, I don't think it's useful to
talk about scalability unless there are architectural changes.

Examples of scalability *would* include applications that perform better
as the number of CPUs in a box is increased; i.e., that exploit
multithreading or multiple processes well. Examples would also include
networked architectures that allow increasing the number of boxes where
the application runs, and so forth. Java does fairly well at providing
the tools to write scalable applications... but the central issues in
scalability are at a much higher level than the programming language.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
O

Oliver Wong

Tim Tyler said:
How would programmers enter and edit these symbols using a conventional
keyboard?

If you have a friend who regularly types in Japanese characters on a
Windows XP machine which has a typical Qwerty keyboard, watch how they are
able to type in Japanese just as quickly as we are able to type in English.
It's quite a fascinating design, actually. What the user does is essentially
type in how the character is pronounced. When the user hits the space bar,
indicating the end of a word, a list of all characters matching that
pronounciation are displayed (there are a great deal of homophones in
Japanese, so this list may be rather long), ordered by frequency of usage.

A similar tactic could be usedfor programming. E.g. the user would
actually type out "summation" and upon hitting spacebar after the final n,
the word would be replaced by the actual summation symbol.
Are there any other programming languages that have adopted this approach?

Supposedly, this is the source code for a function written in APL which
takes a list of integers where all but one of the values are duplicated, and
returns the value which is not duplicated (I can't verify as I don't know
APL at all):

http://pws.cablespeed.com/~mwojcik/find-unique-apl.png

Note that this is just an example of using non-ASCII characters in a
programming language; I have no idea if operator overloading is used
anywhere in that code.

- Oliver
 
O

Oliver Wong

Bent C Dalager said:
I don't find it half as bad as operator
overloading, though, in that when you see e.g.,
int a = b @ c;
you fully expect something strange to be going on and you'll know to
look up the operator definitions on b and c.

Let's say you're given code written by a coder who is at least
semi-competent. When you see the line, "int a = b @ c;", you really have no
idea what "@" does, and you pretty much HAVE to stop whatever you're doing,
memorize where you are in the code, push in a new stack frame in your mind,
and navigate to the definition for @ between B and C. While reading that,
you might see further operators your don't recognize, have to push yet more
stack frames into your mind and read those, until your brain throws a stack
overflow error and you forget what you were trying to do in the first place.

On the other hand, if you see code like:

int a = VectorOperations.dotProduct(b, c);

again, assuming the code was written by a semi-competent and
non-malicious coder, you can assume for now that the intent was to actually
get the dotProduct of b and c (and not, for example, to reformat the
harddrive), and you can keep focusing on the code you're looking at now.

- Oliver
 
T

Tor Iver Wilhelmsen

Tim Tyler said:
How would programmers enter and edit these symbols using a conventional
keyboard?

Either the same way they enter and edit non-ISO-Latin characters today
(using \uxxxx escapes) or by using UTF-8 source files and an IDE that
keeps track of the symbols you use for operators. Keyboards aren't the
only option.
Are there any other programming languages that have adopted this approach?

In theory, Smalltalk should support that out of the box.

An interesting article against overloading in general:

http://www.acmqueue.org/modules.php?name=Content&pa=showpage&pid=315
 
S

Stefan Ram

Oliver Wong said:
semi-competent. When you see the line, "int a = b @ c;", you really haveno
int a = VectorOperations.dotProduct(b, c);

For dot-product, one might use the centered dot “·â€.

Unicode has some exact representations of mathematical operators, like

× cartesian product
∘ function combination
↦ maps to
∈ element of
∪ set union and many more

or values like

ℎ h (plank's constant)
â„ h bar
π Pi and more

In a mathematical context these might be overloaded in a sense
compatible with their mathematical meaning.
 
D

Dimitri Maziuk

Tim Tyler sez:
....
I'm still not clear on what do you think "scalability" means.

System's ability to increase performance under increased load
when resources are added (wikipedia).

The problem with Java is that as number of objects in the JVM
grows larger things start slowing down (e.g. you can't speed
up GC by adding 5 more CPUs).

Dima
 
B

Bent C Dalager

Let's say you're given code written by a coder who is at least
semi-competent. When you see the line, "int a = b @ c;", you really have no
idea what "@" does, and you pretty much HAVE to stop whatever you're doing,
memorize where you are in the code, push in a new stack frame in your mind,
and navigate to the definition for @ between B and C. While reading that,
you might see further operators your don't recognize, have to push yet more
stack frames into your mind and read those, until your brain throws a stack
overflow error and you forget what you were trying to do in the first place.

Yes, but my point is that this - even this - is still at least an
order of magnitude better than the case when you don't even _realize_
that you should go operator-hunting among B and C.


And I suppose I should add that I see C++ not as a language so much as
I consider it a DIY language construction kit. It's a bit like Lego,
it can be both fun and useful, but if you're not careful it'll get
stuck in your throat and you'll suffocate. The first and foremost task
of any team that is to use C++ on a new project is to critically
review the feature-set of C++, the expected requirements of the
project, and the design and paradigms most likely to be useful for
that project. Then a document (together with any basic libraries
needed) should be produced that makes it very clear which language
features, exactly, should be used, how they should be used, and which
will not (indeed, MUST not) be used.

When it comes to operator overloading, I would suggest never using
it. As I said previously, however, I accept that in a few niche
domains (mostly mathematics), overloading them for new types of
numbers can be both useful and clean. If it's ok for + to be
overloaded for ints and floats, I will accept that there are probably
other types that also fit the bill. (And, no, it's not ok for + to be
overloaded for strings :)

I would be more liberal with operator definition for the reason I gave
above: it's more obvious that it is happening when it is happening.

_However_, when you are done defining this project-specific language,
you need to _train your developers_ in it. It's not enough to "know
C++" on such a team - you must know _our_ C++. And as is always the
case when teaching a new langauge, you need to provide them with
complete operator precedence charts that include all the old
operators, all of your new operators and all of the new types
supported by the old operators, AND you need to make it very clear to
them that all these operators get used throughout.

Obviously, the more operator magic you do, the more expensive it will
be to train programmers in your dialect of C++, so less is usually
better.

Now, with this in mind, I might not object too strongly to keyword
overloading or keyword definition either. (No, don't get me started on
the preprocessor <g>)

Or syntax overloading. Heh. I must be getting tired . . .

Cheers
Bent D
 
M

Mark Thornton

Roedy said:
Operator overloading might be more readable for the author, but
opaque for anyone else. Also over time it will become opaque for the
original author.

Almost never do you want to totally erase the difference between int +
and matrix +. I can see you wanting to use array notation for
something that is not an array because you want people treat your new
thing exactly as if it were an array. However, you never want to
treat matrix plus exactly as if it were int plus.

How about the basic operations on Complex numbers? These are very
closely related to the same operations on float or double values and do
deserve the same symbols.
I agree that the case for operators on matrix or vector values is less
compelling.

Mark Thornton
 
R

Roedy Green

If you have a friend who regularly types in Japanese characters on a
Windows XP machine which has a typical Qwerty keyboard, watch how they are
able to type in Japanese just as quickly as we are able to type in English.

I investigated Chinese typesetting back in the DOS days. As part of
this, I visited a Chinese language newspaper. There were many input
systems, most of which required thousands of memorised numeric codes,
and sometimes selecting from a set of alternatives with a numeric
code. What blew me away is these women could type whole words as fast
as most people can type letters. They did not even have to look at the
screen.

The other thing I discovered is Chinese can pack a lot more
information into a small screen real estate. I thought they would
need ultra-high res to discriminate characters, but they seemed to
have no trouble at all with quite low res.
 
R

Roedy Green

A similar tactic could be usedfor programming. E.g. the user would
actually type out "summation" and upon hitting spacebar after the final n,
the word would be replaced by the actual summation symbol.

Ever after it would be treated as a single symbol. You could backspace
to delete it, copy/paste etc.

You could however Export option : newsgroup which would convert them
back to (*) etc.
 
R

Roedy Green


IDE that tracks program transformations:

Sounds like SCID and dynamic version control notions may see the light
of day, also units of measure, 2D display...


See http://mindprod.com/projects/scid.html
http://mindprod.com/projects/dynamicversioncontrol.html
http://mindprod.com/jgloss/unitsofmeasure.html
http://mindprod.com/jgloss/bali.html

It makes me wonder if this is just obvious convergent evolution or if
some of its designers were influenced, perhaps indirectly by my
essays.

It is quite exciting to see the birth of a radically different new
language, that has all kinds of features I have been clamouring for.
 
R

Roedy Green

How about the basic operations on Complex numbers? These are very
closely related to the same operations on float or double values and do
deserve the same symbols.
I agree that the case for operators on matrix or vector values is less
compelling.

Yes, also to they should be treated under the hood like primitives. It
is just too darn inefficient to have an array of complexes implemented
an array of references to a zillion tiny two-field objects.

I think the best way to handle it would be to invent a complex
primitive type which is a pair of primitive doubles. + - * / are
overloaded. This would require some new types in the class file
format, and presumably even a few new ops in the JVM.

Another way to do it would be to invent some sort of inline class that
would have other uses as well.

On the other hand, perhaps what is needed is a nice bridge between
Java and the new Fortress language.

I have found strong resistance to introducing ideas into Java intended
primarily for scientific computing.
 
R

Roedy Green

int a = VectorOperations.dotProduct(b, c);
The operator notation gets more and more appealing the more you chain
or nest things. It looks more like math. Java notation becomes even
more opaque than postfix when you nest. Java is like the Roman
numerals of mathematical notation.

Operators don't have to be meaningless symbols like @. They could be a
word like DOTPRODUCT (The Fortress convention is all caps is an
operator)

or \u2299 see http://mindprod.com/jgloss/unicode.html to view one.

Another way to attack this is to leave the language alone. What you
do instead is train your IDE to ALTERNATIVELY display code in operator
format. You still write it the conventional way, but you optionally
view it as math, as if it were TeX 2D display to proofread it. You can
then even display multiplication as juxtaposition or any other rules
you want for the particular case. Division would show a numerator over
a bar over the denominator, in traditional 2D math representation,
perhaps using abbreviated symbols explained in a legend.

see http://mindprod.com/projects/scid.html
 
R

Roedy Green

The problem with Java is that as number of objects in the JVM
grows larger things start slowing down (e.g. you can't speed
up GC by adding 5 more CPUs).

How do you know that?

It seems to me you could at least in theory write a multi-threaded GC.
The main work is spanning a tree to find live objects. I can envisage
several threads working on that at once. You could think of it as
like several pickers working in the same tree.

Of course if you don't actually have multiple cpus, spawning extra
threads would just slow things down.
 
B

Brendan Guild

Tim Tyler wrote in
That is not really accurate - type:

java -verbose:class

...and you'll see that a whole bunch of reflection classes get loaded
- even if all that is happening is printing an error message.

The thing that is most disturbing about the output from that command is
not the reflection classes that it lists: it's the number of classes.
This is why I would like to have the option to go without reflection.
Each of those classes stores the names of all of it's methods and
fields, even the private ones.

That doesn't seem like much until I saw java load up 205 classes to do
nothing at all.

Java is a great language, my absolute favorite, but it's as if it has
no idea that memory might be worth something. Does anyone really want
every little class to be available for dynamic linking? And why are we
storing the private member names when The vast majority of those stored
names will be totally wasted space and it violates encapsulation to
store them? The names of my private fields are no one's business but my
own.
 
T

Thomas G. Marshall

Brendan Guild coughed up:
Tim Tyler wrote in

The thing that is most disturbing about the output from that command
is not the reflection classes that it lists: it's the number of
classes. This is why I would like to have the option to go without
reflection. Each of those classes stores the names of all of it's
methods and fields, even the private ones.

That doesn't seem like much until I saw java load up 205 classes to do
nothing at all.

Java is a great language, my absolute favorite, but it's as if it has
no idea that memory might be worth something. Does anyone really want
every little class to be available for dynamic linking?

I suspect that if it did not, there might be a considerable amount of
complaints regarding the phantom slowness of java: as the classes are
strictly required the load times might seem to happen at odd times.
And why are we
storing the private member names when The vast majority of those
stored names will be totally wasted space and it violates
encapsulation to store them? The names of my private fields are no
one's business but my own.

When compiling a class that access Foo.something, the error message might
better be

Foo.something is private and therefore not accessible

than

Foo.something: {shrug} This thing might exist or not
but it beats the compiler as to which.
 
D

Dimitri Maziuk

Roedy Green sez:
How do you know that?

From experience.
It seems to me you could at least in theory write a multi-threaded GC.
The main work is spanning a tree to find live objects. I can envisage
several threads working on that at once. You could think of it as
like several pickers working in the same tree.

Of course if you don't actually have multiple cpus, spawning extra
threads would just slow things down.

Exactly. There's a reason I originally said "unless you code it
that way from the start": you need parallelizable task to begin
with, then design a parallel algorithm for it, and then run it
on a multi-cpu box.

OTGH, it's just as likely that in 5 years everyone will be using
16-core chips with on-chip parallelizer which will do a decent
enough job anyway. And multi-threading will go the way of
hand-optimization: "don't waste your time, let the compiler do it".

Dima
 
M

Mark Thornton

Reedy said:
How do you know that?

It seems to me you could at least in theory write a multi-threaded GC.
The main work is spanning a tree to find live objects. I can envisage
several threads working on that at once. You could think of it as
like several pickers working in the same tree.

Of course if you don't actually have multiple cpus, spawning extra
threads would just slow things down.

Java already has a multi threaded garbage collector

http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html

http://portal.acm.org/citation.cfm?id=512546

http://research.sun.com/techrep/2000/abstract-88.html

Mark Thornton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top