Ask Slashdot: Which Classic OOP Compiled Language: Objective-C Or C++?
Qbertino writes: I've been trying to pick up a classic, object-oriented, compiled language since the early 90s, but have never gotten around to it. C++ was always on my radar, but I'm a little torn to-and-fro with Objective-C. Objective-C is the obvious choice if you also want to make money developing for Mac OS X, but for the stuff I want to do, both languages would suffice on all platforms. I do want to start out on x86 Linux, though, and also use it as my main development platform. Yes, I know quite a few other languages, but I want to get into a widespread compiled language that has good ties into FOSS. Both Objective-C and C++ fit that bill. What do you recommend? How do these two programming languages compare with each other, and how easy is cross-platform development in either? (Primarily GUI-free, "headless" applications.)
I'd go with C++ as the toolchain is mature and if you want to do any GUI work there's Qt, etc. Obj-C is more limited on Linux, but I"m sure the Windowmaker guys would love to have some more folks on board.
If you were me, you'd be good lookin'. - six string samurai
C++ is still very much a living, actively developed language. There's a lot of people using it for modern projects. It's well supported under pretty much all modern operating systems & you have excellent tools available under Linux.
There's not a lot of reason to pick up Objective C unless you plan on targeting Apple. It's pretty much a dead language everywhere else, outside of a few niche projects.
my sig's at the bottom of the page.
Yeah! Learn something new and make new mistakes!
If you take 20 years to pick up a new programming language, maybe programming isn't for you.
I don't expect any contrary opinions here on /.
NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
C++ is darn-near universal. It is everywhere and everyone uses it for everything.
Objective-C is an alternative language used, supported, and pushed by exactly one vendor. It only even exists because of the hipster mentality to "be different" just for the sake of being different with no real other point.
I don't see how this can possibly be a difficult decision.
Learn C++, and if you find yourself needing to dabble in Objective-C for some Apple device, no problem there. Doing the reverse would be more challenging and would limit your skills.
I wish people would stop treating modern C++ as if time had been standing still in the past decades. Yes, C++ is complex, but also expressive. Modern features (e.g. lambdas+auto+templates) often let you write code which is just as concise as its Ruby counterpart, but much more efficient.
Computer simulation made easy -- LibGeoDecomp
I hate C++. It's the triumph of syntax over clarity. The only thing it brought to the game was a better commenting method. I can't read a page of C++ without referring to something. I've never seen clear clean C++. I'd never willfully write in C++. Objective C is a measured improvement over C and I vacillate between obj C and GCC. Would that Swift were more like obj C and less like C++.
They are really quite different.
Objective-C is a lot easier, but you're largely locking into the apple world if you go that way. I wouldn't really say it has any neat features, but combined with cocoa it is a solid OO environment to code in.
C++ I'm mixed on. The original C++ was pretty decent, but they've tried to add so much stuff to it so it can compete with modern dynamic languages that it really just seems a bit overboard now. But it is still very versatile and arguable the best option if you want power and flexibility. Just be prepared to never really 'master' the language unless you have a lot of time to invest.
If you are happy to go the apple way have a go with objective-c. The cocoa class library is a great way to figure out good OO concepts with excellent documentation and tutorials. If you want more freedom and have more time to invest then C++ is the one to go for.
Or to be more precise, Squeak. It's compiled, it doesn't have the cruft of C, and it's as "classic" as it gets.
If you didn't have the "classic" requirement, I'd recommend Swift.
-jcr
The only title of honor that a tyrant can grant is "Enemy of the State."
Objective-C is not classic. That leaves you C++, a rather large language. Large in the sense that there are a lot of rules to learn (with good, practical reasons). But you don't need to know the whole language in order to be productive. And it's fun!
and then choose the most appropriate language+environment.
That is how you enjoy your choice the most instead of enforcing yourself to use something because others said so.
After looking back on 30 years of programming, the most fun projects were not always those with 'respected' languages.
Forget about all these people mumbling what is 'the best programming language' or what should be your choice because they say so.
And as for OOP, even every script language supports OOP so there is no need to break your head over low-level languages,
difficult to install environments, trying to figure out why stuff doesn't work for hours because of ridiculously outdated file dependencies,
header specifications and other nonsense that should have been done away with a long time ago.
With PHP, Python and RubyOnRails you're up and running in minutes and can have your first OOP program running within 30 minutes.
And with the vast amount of libraries , you can actually do all the fun stuff you can think of from image processing to neural networks.
Who gives a crap as long as you're having fun while picking up all the skills you desire to learn.
Yeah! Learn something new and make new mistakes!
No they are not NEW mistakes being made but OLD mistakes in a new way... There is nothing new under the sun..
C++11 and newer add hugely useful features, and it runs everywhere. Learn it. Use it. Profit.
Both Objective-C and C++ have object oriented concepts graphed on as an after-thought.
Your best bet for a classic compiled object language is either SmartEiffel or EiffelStudio.
If you are going to demand using a C-like language then your best bet is D.
Have you ever heard of VB6? I'd start there. Nailed it.
Unless you're using Apple's base libraries. Implementing a new Base Library is hard, I've gotten a tiny subset working on my own to see just what is involved. I wouldn't recommend writing the full thing unless you have a burning desire to do it. Porting GNUstep Base Library to various platforms is possible, and has already been ported pretty widely. You'll have to bundle LGPL libraries with your application if you plan to distribute binaries, depending on your application that can make Obj-C a non-starter.
I use C everywhere, and never C++. C is not the easiest thing to do, but putting together portable frameworks for C is less work than doing the same for Objective-C. (at least in my personal experience, your mileage may vary). C isn't an object oriented language, in that it doesn't do anything special to make that work. But there are OO toolkits for C, with varying degrees of horribleness. A classic is Xt (X Toolkit) and Xaw(X Athena Widgets), which is not terribly C99 friendly anymore. But it does permit limited object-oriented hierarchies. GObject (GTK+) is another option for C, I'm not a fan of it, but it's not obsolete unlike the Xtk/Athena example I mentioned.
What confuses me about your question is why are you only asking about C++ or Objective-C? There is Free Pascal (Delphi clone) and D. (D is very good, I highly recommend that over Obj-C). There are probably a lot of other options out there that would suit your initial criteria, especially surprising is you didn't mention Java. It's very good example of OO, perhaps OO taken to the extreme, but it's fairly clean. (Obj-C is a little hacky, but thats it's charm and power)
“Common sense is not so common.” — Voltaire
There really isn't all that much difference, so that once you get comfortable with one you should be able to switch to the other without much difficulty if you need to. But I'd lean towards C++ because the tools are more mature.
Two other tips:
1. Use Clang (part of LLVM) as your compiler. The error messages are vastly easier to interpret, which should cut down on both learning and development time. Note that Clang supports both Objective C and C++.
2. If you do go for C++, make sure to start learning on C++11 or C++14. C++11 significantly changes quite a lot about the language, and if you start with older C++ books, you'll have to unlearn a lot of stuff if you want to develop modern C++. C++14 has mostly just minor fixes to C++11.
I faced the same question recently and decided on C++. Apple, the main promulgator of Objective C, is sort of deprecating it with Swift. On the other hand the direction C++ is taking is appealing; the standards people have adopted some pragmatism in their decisions and listened to real users of the language. I feel like C++ is not actually doomed to collapse under it's own weight.
If you learn the new bits of C++ and use them to write clean code, with memory safely, ownership semantics, return value optimization, type inference and other modern techniques, C++ is a nice language. One bad part is incomplete compiler/linker implementations, but that problem only gets better with time, so your investment ultimately pays off. Another is compile time; #include + huge modern APIs makes for slow builds, but the standards folks know this and are working on it, and precompiled headers mitigate this (to some degree) in the meantime.
Long term, given the two possibilities you've limited yourself to, I think C++ is the better choice.
Object Pascal that is. It's available in Free Pascal for a lot of operating systems and is a small and fast development environment.
With anonymous unions in C11, C knocked out the last hurdle to using it smoothly for OOP.
Basically some asshat at NeXT chose Objective-C and that has sort of percolated through Apple. Originally the only way to do iOS apps was Objective-C; so I learned Objective-C. I hated every minute of it. All those damned, [][]][[. The moment I found an environment where I could go back to C++ I was gone.
So if you have to make an iOS app and you must use the iOS SDK then I guess you should learn objective-c. But under any other circumstances learn C++.
I don't get the whole debate. Programming is independent of language any good programmer should be able to learn a new language in a few days. In my career I've developed applications in four different assembly languages, java, Pascal, C++, basic, etc. It's just a matter of reviewing the syntax and doing the same things in slightly different ways.
Apple has made it clear their development future lies in Swift, not Objective-C.
That means you're choosing between a popular, well supported language and a dead end.
The choice should be obvious.
I do not fail; I succeed at finding out what does not work.
If you are not allergic to Microsoft products it's got a lot to recommend it:
Good frameworks
Available on Windows, OSX & Linux
Cross-platform tools like Xamarin (which as an interesting ecosystem for cross-platform mobile apps)
Indeed -- learn LISP. Lambda variables, recursion, all atoms being true objects. Then you can redefine the language to pretend to be any of the other HLLs out there.
Problem is, all the lessons that were learned with LISP have since been forgotten and are doomed to be made again and again.
You should learn c++ unless your real intent is to write a lot of software for an Apple only environment in a language they are looking at deprecating.
You can get a c++ build chain for pretty much any platform worth working on, and those without it will have a c build chain. There are literally billions of lines of c++ code out there, working in every possible environment. Programmers are churning out millions of more lines every year. You will never be out of work if you are a c++ programmer.
All those moments will be lost in time, like tears in rain.
There's not a lot of reason to pick up Objective C unless you plan on targeting Apple.
C++ is also important when targeting Apple. Objective-C is the language of the Cocoa API (Mac OS X and iOS), however there is no need to use it beyond code that makes Cocoa based system calls. And getting C++ and Objective-C code to call each other is trivial.
Personally I recommend separating UI and platform (OS) specific code from an app's core functionality and implementing the UI/platform-specific code in whatever the native language for the platform is and implementing the core code in C/C++. This leaves the core code portable, ready to target other platforms. I have iOS apps where the core code can be compiled in a console Linux environment and exercised by various scripts (regression testing) and in a random manner (fuzzing).
SF companies are like the fashion industry with models- they only hire people under tha age of 15 or something.
Also, they code everything in Javascript. Why Goigle's entire company is all Javascript. They even recoded Linux in Javascript! That's how fucking smart they are!
IMO the language has become very mature, particularly with C++14. It is a large/comprehensive language due to the variety of programming styles it tries to accommodate -- imperative, functional, object oriented, declarative, generic, and meta programming. One of the few languages that goes through an international standardization process (which has its own positives and negatives). C++ includes a variety of optional C/C++ features such as: OpenMP (one line pragma to multithreading constructs like a for-loop), clikplus ( a[:] = b[:] + c[:];) to vectorize which enable effective use of modern CPUs. Needless to add there are many good C/C++ libraries, including libraries for heterogeneous computing such as AMD's BOLT. GNU libstd++ provides parallel implementation for many standard algorithms making it a breeze to develop code using a declarative thought paradigm easing migration to Hadoop/PIG like infrastructures (see hpccsystems.com). If there is one area I would encourage programmers to invest time is with C++ algorithms and lambdas. If you really get the hang of working with C++ algorithms you will see the world very differently. Needless to add, there are plenty of graphics libraries and high performance BLAS libraries as well. The language takes performance seriously (see isocpp.org) and enables development of energy efficient solutions that are of growing importance to our planet facing serious climate change issues. With gcc 4.8+ you can use thread and memory sanitizers to proactively catch memory and multithreading issues avoiding many commonly claimed pitfalls of pointers and manual memory management. I have not tried the garbage collection API of C++ to comment on it. I am sure I am missing several major features but no C++ discussion would be complete with reference to the venerable Boost library. IMO overall the language has more positives/strengths than shortcomings making it a worthwhile investment, particularly on the long run.
Submitter wants a "widespread compiled language that has good ties into FOSS".
What about plain old C? Otherwise, second best choice seems C++
IMO the language has become very mature, particularly with C++14. It is a large/comprehensive language due to the variety of programming styles it tries to accommodate -- imperative, functional, object oriented, declarative, generic, and meta programming. One of the few languages that goes through an international committee-based standardization process (which has its own positives and negatives). C++ includes a variety of optional C/C++ features such as: OpenMP (one line pragma to multithreading constructs like a for-loop), clikplus ( a[:] = b[:] + c[:];) to vectorize which enable effective use of modern CPUs. Needless to add there are many good C/C++ libraries, including libraries for heterogeneous computing such as AMD's BOLT. GNU libstd++ provides parallel implementation for many standard algorithms making it a breeze to develop code using a declarative thought paradigm easing migration to Hadoop/PIG like infrastructures (see hpccsystems.com). If there is one area I would encourage programmers to invest time is with C++ algorithms and lambdas. If you really get the hang of working with C++ algorithms you will see the world very differently. Needless to add, there are plenty of graphics libraries and high performance BLAS libraries as well. The language takes performance seriously (see isocpp.org) and enables development of energy efficient solutions that are of growing importance to our planet facing serious climate change issues. With gcc 4.8+ you can use thread and memory sanitizers to proactively catch memory and multithreading issues avoiding many commonly claimed pitfalls of pointers and manual memory management. I have not tried the garbage collection API of C++ to comment on it. I am sure I am missing several major features but no C++ discussion would be complete without reference to the venerable Boost library. IMO overall the language has more positives/strengths than shortcomings making it a worthwhile investment, particularly on the long run.
The brace initializer syntax is the biggest structural improvement. Auto is fine but a skilled programmers needs to understand iterator types. C++ is very complex, and whole swaths of the language can be safely ignored. Now, if we could only decide which ones... Objective-C blows.
an ill wind that blows no good
I have never played with Objective C, but I have with C++. Nothing can be worse than that wretched language. It subsumes in itself the worst of C and the worst of the OO paradigm.
Does anybody actually do that? Isn't the only reason that language isn't extinct the fact that you can do fancy OSX/iOS apps with it? C++ all the way.
I've been trying to pick up a classic, object-oriented, compiled language since the early 90s, but have never gotten around to it. C++ was always on my radar, but I'm a little torn to-and-fro with Objective-C. Objective-C is the obvious choice if you also want to make money developing for Mac OS X, but for the stuff I want to do, both languages would suffice on all platforms. I do want to start out on x86 Linux, though, and also use it as my main development platform. Yes, I know quite a few other languages, but I want to get into a widespread compiled language that has good ties into FOSS. Both Objective-C and C++ fit that bill. What do you recommend? How do these two programming languages compare with each other, and how easy is cross-platform development in either? (Primarily GUI-free, "headless" applications.)
I would only bother with Objective-C if I was anticipating having to develop a lot of code for OS X or iOS which might be worth your time since there is money to be made there and IMHO it is a fun language to code in. There is a FOSS Cocoa implementation for Linux, GNUstep but I don't know how current it is or how much cross platform development it allows. Integrating C++ code in Objective C programs (aka. Objective-C++) is as easy as integrating C code into a C++ program so for cross platform purposes you'd be best advised to write as much of your business logic in C++ or even C and use more platform specific languages like Objective-C for view and controller logic. Basically write as much in C++ or C as you can since both can be used in Objective-C apps. That way, if you also want to, say... have an Android version you could write Java wrappers for your C/C++ code. Finally be very careful about what system calls and libraries you use. Just because something is available on Linux does not mean it is available on OS X, the other *NIX'es or Windows. I have all to often seen people end up with egg on their faces after spending significant amounts of time developing something on Linux and using everything Linux offer with wild abandon only to find out hat several key functions or even entire libraries are not available on other target platforms like, say Sun OS or AIX or that even if these are available they behave in a totally different way (example: Lex/Yacc). When doing CP development, even if it is just across multiple Linux/Unix platforms, it pays to write unit tests and regularly compile your software and run the entire test battery on target platforms other than the one you do most of your development work on (which is likely to be Linux).
Only to idiots, are orders laws.
-- Henning von Tresckow
This is like asking "which medical technique should I use for treating headaches, trepanning or inhaling mercury vapors?"
Yes... You can do OOP in C. With todays toolchains, libraries and techniques, C is more viable than a lot of people give credit for.
I personally have always disliked C++, and I know I'm not the only one. I've been OK with Obj-C, but... It is a bit eccentric, and it's probably on the way out with Apple now promoting Swift.
C, on the other hand, is eternal and evergreen.
Object Pascal is quite a nice language. The open source Free Pascal compiler targets many platforms and Lazarus gives you an IDE and frameworks for building GUI applications with Free Pascal. Delphi only runs on Windows, but can cross compile to OS X, iOS and Android for making multiplatform applications. See the changes since Delphi 7 for the current state of Delphi and the Delphi roadmap. The Delphi and Pascal subreddits are also pretty good resources.
If you are planning a career switch, C++. No question.
Just to teach something to you to do some hobby work? Pick something and go. You are over thinking it. You don't need the best in class, no pun intended, just anything will do.
If you are planning to create a course to offer to some college students, go with Java or something
If all you want is to troll the slashdotters to argue endlessly, congratulations, you have done it. Let me add my contribution too, emacs man! Use emacs. vi sucks.
sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
Objective-C++!
(Yes, there is such a thing. And yes, I'm being facetious.)
Yaz
C++ and Objective C are very different languages, as most of the posters would agree. And I would agree that Objective C (although fully supported on both the C++ and Clang tool chains) is not as cross platform. That's because most of the libraries that make Objective C useful are only available on the Mac. Objective C, however, has a completely different approach to object orientation that's closer to Smalltalk. It has a message sending style as opposed to the method oriented approach of C++. For example, you can serialize a method invocation on Objective C, send that invocation across a wire, and invoke it on a remote object. I think (oddly enough) that Objective C gets a bad rap as an Apple technology. And although that's the only place where it currently flourishes, it has an interesting approach to OO that is worth looking at.
I picked up objective-c when ios became big. it's fine and all, but what i find myself doing is writing as much as i can in c++ and then just calling into it from objective-c where i need to. xcode will happily compile the two languages (technically i'm using objective-c++). really, even in apple's apis objective-c only gets you so far. sooner or later you will find yourself calling into c apis. heck even some of their examples only feature a rough skeleton of objective-c working with a big c library.
my advice: learn enough objective c to make an NSView and handle some events, and send that stuff right into you c++ api asap.
If you're been trying to learn since the early 90's and still don't know anything you're fucking stupid, and programming will never be for you. Even a fucking monkey could pick something rudimentary up given 25 years,
There is a continuum of langauges along the "how strong is the type system" scale. C++ is on the strongest end of the scale. (And here, I have in mind C++11). Let's say C++ is a 9/10. Let's say a scripting language like Ruby is a 1/10. On the scale, Objective C is maybe a 7/10.
A strong type system is essential for high-producitivity, low-error programming of complex projects. If you are programming smaller things, a less-strong type system can be a benefit, due to the speed of programming and the flexibility it gives you. But once you're talking about more than a few hundred lines, you're well into strong-typing territory. At this point, you should think thru your design and start throwing down a type system!
Pick Objective-C. The language is small and simple to understand. If you're already a good programmer with knowledge of C you can learn it in 2 weeks to a month. The frameworks will take longer but the language you can learn in a few weeks. C++ on the other hand will take you forever to learn, it's a large complex language.
If you're picking from scratch, check out Ada 2012. It has all of the power of C++ but it is a "safer" language designed to produce more reliable software (i.e. the kind that can be used in bullet trains and airplanes). While aerospace and defense are its reasons for existence, you can produce high quality desktop software as well.
http://www.ada2012.org/
Out of curiosity: is there a point with ObjC++ or are the advantages of C++ and ObjC redundant? Secondly : is C++ still a superset of C89 or have they diverged further?
Don't use OOP at all.
Choose Life. Choose a job. Choose a career. Choose a family. Choose a fucking big television, choose washing machines, cars, compact disc players and electrical tin openers. Choose good health, low cholesterol, and dental insurance. Choose fixed interest mortgage repayments. Choose a starter home. Choose your friends. Choose leisurewear and matching luggage. Choose a three-piece suit on hire purchase in a range of fucking fabrics. Choose DIY and wondering who the fuck you are on Sunday morning. Choose sitting on that couch watching mind-numbing, spirit-crushing game shows, stuffing fucking junk food into your mouth. Choose rotting away at the end of it all, pissing your last in a miserable home, nothing more than an embarrassment to the selfish, fucked up brats you spawned to replace yourselves. Choose your future. Choose C++... But why would I want to do a thing like that? I chose not to choose C++. I chose somethin' else. And the reasons? There are no reasons. Who needs reasons when you've got Erlang?
Master of Jack is the one thing where no other compiled language triumphs over C++.
If you're sure on day one that there are language features your project will never need (on any project fork)—cross my heart and hope to die—then go ahead and pick a less cluttered language better suited to your constrained subdomain.
What you're really saying here is that you'd rather work in a constrained subdomain—pretty much any constrained subdomain—than hump around on crowded streets hulked up with a universal camera bag (source Mumbai-based photojournalist Dilish Parekh).
You can do OSX and ios development in c++, with a minimal amount of ObjC code to talk to the OS. Remember that ObjC is a superset of c++, so you can mix them without any kind of awkward interfacing, they just link together.
I'm not happy with any language that's available, but that's because I have interests in hard to program stuff.
I have lots and lots of experience with C++, but I wouldn't recommend it, except as a form of torture. Java too, is gets in your way far too often, though it's better than C++.
To me, objects are a way of organizing APIs, so I DO like OO...
What to write it in depends on what features you need. Do you need it to be fast? How fast? Do you need to take advantage of multiple processors? Do you need to share data between them?
Is programmer time more important than running speed?
Is reliability more important than programming time?
One system I'm enjoying these days, though it's far from perfect is Lua, through the amazingly good trace compiler/jit Luajit.
It is every inefficient in terms of memory. It doesn't support multiple threads. It doesn't even have standard object system, though it's not hard to implement a prototype based one in it... But it's kind of like programming in Self or Ruby with the complexity knob turned all the way down.
It also has the advantage of running on everything. There's even an ARM version of the JIT.
If you don't need the speed, Python doesn't look too bad and has lots of libraries.
If you need something that can be data-center-sized then find a .net language or java... There's a lot of choices under .net and it probably scales the best. Depending on what I was trying to do, I might use F# or ClojureCLR or IronPython...
The best OO language that time forgot is Dylan. I'm disappointed that Apple never really finished developing it.
For system programming, use go.
I have been mulling similar question for myself for some time. i.e. where should I spend my limited hobby time: learning Obj-C or C++?
In the last few months Rust has caught my attention. Even then it's not yet at verstion 1 (at time of writing its at alpha-1), I really like the concept and what they are try to achieve with the language.
My comment will probably be burried, but if you do read it, spend a few minutes wondering around their web site. For exmaple their 30 minute introduction to Rust.
Yes, Apple has millions of lines of code and yes Apple is not going to re-write all that code in the next couple of years.... but there is no denying that Swift is more productive than Objective-C easier to maintain. Apple is not going to say, Objective-C is dead but it is now very much a "legacy language" where you maintain the code but new stuff will be written in Swift. Swift though is a new language and it still has maturing to do. Being that Apple is both the user and creator of the language, most if not all that Swift may not be "able to handle" right now will eventually be added. If there is something that for performance reasons is not there yet - it can still be written in Objective-C and used in a Swift project.
If you are developing for the Mac OS X or iOS platforms - you would chose Swift from this point going forward. You would maintain your legacy Objective-C code until the point where it makes sense both business and risk-wise to rewrite it as part of some upgrade. As far as Linux, Apple has made no commitment (yet) on when/if they will open-source / multi-platform it so it is moot for the purposes of the OP. To be quite honest the original requirements for the OP seems to be centered around that he missed out on some fad/direction and now is asking what he should pick-up but only wants to use "classic" languages, but without any real clear reason on what his "needs" are. This is backwards. Languages are tools, you don't pick a tool first. It would be akin to picking a hammer then turning and saying, good... got that out of the way.... now I think I will fix my watch.
The [[[][]]][] in Objective-C are an extremely simple concept to grasp. The same can't be said for all the >< in C++.
I'm not even sure what a "classic object oriented compiled language" is meant to mean or why it should be the criteria for programming something, but given the choice of C++ or Obj-C then C++ is the answer in virtually every case. Obj-C only makes sense when targetting iOS / OS X or some niche like OpenStep and whatever merits Obj-C might have as a language it would be insane to use it anywhere else.
I like SmallTalk, and I like C. However, their syntaxes are very different. Objective-C mashes them together in a way that results in a very inconsistent feel to the syntax. C++, on the other hand, is just a logical extension of C syntax. Sure, there are some advantages to Objective-C's message passing approach. Well, if you consider silent failure when you pass a message to a null object to be an advantage.
Objective-C predates C++, and it shows. Someone shoehorned in OOP in a way that was borrowed from a totally different philosophy. Then Stroutrop came along and did it right. Some people may have complaints about C++ at an abstract level, but at least the language is internally consistent (or more so than Objective-C anyway).
Then you can redefine the language to pretend to be any of the other HLLs out there.
I won't touch a language that does this for the simple reason that anybody writes his own 'language' with it and nobody can read what anybody else does. And while I'm at it, the whole "there's more than one way to do it" is totally counter productive since 10 programmers would produce 10 different codes and few would understand the logic of the others easily. Gimme a strict language with only one way to do it and my code will be the same as my neighbor and that's great for readability.
Non-Linux Penguins ?
The question is silly. Which language to choose depends on the task at hand, not arbitrary religion. I was using C++ when it was "C with classes", wrote books and articles about it -- and my answer is to use the tool best suited to a given task and target platform. I've used Objective C when it fits my goal. I dislike questions asked only to invent false reasons for making a choice.
All about me
Java is nowadays a "classic" compiled OOP language.
Come to Lisp, we have ()(((()))(())))()
C++ isn't really one language. The language has evolved in several ways over the years. C++11 is vastly different from the first incarnation.
In real-world programming you might therefore encounter many different styles: C++ used as a better C, C++ but with the coding style dictated by the C libraries that are used, C++ as "C with classes", C++ with STL, C++ with STL and Boost, and then C++11.
I would suggest C++11 or at least C++ with Boost. C++11 is the most modern, and shares some traits with other modern languages such as C#, Python and Ruby but which older versions of C++ lack. Also, several of the more recent additions to C++'s standard library have come from Boost.
C++ is also an incredibly complex language, with many workings that are more or less implicit. An assignment, parameter passing or return could involve several calls to virtual functions into the classes being used.
But once you have learned the philosophy behind programming in C++ and how to do it correctly, you will find that C++'s way is very powerful.
Objective-C is like "C + Smalltalk", and is mainly used by Apple because of historical reasons.
"We mustn't be caught by surprise by our own advancing technology" -- Aldous Huxley
My own experience has been that C++ is an excellent choice for the work you're interested in. It's full of pitfalls, but it's also full of excellence.
Start with Stroustrup's "The C++ Programming Language" and move on to Scott Meyers' Effective C++ books. Stroustrup makes picking up the language easy and natural. Meyers helps you around all the pitfalls so you can come up with elegant solutions with a minimum of effort.
Don't dismiss boost. As others have said, it's a bit of a minefield, but it also has a lot of well implemented solutions to common problems.
Qt is fun as well, and I make my daily bread using Qt. But if you're not writing a GUI app, there might be better solutions to a lot of the problems their non-GUI classes are trying to solve.
Easy Online Role Playing Campaign Management
* mature
* active evolution
* multi paradigm
* low and high-level programming
* widely available and supported
The future of Objectiv-C?
Well. How knows, it is not widely adopted outside of iOS and Swift is replacing it anyway because Apple has decided so.
I know plenty of open source applications, from GUIs in Qt and gtkmm to console applications and interpreters of programming languages in C++. The backbone of any Linux distribution is C and C++.
I know 0 packages in my Linux installation that are written in Objective-C. There are some, for sure, but are they widespread? I doubt it.
Common Lisp also has a macro system that's comparable to C++'s template system, but much easier to use, and the Common Lisp Object System is more powerful than C++'s. (Stroustrup wanted to include CLOS's multidispatch system, in which a method is selected for execution by the class types of more than one parameter, but couldn't find a good way to put it in C++.)
"When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
The consensus has been that C++ is really useful, really powerful, but really complex, particularly in view of layer upon layer of features piled up along its evolution. How, then, to best learn how to code C++ "the right way" with its modern incarnation and features? Any recommendations?
Take it easy, Charlie, I've got an Angle...
Actually I hate how many people beat the crap out of templates. I love the cleaner implementations of templates when used for things like vectors but I was looking at this guy's code and he was using templates in some obtuse way to literally initialize integers. I forget how he did it but he made "int x=5;" very very complicated.
// This function will get the user's ID from their username
// Takes one parameter username which is the user's username
// Returns one integer representing the user's ID.
// Returns zero if the username is not found
// CREATED BY: Unknown [IP:123.123.123.123] on Jan 1, 1970
// MODIFIED BY: Unknown [IP:123.123.123.123] on Jan 1, 1970
// MODIFIED BY: Unknown [IP:123.123.123.123] on Jan 1, 1970
// MODIFIED BY: Unknown [IP:123.123.123.123] on Jan 1, 1970
// MODIFIED BY: Unknown [IP:123.123.123.123] on Jan 1, 1970
//Set the user_id to its default value
.... some kind of username lookup ...
//When complete return the user's id if any matches found. Otherwise return -1
The other thing that I see people doing is the nightmare of "future proofing" their software with templates. They will write functions that only take a single input type and return a single output type and use templates so as to make this generic. Except that this isn't some API situation but just a function that will probably never ever ever ever be expanded.
I lump these people in with those who will comment like this:
int GetUserIDFromUserName(string username)
{
int user_id=0;
return user_id;
}
Now these same pedantic asshats are doing the above function using templates just in case the user ID become boolean or something or the username becomes a float.
C++ is the triumph of terseness over readability. If you want to play with Object Orientation use Smalltalk. Then choose a suitable language for production.
If you really want to understand one then learn both while doing some compare and contrast.
Ideally you should have a few simple projects that you can implement in either language and try to maintain both.
Of course you will need to do nearly the same with C as well since they are both "based" on C.
Your understanding will be far deeper in the end.
... Delphi !!!
Or, you can just agree on implementation.
See, the thing about a real object oriented language is that you define your objects, and then they only work in one manner. This means that if you're working on a project, you create your requirements documentation, and then define your core objects to match that. And then everyone who touches that code is forced to do things the same way, or else redefine the objects (which is a no-no).
The "strict procedural language pretending to be object oriented" approach is what gives unreadable code, as you end up with everyone being allowed to do whatever they want, and there's no real object model in place to constrain that.
Honestly it's not the best language to learn OOP concepts. It's too complicated and makes too many compromises to be compatible with C. But if you are sticking to Linux, it will be the only choice for significant development involving UI or system level programming. On OSX, Objective C would be much easier to learn coming from C and on Android Java would be a good choice. If you wanted to just learn current best practices without regard for practicality, there are interesting newer languages like Scala.