Why do you hate C++?
Author |
Message |
bbi5291
|
Posted: Wed Jul 29, 2009 12:15 am Post subject: Why do you hate C++? |
|
|
I read this thread and I noted that almost nobody seems to like C++.
There are definitely some issues with C++, but all languages have their issues, which is to be expected merely because nobody is perfect. But no language feature of C++ ever became an obstacle of such magnitude that it forced me either to use another language or to expend considerably more effort than otherwise necessary.
What are your reasons for disliking C++? (OK, so some of you don't dislike C++, but just like some other language better. But some of you really dislike C++ and think that it encourages people to write terrible, unreliable, non-portable, ... programs.)
This post is not an attack on C++-haters - not at all, I'm just interested in friendly discussion. (In particular, don't label me as a typical jerkface adolescent who thinks he's smarter than everyone else "just because he knows algorithms" but in actual fact knows nothing about "real programming".) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Wed Jul 29, 2009 12:59 am Post subject: RE:Why do you hate C++? |
|
|
Because I know other languages, and therefore that it can be done better. If it can be done better, there's no good reason C++ can't be better.
Programming languages are too numerous to settle for mediocrity. |
|
|
|
|
|
TheGuardian001
|
Posted: Wed Jul 29, 2009 1:03 am Post subject: Re: Why do you hate C++? |
|
|
I dislike C++ because I found very few reasonable tutorials for the base libraries that went beyond "Hello World," And I found the documentation in the 3rd party libraries to be extremely lacking, leaving me with no idea what the hell I was doing. If I could find a library with decent tutorials I'd probably like C++ a lot better. |
|
|
|
|
|
saltpro15
|
Posted: Wed Jul 29, 2009 9:06 am Post subject: RE:Why do you hate C++? |
|
|
TheGuardian, if you're looking for a good c++ tutorial, I highly recommend this. |
|
|
|
|
|
andrew.
|
Posted: Wed Jul 29, 2009 9:50 am Post subject: RE:Why do you hate C++? |
|
|
We don't hate C++, it's just not our favourite language. There are much much better languages out there. |
|
|
|
|
|
rizzix
|
Posted: Wed Jul 29, 2009 1:05 pm Post subject: RE:Why do you hate C++? |
|
|
A programming langauge is designed as a means of communication between programmers and not just between the programmer and the computer.
Compared to the other langauges out there, I think C++ comparatively fails in this task. |
|
|
|
|
|
Ultrahex
|
Posted: Wed Jul 29, 2009 2:56 pm Post subject: Re: Why do you hate C++? |
|
|
The major problems I have with C++ is the abstraction layers and object oriented (for being an object oriented language) is poorly implemented.
For instance, if you have class it is hard/sometimes impossible to hide "helper" functions/data-types because you have to declare private members in the header file. This does not allow for abstract data classes as nicely as many other object oriented languages.
For instance say you have a Stack Class, and it uses an array but later you want to change it to use a linked list. This cannot be easily implemented unless you do inheritance so you implement a type of Stack that uses an array and later change it (requiring some type of Strategy Design Pattern). Hence If you were to change it you would require to change the header, and thus require you to recompile all things that rely on the Class even though you are just changing what data-type it uses in the background.
Obviously you would not create your own Stack Class normally so this is a bad example, but it boils down to a lot of code overhead for really small implementations.
However, I could be mistaken and have been just poorly taught C++ as I am suspected to believe. |
|
|
|
|
|
rizzix
|
Posted: Wed Jul 29, 2009 3:54 pm Post subject: RE:Why do you hate C++? |
|
|
Ultrahex: That's quite true.
Additionally you end up writing a lot of boilerplate code in C++. Langauges like Java, C# and Python use Annotations (meta-programming constrcuts) to autogenerate boilerplate code.
Other langauges like Haskell, use the type system to (not quite) magically do/eliminate such routine stuff.
Languages like Ruby uses its own (not quite) hidden features to do the same. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonWasp
|
Posted: Thu Jul 30, 2009 12:18 am Post subject: RE:Why do you hate C++? |
|
|
I second what wtd said: it could be done a lot better.
C++ as a language has no clear advantages over any other language. Nearly everything does OOP better. Nearly everything works better cross-platform, save for the Microsoft family of languages (and even then, Mono isn't half-bad). It's fast, but so are dozens of other languages - even Java / C#, which have long been harangued for being slow, are very very close in performance. Other languages have nicer syntax, clearer rules, more consistent libraries, and better IDEs. This means clearer communication between programmer-computer and programmer-programmer, as rizzix notes.
To top it all off, there's a barrier to entrance in the form of a steep learning curve.
In my specific case, I've also had a history of stupid, stupid issues in C++ that just don't seem to occur in other languages. For example, my last work term was spent updating a library within an existing application. This library was written in C++, as was the application. The code was actually pretty small and straightforward (it really didn't have to do very much). The only catch was that I had to make it compile across 4 platforms (operating system - hardware combinations). This took me 3 months because our build process was broken, the library's build tools were broken, the C++ compilers varied badly across the platforms, and because the library didn't meet its specifications (though this isn't C++'s fault).
The worst was probably the part where it incorrectly detected one of the platform's compilers as not having implemented const correctly, despite the fact that it clearly did. The "fix" for this was to specify #define const <nothing more here> in a header file. Normally, this would just have erased const throughout all the files and everything would be fine, but it turns out that they only bothered to include this header file in about half of their code, which resulted in some function-headers specified with const, but implemented without it (hint: this don't work).
There have also been other massacres-of-code, including this gem:
code: |
class Foo {
int bar;
int baz;
}
union {
Foo *foo;
}
|
Unions are a stupid thing to have in C++ (they were intended to provide a poor-man's polymorphism in C) in the first place, but this takes the cake. It didn't change how that member was accessed, but it did preclude Foo from having a constructor or destructor (fortunately, it only had integer members), and it didn't really do anything (unions usually have 2+ members, otherwise they don't actually do anything).
In contrast, the next-biggest mistake outside C++ was the 3000-line-long Javascript-based module I had to rewrite after a contractor was described as "not returning". This was remarkably straightforward. |
|
|
|
|
|
OneOffDriveByPoster
|
Posted: Thu Jul 30, 2009 5:59 pm Post subject: Re: Why do you hate C++? |
|
|
I like C++, but then again
"What do you mean Internal Compiler Error?"
It is message C1001 with MSVC++. |
|
|
|
|
|
btiffin
|
Posted: Sat Aug 01, 2009 12:51 pm Post subject: RE:Why do you hate C++? |
|
|
C++ requires a level of discipline, planning, and well, IQ, that is just past the middle of the bell curve. Everyone is led to believe they can master it, but alas we, in general, cannot.
It makes for a struggle. Why struggle?
Cheers |
|
|
|
|
|
matt271
|
Posted: Sun Aug 02, 2009 4:09 pm Post subject: RE:Why do you hate C++? |
|
|
i like c++
i primarily use java now but i appreciate c++ and what it can do. i try to learn a bit every here and there. i like to code simple small things in it cuz it makes me feel hackerish hahahah |
|
|
|
|
|
|
|