Revised: What is your favorite programming language?

Posts: 3,591
Joined: 2003.06
Post: #46
Najdorf Wrote:I heard brian greenstone saying on the IMG podcast that C is good and C++ is evil...
And he also said he would NEVER use Cocoa. I guess everybody has their own opinions. Saying "NEVER" about using Cocoa seems a little ignorant to me, but hey, that's just *my* opinion. Brian, if you're reading this, no offense, but that's why your system UI's look like they came straight out of the nineties. Wink

BTW, I don't like C++ either. My opinion is that it's overkill for basically everything. I don't think I'd go so far as to call it `evil' like OSC and Greenstone do, but I wouldn't disagree.
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #47
C++ is not inherently any harder to universalize than C. The issue is that GCC 4.0 is much stricter about C++ than GCC 3.3, so plenty of code that compiles without error or warning on 3.3 isn't accepted by 4.0. If you have code that already compiles with GCC 4.0, there are no issues.

The issue with C++ isn't (particularly) that it's a bad language; simply that it's notably inferior than other languages. If you've only ever programmed in C++, you have no points of reference, so chances are you'll think it's great. It's only once you've had substantial exposure to many different languages that you realize just how much work programming in C++ is.
Quote this message in a reply
Posts: 1,140
Joined: 2005.07
Post: #48
I've programmed in C, C++, ObjectiveC and Java. I don't like Java because they take away power to "protect" me, which ends up causing me to do more work with many things. ObjectiveC is fairly nice, but there are a few things that I miss such as operator overloading and templates. I haven't yet needed multiple inheritance, but it is also something nice to have. However, I do like the fact that ObjectiveC lets you call any method on any object, then determines at runtime whether or not the method exists. (such as with delegates) If you have too many "delegates" in C++ it can certainly get crazy with all the multiple classes you need to subclass with the controlling class. Other than that one exception, I don't think anything I've done in C++ was any more difficult/required more work than if I programmed in ObjectiveC or Java.

I do believe, though, that templates need a little work. It's kind of annoying having to include all of your source in the H file in order for it to compile. I don't know if we'll ever get to that point, since you can't compile all the way down without knowing something as basic as the type. I'm sure that they could make a special half-compiled format for C++ templates, though. However, I still think that the good outweighs the bad for templates.

I will agree that I only have a good year or so of experience, even though I've done quite a bit in that year, so it's not like my word is binding. My preferences may change as I program more and gain more experience. If you see something else about why you think C++ is worse than other languages, please tell. It would certainly give me more incite about programming in general, as well as choosing the best tool for the job.
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #49
In my experience, having a sufficiently dynamic type system (like ObjC provides with 'id') completely negates the need for templates.

Operator overloading is nice for writing your own math classes (Vector, Quaternion, etc) but is almost completely useless outside that domain, and can scarcely be called "necessary" even within it. Lua and Python and Ruby all provide it, anyway.

The inability to call any method on any object is the biggest strike against the usability of C++ for a large project. It means you have to constantly fight the static type system, and constantly add new abstract classes to the inheritance hierarchy, and constantly name methods in ways you didn't want. Either that or extend the type system, eg. like Qt's MOC does, but by then, you might as well not be using C++.

The lack of garbage collection is also a big deal. By the time you've found all the memory leaks and crashes caused by trying to share an object between multiple "owners", you've wasted a lot of time. Yes, you can reference-count it, yes, you can use various kinds of automatic smart pointer, but it doesn't completely alleviate the problems, and it is plenty of extra work.

Remember, there's nothing sort of "inherently wrong" with C++, any more than there is with Pascal, or Ada, or whatever... it's the sum of many smaller irritations.

The big picture is, of course, what I said in my first post -- you want fast code? use C. You want easy-to-write code? Use Python or Ruby. You want both in the same app? No problem -- embed the little C you require. C++ is a poor compromise for either goal.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Swift: Apple's new programming language funkboy 4 4,769 Jun 4, 2014 01:39 PM
Last Post: JustinFic