The best OOP languages??

J

John Swan

Which one is best?

Java is slow but can be ran on every machine.
C# kicks the crap out of MFC but can only be run on M$ platforms.
C++ is class :) but is harder work so ultimately makes you better.

If someone wanted to learn an oop based language which one would you
choose????
 
C

Cy Edmunds

John Swan said:
Which one is best?

Java is slow but can be ran on every machine.
C# kicks the crap out of MFC but can only be run on M$ platforms.
C++ is class :) but is harder work so ultimately makes you better.

If someone wanted to learn an oop based language which one would you
choose????

I wouldn't pick an OOP language. I would try to find the language most
suitable for whatever I wanted to do, OOP or not. I mostly do scientific and
engineering software, so I like C++ for its speed and power. I sometimes use
OOP features of C++ but actually use generic programming more often. Unlike
OOP, generic programming has shown a real ability to write algorithms which
don't depend on data types or containers, using the very un-OOP-like method
of completely separating code from data. I like Python for prototyping and
"glue" code. I use other languages too (my current project uses no less than
seven languages!) but those are the only two I really like.
 
P

Pete Becker

John said:
Java is slow but can be ran on every machine.

Well, it can be run on every machine that it can be run on. If you don't
have a VM for your machine, you can't run it there. Unlike, say, C++,
which can only be run on a machine that you have a compiler for.
 
U

usr.root

John Swan 写é“:
Which one is best?

Java is slow but can be ran on every machine.
C# kicks the crap out of MFC but can only be run on M$ platforms.
C++ is class :) but is harder work so ultimately makes you better.

If someone wanted to learn an oop based language which one would you
choose????


c++ c++ c++ c++ c++ c++ c++ c++ c++ c++ c++ c++ c++ c++ c++ c++ c++ c++
c++ c++ c++
 
G

Greg

Phlip said:
Those both use static typing, and have pitiful support for block closures.

Not to mention that neither can drive, go to the grocery store, do
laundry or do anything else that could be considered remotely useful.

Greg
 
N

Niels Dybdahl

Java is slow but can be ran on every machine.
C# kicks the crap out of MFC but can only be run on M$ platforms.
C++ is class :) but is harder work so ultimately makes you better.

If someone wanted to learn an oop based language which one would you
choose????

I would choose one with a good debugger, because a debugger can be very
good at showing beginners what is going on.
I would also choose a language with garbage collection, because manual
cleaning code is hard to get right for beginners. Beginners should care
about the problem they are solving and not about housekeeping.
So both Java and C# fall in this category. Others might also (but C++ does
not).

BTW Java is not slow if you have enough RAM.

Niels Dybdahl
 
P

peter.koch.larsen

Niels Dybdahl wrote:
[snip]
I would choose one with a good debugger, because a debugger can be very
good at showing beginners what is going on.
I would also choose a language with garbage collection, because manual
cleaning code is hard to get right for beginners. Beginners should care
about the problem they are solving and not about housekeeping.

You mean housekeeping of memory? Whenever I see Java and C# code, I
notice an awful lot of try-catch-finally statements. Seeing a
well-written C+ program I notice the try-catch is only in the few
places where the exceptions have to be reported.
To me this is an indication that it is C# and Java that has problems
with resource-handling.
So both Java and C# fall in this category. Others might also (but C++ does
not).
Why not? Just use garbage collection in C++. There are a few things
you're not allowed to do but that is all exotic stuff such as xoring
pointers or writing those pointers to disk - expecting them to be valid
when you read them back in.
BTW Java is not slow if you have enough RAM.

Niels Dybdahl

/Peter
 
D

dominic.connor

I think neither C# nor Javs have yet caught up with C++ as general
purpose languages, though of course you want to look at what you're
trying to do before choosingf a language.
If you're living entirely in the MS world, and like most people your
code wil never have to move platform than C# is not a bad choice.

Speaking as a headhunter in finance I will have to say that C++ jobs do
pay really a lot better than C# or Java, a package of £100K in London
is entirely realisitic.

Dominic @ PaulDominic.com
 
H

Havatcha

I think neither C# nor Javs have yet caught up with C++ as general
purpose languages, though of course you want to look at what you're
trying to do before choosingf a language.
If you're living entirely in the MS world, and like most people your
code wil never have to move platform than C# is not a bad choice.

Speaking as a headhunter in finance I will have to say that C++ jobs do
pay really a lot better than C# or Java, a package of £100K in London
is entirely realisitic.


Really.....?

You got any good links?
 
P

Phlip

peter.koch.larsen said:
You mean housekeeping of memory? Whenever I see Java and C# code, I
notice an awful lot of try-catch-finally statements. Seeing a
well-written C+ program I notice the try-catch is only in the few
places where the exceptions have to be reported.
To me this is an indication that it is C# and Java that has problems
with resource-handling.

Yay!

It is supremely ironic that Java is marketed to your boss as "a language
where you won't have all those dangling pointers and memory overruns like
C++ causes"...

(And C#'s conceptual and strategic merits have no discussion beyond its
obvious origin as MS's private Java clone...)

dominic.connor said:
Speaking as a headhunter in finance I will have to say that C++ jobs
do pay really a lot better than C# or Java, a package of £100K in
London is entirely realisitic.

I currently have an equivalent senior role writing test scripts in Ruby. I
picked it because I know I can go very fast and get the job done, without
mucking around.

Put another way, if I let my boss pick the language, it might slow me down,
so I have a choice between slowly taking their money, or rapidly making a
major impact.
 
N

Niels Dybdahl

If someone wanted to learn an oop based language which one would you
You mean housekeeping of memory? Whenever I see Java and C# code, I
notice an awful lot of try-catch-finally statements.

I guess those try-catch blocks are used for cleaning up database connections
or file handles. Thats where I usually use try-catch in Java.
One of the most annoying omissions in C++ is finally. But fortunately it can
be solved in most cases with a destructor, but in some cases you have to
invent a class for that purpose which does not make the code more readable.
Seeing a
well-written C+ program I notice the try-catch is only in the few
places where the exceptions have to be reported.

That is true, but beginners seldom write well-written C++-applications.
To me this is an indication that it is C# and Java that has problems
with resource-handling.

C# and Java have solved handling memory resources very well, but C++'s
destructors are very nice for handling all other resources.
But again beginners are not likely to clean up resources correctly.

Niels Dybdahl
 
H

Howard

John Swan said:
Which one is best?

Java is slow but can be ran on every machine.
C# kicks the crap out of MFC but can only be run on M$ platforms.
C++ is class :) but is harder work so ultimately makes you better.

If someone wanted to learn an oop based language which one would you
choose????

I always liked Delphi. A great RAD tool, and easy to learn.

But, I get paid a lot more to do c++ work, so guess which I'm using now...?

-Howard
 
S

Stewart Gordon

John said:
Which one is best?

Java is slow but can be ran on every machine.

You mean it can run on your washing machine? :)
C# kicks the crap out of MFC but can only be run on M$ platforms.
C++ is class :) but is harder work so ultimately makes you better.

If someone wanted to learn an oop based language which one would you
choose????

D

http://www.digitalmars.com/d/

Stewart.

--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:- C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS-
PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox. Please keep replies on
the 'group where everyone may benefit.
 
D

deane_gavin

Niels said:
I guess those try-catch blocks are used for cleaning up database connections
or file handles. Thats where I usually use try-catch in Java.
One of the most annoying omissions in C++ is finally. But fortunately it can
be solved in most cases with a destructor, but in some cases you have to
invent a class for that purpose which does not make the code more readable.

Depends what you're used to I think. To me, Resource Acquisition Is
Initialisation (RAII - acquiring resources in a constructor) is normal
because most of my experience is in C++. Having a class that manages
the resource in its constructor and destructor is natural so I've never
found a need for finally. I don't find that the use of resource
handling classes makes code less readable because they are exactly what
I'm expecting (hoping?) to see.

When I see a resource acquired outside a constructor, then I find the
code harder to read, because I have to start looking for all the places
an expection might be thrown. Then I have to look for where (or even
whether) the different exceptions will be caught and see whether the
resource is released correctly. With RAII that whole concern
disappears.
That is true, but beginners seldom write well-written C++-applications.


C# and Java have solved handling memory resources very well, but C++'s
destructors are very nice for handling all other resources.
But again beginners are not likely to clean up resources correctly.

More recently I've used C#. Memory is garbage collected. Other
resources are not. I found this to be an artificial and unnecessary
distinction between memory and all other resources. But again that's
probably because I come from a C++ background where that distinction
doesn't need to exist.

Bottom line. Whatever language you choose, you need to learn it's own
idioms and not try to force in those from another language. If you are
using C++ but you refuse to embrace RAII and try instead to implement
"finally"-like functionality, you'll find C++ resource management much
more frustrating than it needs to be. If you are using C# or Java and
refuse to embrace try-catch-finally I am sure you will find resource
management there more frustrating than it needs to be too.

Gavin Deane
 
D

Dave Rahardja

Depends what you're used to I think. To me, Resource Acquisition Is
Initialisation (RAII - acquiring resources in a constructor) is normal
because most of my experience is in C++. Having a class that manages
the resource in its constructor and destructor is natural so I've never
found a need for finally. I don't find that the use of resource
handling classes makes code less readable because they are exactly what
I'm expecting (hoping?) to see.

Yeah, RAII is wonderful when you get to write your classes ;-) ... More than
once I have been stuck with a C library used in a C++ application that does
exception handling. Without a finally clause, I'm forced to encapsulate the C
library interface...which can be a waste of time:


/* ... */

extern "C" void OpenResource();
extern "C" void CloseResource();

/* ... */

void fn()
{
OpenResource();

try {
ExceptionThrowingCPPFunction();
} catch (Exception0&) {
/* ... */
throw;
} catch (Exception1&) {
/* ... */
throw;
}

CloseResource();
}


Oh well.

-dr
 
P

peter.koch.larsen

Dave said:
Yeah, RAII is wonderful when you get to write your classes ;-) ... More than
once I have been stuck with a C library used in a C++ application that does
exception handling. Without a finally clause, I'm forced to encapsulate the C
library interface...which can be a waste of time:


/* ... */

extern "C" void OpenResource();
extern "C" void CloseResource();

/* ... */

void fn()
{
OpenResource();

try {
ExceptionThrowingCPPFunction();
} catch (Exception0&) {
/* ... */
throw;
} catch (Exception1&) {
/* ... */
throw;
}

CloseResource();
}
Let's compare your example to the "wrapper"-method:

extern "C" void OpenResource();
extern "C" void CloseResource();

/* ... */

class CResource
{
public:
CResource() { OpenResource(); }
~CResource(){ CloseResource(); }
}

void fn()
{
CResource r;
ExceptionThrowingCPPFunction();
}

Writing that one wrapper class once certainly seemed to pay off. Also,
the wrapper solution is reusable - available everywhere you use the
CResource.


/Peter
 
N

Niels Dybdahl

C# and Java have solved handling memory resources very well, but C++'s
More recently I've used C#. Memory is garbage collected. Other
resources are not. I found this to be an artificial and unnecessary
distinction between memory and all other resources. But again that's
probably because I come from a C++ background where that distinction
doesn't need to exist.

Actually in Java there is something like the destructors in C++ and they can
be used for handling other resources as well.
But they are called from the garbage collector, which makes them impossible
to use for a number of cases. F.ex if you want to finish a transaction on a
database, it would not be nice if it would happen sometime in the future.
That is too late. Also if an error occurs during flushing buffers or
completing transactions, then this error must be reported immediately.
These kind of problems do not occur when handling RAM. Therefore there must
be a distinction when using garbage collection.

Niels
 
S

Shezan Baig

Niels said:
Actually in Java there is something like the destructors in C++ and they can
be used for handling other resources as well.
But they are called from the garbage collector, which makes them impossible
to use for a number of cases. F.ex if you want to finish a transaction on a
database, it would not be nice if it would happen sometime in the future.
That is too late. Also if an error occurs during flushing buffers or
completing transactions, then this error must be reported immediately.
These kind of problems do not occur when handling RAM. Therefore there must
be a distinction when using garbage collection.


I think we are talking about *resources* here, e.g., memory, files,
socket connections etc. A database transaction isn't a "resource".
Finishing a transaction is part of the *process*.

Hope this helps,
-shez-
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top