On 13-04-25 11:17 AM, John Spencer wrote: >> >> About C++, I have to say that it support in a native form the object >> oriented programing > > what enable to have the data and the functions related to it together > and also encourage the code reusage. > > 1) putting data and functions together is considered harmful > http://research.scee.net/files/presentations/gcapaustralia09/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf > > but it's perfectably doable in C so i don't see your point >
I'm no expert, but if I understand correctly, C++ is actually BETTER for the kinds of optimizations recommended in that presentation because: 1. The compiler is more aware of what optimizations can be applied to C++ classes as opposed to the ones GObject jerry-rigs on top of C. 2. Having the class syntax as part of the language itself allows the system to grant you more power to reliably fine-tune the in-memory layout the compiler will produce. 3. Very few people are obsessive enough to spend all day finding ways to use as little GObject as possible, so "C optimizes better than C++" is irrelevant. The question is "Does C++ optimize better than GObject... and that's much more debatable." 4. MOST IMPORTANT: GTK2 has been end-of-life'd. Unless you can scrape together enough willing people to maintain it (we don't have time), the choice is between porting to Qt and porting to GTK3... and GTK3 loses hands-down for being slower, more bloated, buggier, and having developers who can't pick one API and stick with it. If you're fine with a dying GUI toolkit, why not write your apps against GTK+ 1.2.x? I remember GTK+ 2.x causing uproar for being heavier too. (But, unlike 3.x, GTK 2.x had a stable API so people got used to it) ...or heck, go even lighter. Use Motif. That's been LGPLed and lots of developers still have it installed so they can run DDD. > 2) that C++ encourages code reusage and C doesn't, is a propaganda lie. > the reality looks quite different, C++ adds a lot of hidden dependencies > that make code reusage *harder*. think about inherited classes. in order > to know how to use them, i have to know all about the involved classes. > when some code i'm trying to debug passes around a base class object, i > can not be sure which descendant of the class was originally > instatiated. this makes debugging C++ code that was written by other > people very hard. > I don't have the experience to know whether that's a correct comparison for GObject-instrumented C but my first impression is that a language which does OOP natively would produce more meaningful output in its debugging tools than a system which jerry-rigs it on top like GObject. Again, this isn't a question of whether or not we're doing object-oriented stuff. GTK+ and Qt are both object-oriented and, at the language level, it's a choice between staying with a jerry-rigged hack or moving to a language which promotes OOP to a core language feature that a respect-worthy debugging tool must support without confusion. (Plus, there's the Qt Creator IDE which goes a step further and extends the underlying debugging to make things like QString as easy to work with as native language types like int and float.) Also, keep in mind that, back before a move to Qt was contemplated, Vala was being increasingly used as a way to get the speed of C but a more comfortable syntax and more automatic compile-time checks. Vala is a whole other language which compiles into C+GObject (If you have web programming experience, think CoffeeScript.) and I've yet to hear of a debugger which can do any kind of reverse-translation. Even without Qt Creator, C++ is often a lot easier to debug than Vala programs since the compiler knows how to reference back to the source you were actually writing rather than C files generated from it. ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr _______________________________________________ Lxde-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lxde-list
