Re: C++ or Java ?

From: Daniel James (wastebasket_at_nospam.aaisp.org)
Date: 06/26/05


Date: Sun, 26 Jun 2005 13:53:17 GMT

In article news:<42be288d$0$1225$3a2ecee9@news.csolutions.net>, Luc The
Perverse wrote:
> Unfortunately one of the disadvantages of our higher education systems
> is that they teach you only one type of programming, going off on the
> evil of "GOTO" statement. I actually used a goto statement once,
> just to be a rebel ;)

I have used goto in C++ (or was it C?) ... but so long ago that I can no
longer remember why ... probably because it was so long ago that I
couldn't use an exception (or it was C!).

It's not that goto is inherently bad, just that there are better control
structures to use for almost every conceivable case. This is true of most
programming styles, not just OOP.

> I suppose I realize that there are well made C programs out there.
> It's just that whenever I encounter code that is not properly
> encapselated it turns out that the programmer either didn't know what
> he was doing, or he was being lazy.

That happens. Note, though, that it's perfectly possible to write good OO
code in C.

[ "encapsulated", BTW ]

> Perhaps there are other styles of programming, but I have
> not encountered them.

So ... you're saying that you have already decided that you want to do
OOP, and you just want to choose between C++ and Java as your
implementation language? It changes the question slightly, as some of the
answers (including mine) state that C++ will be better if your problem
(or some part of it) does *not* lend itself well to an OO solution and
you then find yourself wanting to follow another paradigm.

> > At the end of the day it depends whether the benefit of having those
> > libraries and tools outweighs the benefit of having a more powerful
> > language ... remembering that there are libraries and tools for C++
> > as well, just not such a bewildering array of them.
>
> I want both dammit! I like C++ and that is where I am the most
> comfortable.
>
> But I want code of this simplicity to work.
>
> CImgSrc* CCameraObj = NULL;
> CCameraObj = new CImgSrc(CamNum, MyConfiguration);
> CImage MyPic;
> CCameraObj ->TakePicture(&MyPic);
> MyPic.Save(PicPath+GenerateFileNameFromDate()+".jpg",
> CImage::filetype_JPEG);

That doesn't look very simple ... or likely to work all the time ... who
manages the lifetime of CCameraObj if an exception is thrown? What
happens if the call to new CImgSrc fails ... ? Come to that, why doesn't
Save set the filename extension automatically from the filetype?

That's all beside the point, though. You can achieve code that simple in
either of the languages you're discussing (though in practice you'll
probably end up with code that's more complex because there are more
options that need to be considered and set ...).

I think what matters most to you is having appropriate libraries for
image manipulation and control of imaging devices ... choose your
platform (uh, linux, I guess, since this is where we're discussing it),
pick a suitable set of libraries, and then see which language it's
easiest to call the libraries from.

I'd start by looking at GIMP and seeing what it provides/uses. That's
likely to mean that you end up going down the C/C++ path as GIMP is
written in GTK (or is it GTK+?).

> > and have you thought about Python?
>
> Python? What is Python, precious?

A programming language.

http://www.python.org

Cheers,
 Daniel.
 



Relevant Pages

  • Re: CL-UNIFICATION as a library (Re: Qi Seems Great)
    ... perhaps it is time for a new revision for the language? ... Common Lisp people looking down on everybody else, ... But I'm not new to programming - that's ... should find the CL implementation and set of libraries most suitable ...
    (comp.lang.lisp)
  • Recommend an E-book Meeting the Following Criteria (Newbie, Long)
    ... I know several programming languages namely Java, Perl and C in this order ... Now I'm wondering which Python book I should get as there are so many out ... I'd like to mostly concentrate on language features but some pointers ...
    (comp.lang.python)
  • Re: Resources for education (was Re: Operating systems at war?)
    ... programming in a language in which structure is a requirement can be ... What is wrong with Python? ... advanced programming techniques like object oriented programming it is ... To learn Python basics is only a matter of days ...
    (comp.sys.acorn.advocacy)
  • Re: map/filter/reduce/lambda opinions and background unscientific mini-survey
    ... > Python language, while "function" etc are not, but they are certainly ... But in the Python sense? ... The programming use is probably *closer* to the English meaning ...
    (comp.lang.python)
  • Re: Pythons simplicity philosophy
    ... Python will be aimed at aliens. ... Reasonable people on my world typically seem to realize that sum() is ... general-purpose programming language that aims for simplicity. ...
    (comp.lang.python)