Ruby vs Java vs c++

It seems that questions of this type always degenerate into a pro/contra
between programming languages for various application domains.

There is always going to be a difference of opinion as to which language
is suited for a particular task with majorities agreeing on specific
languages.

What I miss in these discussions, especially when someone new to
programming is asking is something that is obvious for me:
If you want to be a programmer (or a software engineer) you have to
now more than one language.
If you want an analogy, take painting:
Sure you can paint using color markers, but in order to be a painter you
should know how to paint with coal, oil paints, temperas, pencils etc.

Knowing a set of languages gives you the choice of the right tool for
the right job but more importantly it gives you the knowledge and
different perspectives to know which tool is the right one.
It is my belief that to get a good grasp of software design and the
principles behind good, solid software you need to learn more than one
language.

So I would say start learning C++ and Ruby, throw in C# to get to know
the world of strong statically typed objects and don’t stop.
There’s C (someone finally separate C from C++ in the minds of
programmers. I’ve seen too many C programs claiming to be C++ just
because they used cout) and Pascal, Visual Basic (bliach! although VB9
promises to resemble a proper language), Perl, Python (although for some
people it’s a mutialy exclusive relationship between Python and Ruby),
Lua and lots more.

Cheers,
V.-

On 11/22/06, Daniel S. [email protected] wrote:

And that would be the best choice. If you want efficiency you should
definitely use C++/Visual C++. If you ask me, it’s the best programming
language around, when you want efficiency, power with a resonable amount
of work when writing code.

Where reasonable means what? If you are using C++ to do text processing,
I
doubt it would be a ‘reasonable’ amount of work.

No one mentioned Objective C so far. It probably is what C++ should have
been, probably the ++ excited the masses into C’ing past this gem, which
works a little like Smalltalk grafted on to C, while remaining
compatible,
you can always drop down into ANSI C and it still feels just like home.

However, Java would more suited when you want to make things fast and

not care very much about efficiency. For example, if you like to split
up a mail address like [email protected] and you want to do it
fast, you have to allocate buffers, use strtok and so on and so forth.
With java, that’s piece of cake

I would prefer to build in a lightweight regex library instead and call
its
API. It will be 1) fast, 2) bug free, 3) adaptable to the next similar
job.

Seriously, half of C and C++ is knowing all the little libraries and
code
snippets, preferably on call via some macro invocation or lying
somewhere on
your disk, and before you know it, you are bolting components together
instead of doing the hard slogging, so you have lots of energy when you
get
to the part that you, not the library, or the language, or whatever.

Java is fast, especially if your programs run for a long time, but you
surely don’t want to incur the JVM startup overhead many times a second.
I
think Java is more useful now for the VM and the libraries / interfaces,
but
the alternate JVM languages still need another round of maturity or so,
for
many of them. I don’t know VM technology, so I can’t say anything about
the
VM quality, but I would love to see Ruby on both of them, or even better
with a VM that kicks their butts, tuned just for Ruby, somehow like how
Perl
can get ridiculously fast when you are executing huge ‘macro-ops’,
meaning
you are just using a concise Perl syntax on top of some well crafted C
code.

C is still very useful. I recently had to write software for a device
too
puny to run Ruby, Perl, Python, PHP etc. The manufacturer only has a
(wildly
broken) C API. Think something so broken that you use one method to
calculation placing a character on a screen, and an entirely different
coordinate system for a ‘line oriented’ C API. Where WaitForKeyPress
only
gets a few keys, so you have to CheckForKeyPressAndSpin instead. The
hard
layer and soft layer described above works very well. I wrapped up the
horrible C API into tested, bulletproofed and debugged functions that I
could call from Lua and all of a sudden it felt a bit like Ruby :slight_smile:

For finance programming, am not so sure. You may want to make sure you
are
good with R/Matlab and Mathematica. Or you may want to learn APL, if you
want to be an arcane master dazzling the operator-overloading gang (both
pro
and con sides) with your sheer conciseness and power. Well, I don’t know
APL, but that is how I imagine it to be. All kinds of crazy symbols,
where
you need a special keyboard.

– G.

On 11/23/06, M. Edward (Ed) Borasky [email protected] wrote:

Do finance types still use APL? I thought Matlab and Mathematica had
pretty much supplanted APL and its successors. I think you can still buy
a J license, though, and there is a fairly inactive open source APL-ish
package called A+ (aplus in Debian).

I would agree with your assertion that APL has been supplanted.
Because it may have been too powerful. And too unmaintainable.

A frequently heard argument against APL is that 80% of computer programming is maintenance, and APL programs are unmaintainable: Even from the beginning, no one but the author can understand the code, and, after some time has passed, even (s)he can no longer understand it.

In most computer programming languages, the challenge might be to solve the puzzle in the fewest lines of code. In APL, it is generally a given that the solution will be one line of code: The challenge is to solve the problem in the fewest characters!

So if I were asked to bet between an APL adept and a Matlab adept, I
would probably pick the APL guy but I would also make sure to never be
in a position to have to maintain any of the APL code.

Actually, though, I think APL is the solution to global warming. For one
thing, you can write the climate model in one line of code, which uses
much less electricity than the hundreds of lines of FORTRAN the other
models use.

APL will increase global warming by taking us all straight to hell.
But yes, when they boast of characters of code, instead of lines of
code, when there isn’t even an IF statement (which BTW is very common
in programming languages).

You can calculate all prime numbers with a less than 20 character
program. So each character counts quite heavily. My gut instinct tells
me that anyone who masters this language should be the one the wise
person will bet on if it comes to finance stuff.

How very off topic! But we have the New Zealand folks to keep it fair
:slight_smile:

– G.

Henry M. wrote:

I have been thinking, and talking, about this quite a bit lately. Here
is my take…

Learn Ruby and C. With Ruby you can write programs fast, with C you can
write fast programs,

I like this summary, I’ll already used it today :slight_smile:

Paul L. wrote:

Not when the vendor can kill it. Microsoft killed Visual Basic. Q.E.D.

Not to belabor the topic, but how is Microsoft killing off VB? I
understand that VBA is being retired, but VB seems to be alive and
kicking through .NET in the 2005 version
(Microsoft Learn: Build skills that open doors in your career). Did I miss
something? I know that VB 6.0 is formally losing support as of 2008 but
the .NET implementation is still alive, correct? Even if Microsoft
formally retired VB there are other one-off alternatives that could
take its place. RealBasic for example
(Xojo - Wikipedia).

gregarican wrote:

The corporate-owned, single-vendor product angle is a debatable point.

Not when the vendor can kill it. Microsoft killed Visual Basic. Q.E.D.

Couldn’t you say that about — hmm, lessee — C being started at Bell
Labs, Smalltalk being started at Xerox PARC, Java being started at Sun,
etc.?

Now that Sun is about to give up control over Java, your list doesn’t
have
any casualties on it. They’re all out in the open, and the originators
can’t kill them any more.

It is not about origin, it is about control. Microsoft likes having
control,
and (switching topics suddenly) they are about to start in on Linux.

Damphyr wrote:

now more than one language.
I agree with your point, but the OP is quite obviously planning to amend
his
knowledge base with a small bit of programming, just enough to
accomplish
some specific objectives in a particular field.

This is actually a rather common personal goal, and in such a case I try
to
think of a single language that will meet the requirement ad well as
convey
good programming notions.

For someone intent on learning programming in depth, yes, multiple
languages. For someone who just wants to add to his knowledge of
computers
and write a few very specific applications, that’s a different story,
and a
more difficult choice.

gregarican wrote:

Paul L. wrote:

Not when the vendor can kill it. Microsoft killed Visual Basic. Q.E.D.

Not to belabor the topic, but how is Microsoft killing off VB?

It’s dead, and Microsoft killed it. First they killed it, then they
stopped
offering support for it, all to get people to move on to new Microsoft
products.

http://www.developer.com/net/vb/article.php/3422891

http://www.bitwisemag.com/copy/features/vb6/strangedeathofvb.html

Apart from these VB post-mortems, the point I am making is that, no
matter
which variety of Microsoft language one adopts, it is only a matter of
time
before Microsoft tries to migrate you to the latest fad, if necessary by
halting support for the prior product.

I
understand that VBA is being retired, but VB seems to be alive and
kicking through .NET

Unfortunately, and as these articles show, VB/.NET is not the same
language.
For those who only know one language, e.g. those firmly in the Microsoft
camp, the transition is very difficult.

On 21/11/2006, at 9:28 PM, M. Edward (Ed) Borasky wrote:

Henry M. wrote:

C++'s days are numbered unless you are doing seriously performance
critical stuff (visualisation, some games, etc). Java is an
improvement but then Ruby is at another level.
How does C++ deliver “seriously performance critical” applications
where C can’t?

It doesn’t and I never said it did.

I would think a pure C code would have better performance, simply
because the language is simpler and easier to optimize.

I am sure you are correct, but it just seems that when writing large
fast applications people tend to choose c++ rather than c these days.
My point was that when writing large slow programs they seem to be
preferring something else. C++ is going ‘niche’ so why bother going
through the grief of learning it.

Paul L. wrote:

and write a few very specific applications, that’s a different story, and a
more difficult choice.

IIRC the original poster specified a domain (financial modeling and
graphics). Aside from the obvious “use the language your colleagues know
best” advice, I recommended R, because there’s a lot of existing
software already in R for that specific domain, and because the
underlying runtime is very efficient on that type of problem.

But in the absence of a domain – just someone who wants to “learn
programming” – I would recommend the following:

  1. Go to a good bookstore’s programming section. It doesn’t have to be
    Powells Tech Books, but if you live in Portland, Oregon … :slight_smile:
  2. Find a bunch of beginners’ books and pick the one you think would be
    the easiest to work with. Most of them are language-specific, so that
    will dictate the language.

Certainly for Ruby, Chris P.'s “Learn to Program” would be at the top
of my list. I don’t know about similar books for Python or Perl, but I’m
sure they exist. I’d recommend sticking with one of the “big three”
dynamic languages, Ruby, Python or Perl. Any language that requires
something more complicated that

$ ruby -e ‘puts “Hello, world!”’

is not suitable for a beginner. :slight_smile:

M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

On Nov 20, 2006, at 6:37 PM, Joel VanderWerf wrote:

and another one which name I forgot…

There’s tcc[1]. It’s a C compiler for linux and (maybe) now windows
that is fast enough to use for scripting. This is not quite OT. It
would be great to use libtcc[2] with inline C code when compile
time is more critical than run time. And you don’t have to muck
with tempfiles.

[1] Redirection
[2] http://fabrice.bellard.free.fr/tcc/tcc-doc.html#SEC22

Looks really neat. Zed pointed me at it a few weeks ago. I’d love to
play with it to experiment with an Uber::Inline::C, but it doesn’t
compile on OSX and I only have so much patience for linux’s quirks to
keep it running in parallels for a short amount of time.

On 22/11/2006, at 7:16 AM, David V. wrote:

And conversely, what’s the problem with using C++ instead of C for
performance-critical Ruby extensions or any “fast code”?

Don’t know. Just seems that most prefer c when writing extensions
etc. I haven’t found the need yet so until I give it a go I’m just
going by what I see.
rubyinline looks pretty interesting. Does that support c++?

It’s not THAT
much overhead compared to pure C, and I’d bet money on that it’ll be
less than the cost of interpreter callouts (in doing data structure
marshalling or manipulating Ruby objects as opposed to not having
to for
a straight C++ app) is. The heaps and piles (I know, I can get
cream for
that) of inconsistency inside C would make that overhead worth it for
me, as well as the fact that doing robust code is horrible busywork.

Don’t get what you mean? Are you saying C++ is less complicated then
c for writing ruby extensions or just fast code in general? Either
way that’s quite a statement.

Also, for gaming, .NET seems to be gaining hold recently, if the
(sometimes amusingly tangled) dependencies new stuff has on it are a
reliable hint, although I can’t tell which of the C# syntax
flavours it
is that’s being used, obviously.

That’s true but not all games are THAT performance critical. I’ve
written several 3D games in ruby without any performance problems but
then you’re not going to use ruby to write Doom 3.

“Phil T.” [email protected] writes:

In the past I’ve sometimes not been too fond of C++. However after
working a recent job where we used the Boost libs extensively I got
to liking C++ again. The next C++ standard will contain several of
the Boost libs - that’ll be nice. Also, take a look at the book
‘Template Metaprogramming’, it’s amazing what they’re able to do
with templates (functional-style pattern matching, for example).
And template-based polymorphism is much faster than the traditional
use of inheritance and virtual methods.

Well, that is a problem source in my book. Template programming is an
entirely different beast to code writing in C++, in patterns, syntax,
possibilities and skillsets. That’s simply not a good state for a
programming language to be in.

On 11/25/06, Henry M. [email protected] wrote:

In the past I’ve sometimes not been too fond of C++. However after
working a recent job where we used the Boost libs extensively I got to
liking C++ again. The next C++ standard will contain several of the
Boost libs - that’ll be nice. Also, take a look at the book ‘Template
Metaprogramming’, it’s amazing what they’re able to do with templates
(functional-style pattern matching, for example). And template-based
polymorphism is much faster than the traditional use of inheritance
and virtual methods.

I don’t think C++ is going away anytime soon.

Phil

I’m really glad to know that you understand what we require. That’s
awesome! Thanks a lot for opening and sharing this exclusive thread with
us. Open

in order to learn more about us!