PDA

View Full Version : Why C++?



Masih
24th July 2007, 05:25
Obvious by my posts I am an absolute beginner in OO programming. Back to school I solved my necessary computational tasks all by MATLAB. When I started working in an institute I understood not being able to use Visual C++ is like being an amputee (at least there). If something was about simulation or theory thing then MATLAB sufficed but if I wanted to do something practical then I needed C++ or MFC or something like that! That's why I am trying to learn Qt. But still there is a big question mark for me. Why C++?
There are bunch of other languages out there, probably easier to learn and handle. What makes C++ the first choice at least in the field of sensing and control?
I was reading this article today and was amazed and confused by the sentences from the founder of C++.http://members.safe-t.net/jwalker/programming/interview.html
Was he joking?

Regards,

marcel
24th July 2007, 06:05
Well, that interview is on the internet for some time and most likely not true.
It's somebody's lame attempt to bring down not only C++ but object oriented programming also.

It's probably one of those narrow minded assholes who never managed to understand c++ or oop, and he does a lot of hard core programming in .NET.

Or it was simply a joke...

Either way, Qt is written in C++ because it is :). I can't give you the real reason. Probably because C++ is very flexible and allowed the framework to reach the point where it is today.

Regards

Michiel
24th July 2007, 17:14
C++ has its advantages.

It's compiled, not interpreted. This is faster at runtime.
It has OOP, which is a big plus when working on bigger projects. (And I use it whenever I can.)
It's still mostly backwards compatible with C, which is handy for most veterans.
It's supported everywhere. There are many programmers with experience. It has libraries like Qt. So it's practical at the moment.
Java has other ups and downs but is, in my opinion, on the same level as C++. I think both are dated when it comes to software engineering. It's mostly because of the vast support that they are so popular.

A better language is D, for example. But it doesn't have things like Qt.

jacek
24th July 2007, 18:27
A better language is D, for example. But it doesn't have things like Qt.
AFAIR there were some attempts in that matter, but I don't know the outcomes. It would be very nice to have D bindings for Qt, as it is a very interesting language. Maybe we should do something about it?

Michiel
24th July 2007, 19:17
I suspect it wasn't very practical until recently, when version 1 of D was released. Before that, the language was constantly changing.

I'd love to help, but I don't have experience in these matters. I have no idea how the Java bindings were created, for example. But if you're going to make a project of it, count me in. I want to learn.

I wonder which of D's advanced features we could actually use. D has support for user-defined class properties, for example.

The first step would be to find out what progress has been made. No use starting from scratch if people are already working on it.

fullmetalcoder
24th July 2007, 19:23
AFAIK some guys are working on a similar binding for C#... It has nothing to do with D except that, both being C-like their code structure are very similar which could do the trick : these guys use a tool of their own to auto-generate headers for their C# wrapper from Qt headers! As for the real implementation I understood that they were trying to reduce every function call to a single one but I must have missed something since that wouldn't allow objects to be used easily...

yop
24th July 2007, 20:07
The only way to go that seems viable in all the discussions I 've followed around is to check how Jambi does it for ideas. The main problems for wrapping the C++ implementation is the lack of support for C++ headers in the D language (you can use C headers) and all the preprocessor magic of Qt.
The last time I checked Qt# was wrapping the QtC (the C binding for Qt) and there were thoughts of wrapping that one for D but I think this is old news.
I am also interested in such a wrapping (who wouldn't be I guess?). For now I 'm avoiding C++ by using PyQt. Jacek do you have anything in mind? I would help although I 'd prefer it if automagically such a binding was announced :-).
As for the original question in this thread I 'd say don't use C++ if you don't have to, use one of the many bindings to more productive languages (python, ruby). As for Trolltech for me they made the right decision in using C++ as it can be extended to more productive languages (such as ruby or python) and they can use the most powerful language to provide the best available gui toolkit around. This of course comes with the cost that they have to hire the best developers around to keep such a toolkit in good shape but since they 're paying the bill I 'm happy with it.

marcel
24th July 2007, 20:16
AFAIR there were some attempts in that matter, but I don't know the outcomes. It would be very nice to have D bindings for Qt, as it is a very interesting language. Maybe we should do something about it?

I'm in too!

jacek
26th July 2007, 03:01
I 'd prefer it if automagically such a binding was announced :-).
Well, that's what everybody count for. ;)

If Jambi generator sources are available, we could take a look and see whether we can make it emit D code and use QtC, but I think that the biggest problem is how to make Qt/D API blend naturally with D and how to replace moc, uic and rcc.


As for Trolltech for me they made the right decision in using C++ as it can be extended to more productive languages (such as ruby or python) and they can use the most powerful language to provide the best available gui toolkit around.
Also there wasn't much choice at the time they started planning Qt.