Slashdot Mirror


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.)

407 comments

  1. c++? by Rinikusu · · Score: 3, Interesting

    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
    1. Re:c++? by menkhaura · · Score: 5, Informative

      Even for non-GUI work, Qt is a blessing if you want to do cross-platform programming. The library does a lot, ranging from database access to network programming, all in a very well documented and well thought out API.

      Good luck.

      --
      Stupidity is an equal opportunity striker.
      Fellow slashdotter Bill Dog
    2. Re:c++? by Anonymous Coward · · Score: 2, Informative

      Another plug for Qt:

      If you are new to C++, Qt makes it very easy to write code without too many trips to Google. QString class is my favorite example of this. It's pretty easy to figure out how to split a string on a comma with QString. How do you do it with std::string? If your answer wasn't "use boost", you found some chunk of code on Stack Overflow, didn't you?

      The downside to this aspect of Qt is that it can make transitioning into non-Qt C++ development a bit of a challenge.

    3. Re:c++? by ShanghaiBill · · Score: 1, Flamebait

      I'd go with C++

      So would I, even for development on Apple. You can mix C++ and Objective-C. So for Mac OS X apps, you can write 95% in C++, and only use Objective-C for the Apple APIs. I try to keep all the Objective-C crap isolated in separate files whenever possible.

      Objective-C is an ugly, clunky language, and the only reason Apple uses it is to intentionally make your code incompatible with other platforms.

    4. Re:c++? by cheesybagel · · Score: 1, Interesting

      Both languages suck. I would pick C++ as it is more future proof and less niche than Objective-C.

      I mostly program in Python or C though. Sometimes Java. I hate C++. C++ is the Swiss Army knife of compiled languages. It does a bit of everything but nothing well. You can always find another language that is better at it on every single aspect you look at. Jack of all trades master of none.

      That post on Nim a couple of days back on Slashdot was interesting but I haven't tried the language yet.

    5. Re:c++? by Anonymous Coward · · Score: 4, Informative

      Objective-C is an ugly, clunky language, and the only reason Apple uses it is to intentionally make your code incompatible with other platforms.

      Actually, they use it for its dynamic binding and loading, but don't let facts get in the way of your FUD!

    6. Re:c++? by TechyImmigrant · · Score: 2, Informative

      Objective-C is an ugly, clunky language, and the only reason Apple uses it is to intentionally make your code incompatible with other platforms.

      Actually, they use it for its dynamic binding and loading, but don't let facts get in the way of your FUD!

      That and C++ was horribly immature at a time when Objective-C was not and the Next guys were developing NextStep.

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
    7. Re:c++? by Jeeeb · · Score: 5, Informative

      Objective-C is an ugly, clunky language, and the only reason Apple uses it is to intentionally make your code incompatible with other platforms.

      I'm not a particular fan of Objective-C either but this is just wrong. Apple inherited Objective-C when they bought NextStep and used it as the foundation of OS X. OS-X got its start in life as a partial rewrite of the NS shell and the addition of some compatibility layers (Classic Mac OS, Java, .etc.) to make up for the lack of applications. At this stage, there would have to be really really major benefits to a rewrite to justify the direct cost, not to mention the opportunity cost.

    8. Re:c++? by Anonymous Coward · · Score: 0

      > That and C++ was horribly immature at a time when Objective-C was not and the Next guys were developing NextStep.

      Yeah, but I think Objective-C aged pretty well compared to the warts C++ gained as it matured.

      I find it pretty funny, SBill calling Obj-C "clunky and ugly" out of one side of his mouth whilst advocating C++ from the other. The cognitive dissonance must be physically painful. :)

    9. Re:c++? by fnj · · Score: 1

      What's the mystery?

      #include <iostream>
      #include <sstream>
      #include <string>

      int main(int argc, char *argv[])
      {
          std::istringstream iss(argv[1]);
          while (iss.good())
          {
              std::string s;
              std::getline(iss, s, ',');
              std::cout << '"' << s << "'\n";
          }
          return 0;
      }

    10. Re:c++? by Anonymous Coward · · Score: 0

      The "mystery" is that nowhere in your code does it mention the word "split". Furthermore, it takes multiple lines of code to do what QString does with a single method call.

      The point isn't that such tasks can be done using the C++ standard library. Of course they can be. The point is that Qt makes them dead simple. The standard library's approach typically involves classes and multiple methods with non-obvious names, while Qt's uses better naming and fewer methods.

    11. Re:c++? by Anonymous Coward · · Score: 1

      Not a mystery to me, but I already know C++. Your code fails to handle a delimiter at the end of the input, but I digress...

      Think about this from a beginner's perspective: "All I wanted to do is split a string, and it's six lines of code?"
      None of what you wrote should seem natural to anybody except people brain-damaged by learning and using C++.

      Contrast with:

        QList<QString> tokens = QString(argv[1]).split(",");

      Stuff like this is the reason Boost exists.

    12. Re:c++? by Anonymous Coward · · Score: 1

      how would your code look if you needed the read string to be utf-8 or at least utf16?

    13. Re:c++? by Anonymous Coward · · Score: 0

      So, Apple got Objective-C because Steve was back at board... the same Steve that founded Next when he was fired in 1985 from Apple. The same guy with a personality cult about him... Just sound like Objective-C is the holly hammer of a monotheist church.

      At least C++ got late committees for its evolutions. Could Objective-C evolves, now that the pope is no more ?

    14. Re:c++? by Greyfox · · Score: 4, Informative
      Yes. Dynamic binding and loading is ugly and clunky.Errors you don't catch at compile time are errors that you have to write tests for. You know who writes tests? No one, that's who! So in practice, errors you don't catch at compile time are errors your users are going to catch. And then you have to debug through an ugly clunky maze of dynamic binding and loading.

      But don't get me wrong. I can be... objective... Ok, look. Back in the day we stood at a crossroads. Do we make our changes to C to make it OO fairly lightweight and mostly retain the C syntax, or do we radically change the entire feel of the language. Objective C went for the lightweight approach. Object instances are essentially just pointers to dynamically allocated memory syntactic sugar for pointers to functions around methods. Very C-like idiom and honestly a pretty elegant method of handling things. If you just want C with objective C is worth looking at. It's one step past maintaining some structs with pointers to functions and maintaining OO and inheritance manually, and that's not necessarily a bad thing.

      C++ took longer to get where it was going, but it essentially set out for the strictness of ADA in a C like language. It's much more touchy about types and is geared toward catching as much as it can at compile time. Before they got the STL and the C++11 changes rolled in, it was really kind of a pain in the ass to use. It's big and clunky, has a lot of rules to memorize and its error messages are hideous. But in the right hands, with the right libraries, it can be incredibly concise, remarkably fast and a ridiculously powerful tool. In my opinion, one worth learning.

      In either case, the first thing you should learn is a unit testing framework for that language. No matter what kind of coding you're doing, there's simply not a good excuse to avoid unit testing any code you're planning to deploy anymore.

      And yeah if you go the C++ route, QT is some mighty tasty kool-aid. Sure you have to run their pre-precompiler on your code and will find it much harder if you want to just hook some random non-QT object you have into your system. Sure they demand that their includes be in a specific place in your code. But it's delicious kool-aid! Go ahead, give it a try! I was just playing around the other day with a QT window into which I'd stuffed a QImage that I had loaded up with some pixels from a GDAL raster driver, and it was less than 500 lines of code (Source code's on github if anyone's interested.) Gotta say that was pretty impressive, though still a fairly trivial example.

      --

      I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    15. Re:c++? by Anonymous Coward · · Score: 0

      The mystery is how I had forgotten how horrible C++ syntax is.
      Using the shift operator to indicate stream I/O seems like one of those "obviously bad choice" kind of things.

    16. Re:c++? by Anonymous Coward · · Score: 0

      > Using the shift operator to indicate stream I/O seems like one of those "obviously bad choice" kind of things.

      Operator overloading in general seems like one of those "obviously bad choice" kind of things!

    17. Re:c++? by Anonymous Coward · · Score: 0

      Same for "blanket statements".

    18. Re:c++? by Pieroxy · · Score: 1

      I think you should be modded funny actually. I haven't done any C++ since college (say, 20 years ago) and reading your code makes me happy that I didn't. The mess of it !

      As another commenter pointed out, what if the string is made of UTF-8 and not ASCII ? Such trivialities should be handled at a layer way below this.

    19. Re:c++? by Carewolf · · Score: 1

      Objective-C is an ugly, clunky language, and the only reason Apple uses it is to intentionally make your code incompatible with other platforms.

      Actually, they use it for its dynamic binding and loading, but don't let facts get in the way of your FUD!

      That and C++ was horribly immature at a time when Objective-C was not and the Next guys were developing NextStep.

      I think they were contemporary. They were young and immature together. Both born in 1983.

    20. Re:c++? by michelcolman · · Score: 2

      Objective C++ works well for me. You can not only mix and match Objective C and C++ files, you can use a mix of both in the same files. Just give them the ".mm" extension. No problem usig std::cout from [theView dosomethingWith:(int) i]. Of course you do have to understand both languages, so it takes more time to learn. But you can use the strong points of both languages and pick whatever you need. Need to stick a bunch of UIView*s into a std::vector? No problem!

    21. Re:c++? by TheRaven64 · · Score: 2

      First, WindowsMaker doesn't use Objective-C, it's written in C. However, GNUstep, which is the open source implementation of the Cocoa frameworks (originally the OpenStep specification, but they're tracking Apple changes) could use more help! Oh, and we support (on *NIX) a superset of the Objective-C language that Apple supports on their products, so I wouldn't say that Obj-C is more limited on Linux.

      That said, and I say this as the maintainer of the GNUstep Objective-C implementation, I'd recommend C++, but with the two caveats:

      • C++ is not an OO language. It sort-of supports OOP, but writing OO code in C++ is not the natural way of using the language.
      • Don't look at any version of the language before C++11. It's just terrible and will damage your brain.

      C++11 and C++14 have cleaned up C++ a lot. With shared_ptr and unique_ptr, you can write code with sane memory management. With perfect forwarding, lambdas, and variadic templates, you can write code that has most of the benefits of a late-bound language. I like a lot of Objective-C, but Apple broke the 'simple, orthogonal syntax' when they added declared properties and a few other things. Any successful programming language eventually becomes a mess of compromises and ugly corners. Some, like Python and C++, start that way, but at least C++ has been slowly improving over the last couple of versions.

      The one thing where Objective-C is still a clear winner is in writing libraries that want to maintain a stable ABI. This is insanely difficult in C++ because the language doesn't have a clean separation of interface and implementation and relies a lot on inlining and static binding for performance. The down side, of course, is that once you have a library in Objective-C you're limited to consumers who also want to use Objective-C.

      Oh, and Qt GUIs suck beyond belief on OS X - not sure what they're like on Windows, but I wouldn't recommend them for a portable UI. Good MVC design and a native UI is the only way to go if you really want a cross-platform GUI app that doesn't suck.

      --
      I am TheRaven on Soylent News
    22. Re:c++? by Anonymous Coward · · Score: 0

      And what's more, we Qt devs actually hang out on Slashdot. :)

      BTW, expect to see Qt in a LOT of embedded devices within the next year or two. Even more so than before.

    23. Re:c++? by Anonymous Coward · · Score: 0

      The code works fine for UTF-8. Any byte that is valid ASCII has exactly the same meaning in UTF-8 as it does in ASCII.

    24. Re:c++? by dunkelfalke · · Score: 1

      I just wish you QT devs would finally fix the Wacom bug on Windows. It was supposedly fixed long ago, but is still present in QT5 applications.

      --
      "It's such a fine line between stupid and clever" -- David St. Hubbins, Spinal Tap
    25. Re:c++? by Eunuchswear · · Score: 2

      > Using the shift operator to indicate stream I/O seems like one of those "obviously bad choice" kind of things.

      Operator overloading in general seems like one of those "obviously bad choice" kind of things!

      Yup, nonsense like:

      int i, j;
      real x, y;
      compl z;
      ...
      x = i / j;
      z = x / y;

      Bloody operator overloading.

      --
      Watch this Heartland Institute video
    26. Re:c++? by Eunuchswear · · Score: 1

      Ok, now modify the code to split on white smiley face characters.

      --
      Watch this Heartland Institute video
    27. Re:c++? by Anonymous Coward · · Score: 0

      yeah, I would have believed that apple were just trying to avoid pointers and wanted dynamic binding and loading, before but as we all know, it's all just marketing crap with them.

    28. Re:c++? by countach · · Score: 1

      I find it very odd the claim that OO is not the natural way of using C++. I mean, what is the natural way then?

    29. Re:c++? by Wootery · · Score: 1

      Objective-C++: the ultimate bastard-child language.

      C++ is already arguably 4 languages: the preprocessor, C++ core, templates, and the constexpr subset. Now to throw Objective-C into the mix...

      I admit it's a neat hack though. Very cool that it actually works, and a nice bit of work by the compiler guys.

    30. Re:c++? by tigersha · · Score: 1

      Bullshit. It is a legacy thing, not a intentional incompatibility thing.

      Apple basically bought OS/X from Next together with Job back in the previous century and Next was using Objective C back in the late 80's. All the Apple API's start with NS_. That stands for NextStep. Back ini the mists of time when the C++/Obj C choice was made Apple was not even involved (but Steve Jobs was). In those days a choice between C++ and Objective C was not clear cut, both languages were very new and untried. C++ only became important because Microsoft used it for their Windows API's.

      Objective C compiles just fine on any platform, and Apple also uses C/C++ for much of their *NIX userland

      Honestly, if Apple/Microsoft/Linus were to rewrite the entire operating system stack from scratch today I doubt that C/C++/Objective C would be used. Or at least someone would think about redesigning the languages. Momentum counts for a lot.

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    31. Re:c++? by jcupitt65 · · Score: 2

      I'm not sure that's really fair to Obj-C. Another way to explain the differences would be to say that Obj-C comes from the Smalltalk family of OO languages and C++ comes from Simula.

      Smalltalk-family languages (eg. also Ruby, Swift, etc.) have late binding: you can join up things at runtime. This is great for GUIs, many common patterns become far easier. Simula-family languages are much more rigid. Almost everything is known at compile-time, so it's safer, but the rigidity makes some things harder to implement.

      Writing a GUI in plain C++ is very painful, so all toolkits (that I can think of) add a late binding mechanism. Qt, for example, has signals and slots. Seen from this angle, Obj-C is something like Qt, but with the signal/slot mechanism made part of the core language and syntax.

    32. Re:c++? by herve_masson · · Score: 2

      > Yes. Dynamic binding and loading is ugly and clunky

      Really ? You mean: universally ugly and clunky ?

      I've spent 10 years in programming Objective-C. I wrote myself an Objective-C compiler at a time none existed (not really a compiler, a parser that generates C and a runtime lib). In the company I used to work for, it helped a great lot more than it has hurt. It also made possible very sophisticated debugging and testing environments, thanks to the dynamic bindings of Objective-C. I don't find that ugly and clunky, not even in the language syntax details.

      My point is that dynamic bindings and introspection are immensely powerful tools. They enable generic programming in a clean way as long as you know what you're doing. You may reach similar results with strict typing language, or code generators (thanks visual c), sure. I don't think it's that easy though.

      You may hate it for the reasons you mention (Prone to errors because too much things pass the compiler task), which are perfectly valid. But writing it's inherently "ugly and clunky" seems really missing the point here. "Dangerous" is a better word maybe ?

      In the other hand, I've seen many C++ programmers lost in their code that no one but the compiler could barely understand a few month after writing. I'm absolutely not saying c++ is inherently bad and/or difficult; it's just about the people who use it and the rules your team adopt to make it coherent and intelligible.

    33. Re:c++? by Anonymous Coward · · Score: 0

      You need 3 includes, a stream (from a pointer to an array, no less), 2 methods, a loop and 6 lines to do the job. And yet, nowhere does it say something like "split" either (not descriptive at all). And it probably has problems with some encodings, and someone mentioned a bug about commas at the end of the line too. That's *amazingly* awful!

      Loads of languages have a .Split() method which is a lot better in every way. It's way more descriptive, concise, and it's bug-free too.

    34. Re:c++? by TheRaven64 · · Score: 2

      C++ is a language that is very good for generic programming. It doesn't really meet Alan Kay's definition of OO (and he's the one who coined the term), nor does it pass the Ingalls Test for OO. It has classes, but method dispatch is tied to the class hierarchy so if you want to really adopt an OO style you need to use multiple inheritance and pure abstract base classes, which is a very cumbersome way of using C++.

      The worst C++ code is written by people who are thinking in C when they write C++, but the second-wrost C++ code is written by people who are really thinking in Smalltalk. If you're one of these people, then learn Objective-C: the language is far better at representing how you think about programs.

      Any programming language can be used to write code in any style. You can write good OO code with a macro assembler if you want. However, every language has a set of styles that fit naturally with the language and ones that don't. You can force C++ to behave in an OO way, and it sort-of works, but it's not using the language in the most efficient way.

      --
      I am TheRaven on Soylent News
    35. Re:c++? by NJRoadfan · · Score: 2

      Could Objective-C evolves, now that the pope is no more ?

      Nope, it was swiftly replaced after his demise.

    36. Re:c++? by Anonymous Coward · · Score: 0

      I'm sorry, but if you consider that code a mess, there is no need for you to ever interview with me or any company I work with. That is not messy. Not even a little.

    37. Re:c++? by NJRoadfan · · Score: 1

      Microsoft used plain old C for Win32. That cruft known as MFC used C++.

    38. Re:c++? by gbjbaanb · · Score: 1

      C++ is a language that is very good for generic programming. It doesn't really meet Alan Kay's definition of OO

      To be fair, there aren't very many that do!

    39. Re:c++? by TheRaven64 · · Score: 1

      There are a few. Smalltalk obviously does, as does Self. Lisp also can, depending on how it's used. JavaScript is probably the mainstream language that fits closest (it's actually very close to Smalltalk). Java and C# both mostly do, though they wouldn't count as pure OO.

      --
      I am TheRaven on Soylent News
    40. Re:c++? by BasilBrush · · Score: 1

      Division is a single concept, whether it's ints or it's reals and complex numbers.
      Bit shifting and stream i/o are completely different concepts.

    41. Re:c++? by michelcolman · · Score: 1

      C++ is already arguably 4 languages: the preprocessor, C++ core, templates, and the constexpr subset. Now to throw Objective-C into the mix...

      You just summed up all the things I like about it ;-)

    42. Re:c++? by BasilBrush · · Score: 1

      In Obj-C:
      NSArray *items = [string componentsSeperatedByString:@","];

    43. Re:c++? by BasilBrush · · Score: 1

      I try to keep all the Objective-C crap isolated in separate files whenever possible.

      As we established in previous stories, you don't code in Objective-C at all. You claim experience you don't have.

    44. Re:c++? by JoeMerchant · · Score: 1

      It's not FUD it's NAE - Not Applicable Elsewhere.

      Objective C is mandatory in the Apple software realm, obscure elsewhere.

    45. Re:c++? by Greyfox · · Score: 1

      boost::signal2 and boost::bind add signals and slots, too, and they seem more intuitive to use than QT's version. They've also been accepted into the language standard in C++11, though I'm still using the boost versions of a lot of the C++11 stuff for compatibility with older compilers. They make a great addition to library code -- I use signals in data factories to signal the availability of new objects. They're also pretty bulletproof in terms of type safety. The compiler will detect that you're trying to attach a incompatible function at compile time and you can adjust the parameters as you need to with bind. Just don't forget to pass the "this" pointer to objects!

      --

      I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    46. Re: c++? by iluvcapra · · Score: 1

      Exactly, they're a single concept, so they should use the same operator. And if C++ don't have overloading, that would be impossible.

      "Concepts" don't come from a language, they come from the programmer.

      --
      Don't blame me, I voted for Baltar.
    47. Re:c++? by Maury+Markowitz · · Score: 1

      > Objective-C is an ugly, clunky language

      It is now. It certainly wasn't when I first encountered it in 2000, running on OpenStep. Back then it was clear, far cleaner than C++, and the libraries were (and are) fantastic. Say what you will about Qt, all of it's true, but everything from strings to db programming was joke on OpenStep compared to anything else out there. Which is why the company existed at all at that point, the financial guys used it a lot.

      But fast-forward a decade to 2010 when I next looked at it for an iPhone program. Uggg! What an abysmal mess! I can't believe it's even the same language! So many one-off @ commands and bizarre "well, you need to know that..." In spite of all the problems in beta testing a *languages*, I still moved to Swift ASAP. Swift is currently about what ObjC was when I first saw it - relatively lightweight and fairly clean. I'm sure that will change, but for now...

      That said, C++ remains a mystery to me. The syntax steadfastly refuses to lodge in my brain. I had the same problem with Lisp, which is saying a lot. But as others have noted, it remains the only real cross-platform system one can use for base logic and then plug into the underlying GUI language whether that be ObjC or Java. The only thing that comes close is C, and I still debate which language is better to use in these cases.

    48. Re:c++? by jellomizer · · Score: 1

      I tend to agree, C++ gets its popularity just because you can code normal C in in it, but it does very little to put you in an OO mindset, you can use OO principles if you choose to do so, but thats it.
      The issue that I have with C++ is the syntax get cluttered with symbols. ->, *, :: , >>, etc... When you are proficient at the language, they make sense, however while learning it, or having to relearn, after a period of inactivity, it isn't like riding a bike... You do forget, and have to relearn it again.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    49. Re:c++? by Anonymous Coward · · Score: 0

      the only reason Apple uses it is to intentionally make your code incompatible with other platforms.!

      This.

      C++ is cross-platorm. Obj-C isn't. That makes the "choice" very, very easy IMHO.

    50. Re:c++? by Maury+Markowitz · · Score: 1

      > Dynamic binding and loading is ugly and clunky

      I really can't agree with that. Quite the opposite, given that dynamic binding solves a very very common problem, and that the code required to do the same in a non-dynamic language is *extensive*, I have always found that compile-time bound languages are far more clunky and ugly. I thought that was a pretty common opinion among people that have used both.

      >.Errors you don't catch at compile time are errors that you have to write tests for. Y

      Sure, that's true, but of the total set of errors that compliers don't catch, the ones that are caused by dynamic binding is a tiny subset. I still get dangling objects and nulls all the time in my C# code, probably 50 to 100 times as often as I've had a binding problem in ObjC. It is a problem, sure, but it's not *the* problem.

      Quite the opposite, in fact. I would posit that nulls remain the largest problem in modern code. ObjC (and Swift) allow you to call methods on null. That means you get a null instead of a crash, which in most cases is what you want in the first place. Yet in my C# and VB.net code, I have to liberally sprinkle all sorts of checks and such. C# is better in this regard than VB, and VB is adding support for better handling in the next release because it's so bad at it, but neither comes remotely close to the way ObjC handled it, from the start.

      So, while dynamic binding may indeed result in some uncaught runtime exceptions, I'd say ObjC programs *on a whole* have far less runtime exceptions due to other design decisions.

      > In either case, the first thing you should learn is a unit testing framework for that language

      Well you've just invalidated your own point, haven't you? If the problem is runtime errors, and the solution is unit testing, then the relative paucity of dynamic binding problems is going to add maybe zero lines of code to your test suite.

    51. Re:c++? by VGPowerlord · · Score: 1

      You're confusing widening conversions with operator overloading.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    52. Re:c++? by Maury+Markowitz · · Score: 1

      > it was swiftly replaced after his demise

      Nice.

    53. Re:c++? by Anonymous Coward · · Score: 0

      Which, presumably, is the purpose of QString.

      I know that's why there's a "primitive" string class in Java and .Net. I also know that it's what OO promised years ago, then failed to deliver. And that's why so many people use Java and .Net. The simple fact is that std::string should have a Split(char) that returns an array/list/whatever of std::strings, but it doesn't.

    54. Re:c++? by Maury+Markowitz · · Score: 1

      > JavaScript is probably the mainstream language that fits closest (it's actually very close to Smalltalk).

      It's much closer to Self. IIRC it was a fork.

    55. Re:c++? by pla · · Score: 2

      Three includes! Two methods! A loop! Six lines! And he didn't call it "George" like you would have!

      ...vs pulling in a massive amount of overhead with something like Boost or QT, complete with their own huge list of dependencies... For a program that may well do nothing more than parse a CSV file.

      "What if" if needs to work on UTF-16? No, wrong question by a wide margin - What if it doesn't? Do you always use a CNC to cut a 2x4 in half, just because you have access to one? What if you have 5/4 lumber? What if you have cellular PVC? What if you have rebar? All valid questions - And all completely irrelevant if you just need to cut a 2x4 in half.

      We can all agree that building some not-strictly-required flexibility into our code generally counts as a good thing, that will frequently save us time and effort down the road. We don't need to build a tilt-a-whirl for someone that wants a tire-swing, though.

    56. Re:c++? by TheRaven64 · · Score: 1

      Not really. Self has multiple prototype chains, Smalltalk and Java have only single inheritance. Both JavaScript and Smalltalk lack any declarative mechanism for defining classes in the language and do so by manipulating objects.

      --
      I am TheRaven on Soylent News
    57. Re:c++? by Eunuchswear · · Score: 1

      No I'm not.

      i / j is operator/ (int, int)
      x / y is operator/ (real, real)

      That is the very definition of overloading.

      --
      Watch this Heartland Institute video
    58. Re:c++? by Anonymous Coward · · Score: 0

      I prefer to develop within an std namespace instead of naming it every call:
      using namespace std;

    59. Re:c++? by david_thornley · · Score: 1

      Near-compatibility with C is one big reason why C++ became popular, but I suspect it's not a big thing any more. There's a growing movement to teach C++ as its own language, sometimes referred to as modern C++. (Unfortunately, some people still start at C and then add features until (a) the course is over, and (b) they're not really near modern C++ yet.)

      As far as the symbols you complained about, only :: is C++-specific, the others (along with every symbol on my keyboard except for `, @, and $) are from C. I haven't had problems with getting away from C and C++ for a time and forgetting these, but I steadfastly refuse to learn the operator precedence table.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    60. Re:c++? by david_thornley · · Score: 1

      C++ uses encapsulation heavily, and RAII would be impossible without it. Inheritance is discouraged when unnecessary, since it's a very tightly coupled relationship. Unlike some languages that have almost everything as objects in one inheritance tree, C++ inheritance trees are normally shallow, and a lot of class definitions will have neither superclasses nor subclasses.

      C++ uses templates to do generic programming, and this is probably the most distinctive feature nowadays. The template language is screwy, but there's a lot of extremely powerful templates available in the Standard, including the container, iterator, and algorithm libraries that descend from the original STL. It isn't necessary to know how to write a template in order to benefit greatly from them.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    61. Re:c++? by Anonymous Coward · · Score: 0

      OK, sorry, I should have been more specific. *User-defined* operator overloading.

      Because when I read code, I like to know at a glance what it does.

    62. Re:c++? by Anonymous Coward · · Score: 0

      I find myself in the position of being a reluctant fan of Obj-C. I have 20+ years of programming and I will work in whatever language best fits the task at hand (including a lot of C++ and some Qt) so I'm not religious about programming languages (though I do confess a fondness for Ruby).

      I recently wrote an iOS app, and learned Obj-C to do so; I honestly expected to hate it and initially I had my gripes with the somewhat arcane syntax, but by the end I was a fan. The reason is simple: from my experience at least, there is no better language for writing a GUI product. Qt's signals and slots mechanism can lead to a debug nightmare because the code that initiates something and the code that reacts may be spread far and wide. By contrast, Obj-C's blocks (like closures in other languages) allow you to have the initiating call, and the handling code side by side most of the time. This seems like a trivial thing, but when you're writing a GUI, it turns out to be hugely advantageous.

      Still, for the OP, I'd say learn C++. If you know that well, then you can do a lot of things in a lot of environments. And if you later want to learn Obj-C, it's fairly simple to transition.

    63. Re:c++? by Anonymous Coward · · Score: 0

      Link to Github project, please? I'd like to see this less than 500 lines of code you wrote to manipulate a QImage with some pixels.

    64. Re:c++? by TopherC · · Score: 1

      But don't forget the context. It isn't "I want to write a program that splits a string on commas," but "I want to write a program that will grow in complexity." Like most programmers, I read a whole lot more code than I write. I like to read code that is expressive enough that the little things (like string splitting) are simple statements while the over-arching objectives and design issues are stated in comments. Also anything that's subtle should be commented, but not "// This splits a string. Check my work please!" Or "// Opening a TCP socket," etc.

      C++ allows you to write very clever code, which is admittedly fun to do. But it's wearisome to read that stuff because you have to both figure out what it's doing and also prove to yourself that it's correct and handles malformed data properly. Unless you're optimizing some crucial piece of code (which C++ is potentially good for), it's much better to write expressive code.

      I haven't done too much with QT, but I think it is well structured and helps you to learn to write good C++. Some will say that's an oxymoron. But I've seen what can only be judged bad C++, and know that QT could have been a whole lot worse than it is.

      Library dependencies -- that's another subject. You're going to have them one way or another. Picking your libraries well is a matter of taste and what you're long-term plans are.

    65. Re:c++? by Anonymous Coward · · Score: 0

      It is now. It certainly wasn't when I first encountered it in 2000, running on OpenStep. Back then it was clear, far cleaner than C++, and the libraries were (and are) fantastic.

      I haven't been able to uncover who made the decision at NeXT to use Objective-C, but it was evidently chosen because no other language let the team build what they wanted to build. Steve Jobs described the reasons and benefits in his "Lost Interview" with Cringely (1995):

      "We have taken another one of those brilliant original ideas at Xerox PARC that i saw in 1979, but didn't see really clearly then, called 'object-oriented technology.' and we have perfected it, and commercialized it here, and become the biggest supplier of it to the market.

      "And this object technology lets you build software ten times faster. And it's better. And so that's what we do."

    66. Re:c++? by Vyse+of+Arcadia · · Score: 1

      Any programming language can be used to write code in any style.

      I would love to see object-oriented Brainfuck.

    67. Re:c++? by Anonymous Coward · · Score: 0

      Yes, turning every simple trivial task into a monstrosity that will take far more time to write, to understand every subsequent time it's examined, more time to debug and so on is a good thing, right? You make it sound like having a non-stupid, modern string class is a monstrosity that needs 16 cores to run.

    68. Re:c++? by PhilHibbs · · Score: 1

      To be honest, using a method called "getline" in order to break up a string on commas is hardly intuitive.

    69. Re:c++? by tibit · · Score: 1

      Frankly said, I'm at this point just tired of people who can't set up their build tools to automate common tasks, and who think that code generation is some disease that has to be valiantly fought, because obviously if you call anything besides the compiler it's too complificated.

      Look, you're wasting lots of your time by not using code generators. And I do mean lots and lots. You even publicly and proudly admit to it. In any project of considerable size, you'll be using dozens of tools to produce the final executable, the documentation, etc., so you just make yourself look very silly.

      If you're whipping up something quick and dirty in Qt, you don't care about any code generators that Qt internally requires. A four liner .pro file does the job, and Qt Creator sets everything up for you anyway. For more complex projects it's your pick between qmake+make and cmake, but both are fully supported.

      Your rant sounds silly.

      --
      A successful API design takes a mixture of software design and pedagogy.
    70. Re:c++? by brambus · · Score: 1

      Dynamic binding and loading is ugly and clunky.

      So dynamic binding and loading is ugly and clunky. Remember this boys and girls...

      It's much more touchy about types and is geared toward catching as much as it can at compile time.

      And the reason for that is because it's statically bound (well, for the most part, apart from "virtual" methods). It has dick-all to do with "correctness" or whatever. It's simply because even if a subclass has its own implementation of a parent's method, it'll still call the parent method - this goes against one of the core principles of OO: polymorphism. This means that even *if* you wanted to override a method from a parent class in your subclass, unless the parent has it marked as virtual, you're SOL. In Objective-C, meanwhile, it'll work exactly as you'd expect - the child method will get called. Also don't assume that simply because Objective-C is dynamically bound that it doesn't watch your fingers. If you aren't a stupid programmer and have warnings turned on, it'll warn you of weird stuff, such as sending a message to an object of a class which is not known to have it declared. I've written a fair amount of Objective-C code and only encountered sending an incorrect message to an object a few times. Now allocation-related stuff, that's the killer! But it's the same in both languages (in fact, one could argue that ObjC is a bit better, as it at least gives you a ref-count garbage collector, whereas in C++ you're on your own).

      [C++ is] big and clunky, has a lot of rules to memorize and its error messages are hideous.

      And so now C++ is the clunky one? TBH, it really comes down to personal preference. I like dynamically bound languages, because it fits my style of thinking. If you're writing complex interactions between objects, it cuts down on the amount of code needed to write quite a bit and if you follow the suggestions of the compiler, you're very unlikely to shoot yourself in the foot. OTOH, I understand that if you're after 100% valid programs where static analysis gives you a lot of confidence ahead of time, then C++ is probably the way to go (although I'd prefer C in that case). It's really about style and personal preference. Neither is more or less clunky, it depends on what you want to do with and how you want to do it.

    71. Re: c++? by Anonymous Coward · · Score: 0

      Good, if you guys are writing code like that then you saved me tons of headaches.

    72. Re:c++? by pla · · Score: 1

      You make it sound like having a non-stupid, modern string class is a monstrosity that needs 16 cores to run.

      You can split a string in any language. If you want to write in C++, write in C++. If you want to write in VB.Net, write in VB.Net.

      C++ doesn't need to look like VB.Net just because you don't like the syntax.

    73. Re: c++? by Anonymous Coward · · Score: 0

      i would love to see any style of programming in BrainFuck. its one big troll.

    74. Re:c++? by Anonymous Coward · · Score: 0

      That is similar to Java:

      String[] tokens = argv[1].split(",");

      Java's String class has split() along with a lot of other helpful methods built in. split(), has been available since Java 1.4 (2002).

      Granted, anyone can implement their own split() -- if they had too, but having libraries of these utilities is what separates programming languages these days.

    75. Re:c++? by Anonymous Coward · · Score: 0

      > It's not FUD

      It is FUD for the claim that the reason why Apple picked Obj-C is to make your code non-portable. The simple reality is that 1) it came with the NeXT purchase, 2) it's a good mature framework, and 3) it would have taken many more years to port the OS to another language if they had not gone with Obj-C.

    76. Re:c++? by ChrisMaple · · Score: 1

      If you like C, you can use just a few features of C++ when it's to your advantage. For instance, let's say you had to do a lot of math on 24 bit integers. In C, you'd have to do
      c = add24(a,b);
      In C++, you could write a 24 bit integer class, override the + operator, and get a much more readable
      c = a + b;

      Infrequent use of C++ features sometimes helps a great deal.

      --
      Contribute to civilization: ari.aynrand.org/donate
    77. Re:c++? by angel'o'sphere · · Score: 1

      Care to explain why C++ does not fulfill "Alan Kay's definition of OO"?
      It has classes, but method dispatch is tied to the class hierarchy ... I doubt Alan Kay made any statement about that. ... so if you want to really adopt an OO style you need to use multiple inheritance and pure abstract base classes,
      This is complete nonsense as it has no influence on method dispatch.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    78. Re:c++? by cheesybagel · · Score: 1

      The 'much more readable C++' also hides the fact that you might be doing an expensive function call in that '+' operation. It obfuscates code. Java also does not have operator overloading and I never felt that it hindered me in any way. In the past I did write a lot of thick OO C++ code but now I always avoid it like the plague. The closest to C the code is the more readable (as in understandable) and maintainable it is.

    79. Re:c++? by Dutch+Gun · · Score: 1

      It has dick-all to do with "correctness" or whatever. It's simply because even if a subclass has its own implementation of a parent's method, it'll still call the parent method - this goes against one of the core principles of OO: polymorphism. This means that even *if* you wanted to override a method from a parent class in your subclass, unless the parent has it marked as virtual, you're SOL.

      If you read about Stroustrup's design intentions, he absolutely believed that strong type safety was an important part of making programs safer and less bug-prone. Obviously, the creators of Objective-C (and many other languages) chose to follow a different design philosophy. It's probably not helpful to get into a debate about which one is "correct", as that's obviously going to be pretty subjective.

      As far as the example you give, this is because C++ always adheres to the "zero-cost principle", meaning that the language designers don't believe C++ developers should pay for features they're not using. Virtual functions are more expensive to call than non-virtual, and you can't always determine at compile time whether one will be called or not, so it's left to the programmer to tag the function. It has nothing to do with "going against the core principles of OO". It just means C++ will happily let you shoot your own foot by ignoring the language rules it requires the programmer to adhere to.

      This is why people consider it one of the more difficult languages to master. It's a powerful tool, but has many sharp edges. For programmers like me who value C++ primarily for it's runtime efficiency, this is absolutely the correct design decision. There are plenty of better languages to use if your primary goal is programmer efficiency.

      BTW, you're a bit out of date regarding C++ and allocation. Modern C++ now has several built-in smart pointers (including ref-counted versions) which makes modern C++ feel a lot closer to C# with it's garbage collection than to C-style manual memory management.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    80. Re:c++? by Anonymous Coward · · Score: 0

      Nobody is talking about VB.NET

      If you think this is intuitive, concise or whatever, then clearly C++ is the only language you know!

    81. Re:c++? by Anonymous Coward · · Score: 0

      You might want to learn about 20 more languages that don't look like VB.Net before you go throwing out complete nonsense like that.

      Free hint: For every language that contains an explicit "split" method, I can find you 20 that don't.

    82. Re:c++? by brambus · · Score: 1

      As far as the example you give, this is because C++ always adheres to the "zero-cost principle"

      Also describable as the "zero-flexibility principle". In Objective-C extending existing code is super trivial. In C++, unless the author of your library *expected* what you're about to do, you're pretty much SOL. For example implementing a native RPC mechanism in Objective-C is about as complicated as implementing -forwardInvocation: and ferrying the serialized NSInvocation object between sockets. In C++, it just can't be done (well, unless you're willing to write some sort of custom VM!). Also, in practice, the overhead of Objective-C's dynamism is pretty much negligible (speaking from experience having written some pretty heavily real-time code for video streaming in Objective-C that's running the server-facing portion of a few dozen thousand STBs in the field right now). 90% of the time you're running 10% of your code. Write that portion in highly optimized pure C and the rest in objects and you'll get the best of both worlds.

      For programmers like me who value C++ primarily for it's runtime efficiency, this is absolutely the correct design decision.

      TBH, I've never seen the logic of this statement. Given that most code written in pretty much any app is just high-level scaffolding around a few really core high-perf algorithms, why try and shoehorn the same language into these two completely different usage scenarios. That's IMO asinine and C++'s extreme levels of complexity and sheer volume of features is a testament to that fact.

      BTW, you're a bit out of date regarding C++ and allocation. Modern C++ now has several built-in smart pointers (including ref-counted versions) which makes modern C++ feel a lot closer to C# with it's garbage collection than to C-style manual memory management.

      I stopped paying attention to C++ by the time the spec document collapsed under its own gravity to form a black hole.

    83. Re:c++? by Anonymous Coward · · Score: 0

      Ouch. I actually like C++ but defending the code you wrote there just makes me cringe. Most of the standard C++ library is excellent, but I completely avoid iostreams. I don't know of anyone who would write it that way either. I'd have used boost or written my own split template function. A proper template function would be better than that iostream abomination, and would be better than a split member function on string. People unfamiliar with generic programming might prefer the member function, but the generic way is more generic. :)

    84. Re:c++? by Anonymous Coward · · Score: 0

      Actually that leaves open the possibility that the Objective C faithful continue to develop it in a new direction... probably with Linux as the main target platform.

    85. Re:c++? by cthulhu11 · · Score: 1

      NeXT actually poached the lead Objective-C developer in the 1988-1989 timeframe. Is C++ these days legitimately OO? Back then it wasn't. Objective-C on the other hand has the Brad Cox stigma.

    86. Re:c++? by lsatenstein · · Score: 1

      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.

      I concur, C++ is the way to go. Once you know C++ you will quickly adapt to other OO languages. (I started with Python3)

      --
      Leslie Satenstein Montreal Quebec Canada
    87. Re:c++? by vilanye · · Score: 1

      Mandatory?

      I guess you never heard of Swift?

    88. Re:c++? by JoeMerchant · · Score: 1

      You can program your Mac with Scratch, if that's what you are into.

    89. Re:c++? by Anonymous Coward · · Score: 0

      C++ is cross-platorm. Obj-C isn't.

      Except that Objective-C is cross platform. But Cocoa isn't-- maybe that's what you meant?

    90. Re:c++? by Anonymous Coward · · Score: 0

      That is a lot of boilerplate bullshit.

      gets.split(',').each {|ch| puts ch}

      Why does it have to be so fucking complex in bullshit languages?

    91. Re:c++? by Anonymous Coward · · Score: 0

      Operator overloading that the user can't define is worthless.

      Look at Java, you get bullshit like add(), sub(), etc or worse: multiplyWithAnotherMyMatrix(MyMatrix mm)

      I have seen shit like that.

      mat1 * mat2 much simpler and easier to read

    92. Re:c++? by Anonymous Coward · · Score: 0

      If all you are doing is parsing a CSV file why in the hell are you using C++?

      That is pounding in a nail with a nuke.

    93. Re:c++? by Anonymous Coward · · Score: 0

      Actually, I'd be okay with it if user-overloaded operators were marked syntactically somehow.

      Maybe something like "mat1 [*] mat2" so I don't have to guess whether it's overloaded or not.

  2. C++ is the only logically option by ameoba · · Score: 5, Informative

    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.
    1. Re:C++ is the only logically option by antifoidulus · · Score: 3, Insightful

      Which is actually kind of sad, as an object oriented superset of C Objective-C is much much better than C++(for starters it's an actual superset of C, unlike C++). However it never gained any traction outside of the Apple ecosystem.

    2. Re:C++ is the only logically option by Anonymous Coward · · Score: 2, Informative

      Apple's statements in support of Swift make it sound like it's Apple's intention for Objective-C to be a dead language in their eco-system as well.

    3. Re:C++ is the only logically option by Pseudonym · · Score: 0

      I think it's the exact opposite. Apart from their obvious use as a fake module system, objects are by far the least useful part of C++ (and Objective-C).

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    4. Re:C++ is the only logically option by Pseudonym · · Score: 1

      I knew that would get voted down. Let's just say I'm in good company.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    5. Re:C++ is the only logically option by Anonymous Coward · · Score: 1

      Given structs and function pointers, one can accomplish anything that would be accomplished with classes, interfaces, and inheritance. So, it is true that one does not need these things.

      The purpose of objects, interfaces, and inheritance is not to do something that couldn't be done before, but rather, to provide useful code organization and visualization so as to minimize developer time and effort. Anyone can get this wrong, of course, but that isn't the fault of the system itself. But where it cannot be gotten right, a simpler approach should be used instead.

    6. Re:C++ is the only logically option by Pseudonym · · Score: 1

      The purpose of objects, interfaces, and inheritance is not to do something that couldn't be done before, but rather, to provide useful code organization and visualization so as to minimize developer time and effort.

      That's the theory, anyway.

      Believe me, I'm a fan of advanced type systems. Interfaces, and IS-A subtyping are useful and important. However, implementation inheritance (as Simula and its descendants understand it) is a broken concept. This is one of the reasons why even OO people alway say to prefer composition over inheritance.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    7. Re:C++ is the only logically option by Anonymous Coward · · Score: 0

      Given structs and function pointers, one can accomplish anything that would be accomplished with classes, interfaces, and inheritance. So, it is true that one does not need these things.

      Out of curiosity, how do you do interfaces in structs?
      Say that you have two different structs that both inherits from different base structs. To be able to inherit from a struct the base struct will have to be placed first in the child struct right?
      Now, if the two child structures both implements a common interface and the two base structs have different sizes, how do you find the functions of that interface?
      I figure this might be an interesting question for people who only deal with OO languages too since it isn't as obvious what kind of overhead you get by using different language features.

    8. Re:C++ is the only logically option by tgv · · Score: 1

      Sorry, but STL is not a good example of C++'s superiority. It's bloated and unreadable due to C++'s template syntax. I still prefer my homegrown lib for lists and trees and such, but when I have to choose some publicly available software, I pick Boost over STL.

      For the rest: Objective-C is not a great language. It has some cute features, but they are primarily useful for GUI programming and don't really contribute to better software development.

    9. Re:C++ is the only logically option by Anonymous Coward · · Score: 0

      The implementation of STL may be bloated, but its use is very simple. Especially with std algorithms, which uses type deduction, so you don't have to use any angle brackets at all.

    10. Re:C++ is the only logically option by countach · · Score: 1

      Errm, what does Objective-C have OTHER than an object system? That's all there is in the Objective part of Objective-C.

    11. Re:C++ is the only logically option by countach · · Score: 1

      That's a little bit prejudiced. There's absolutely nothing wrong with using Objective-C for general purpose programming. Whether it has enough to offer to make it one's first choice is another thing, but its perfectly serviceable, and in so far as being object oriented, is a decent platform for object development.

    12. Re:C++ is the only logically option by countach · · Score: 1

      As someone who did some programming in Sather, which explicitly split up interface and implementation inheritance, I don't know how you justify the claim that implementation inheritance is "a broken concept".

    13. Re:C++ is the only logically option by tgv · · Score: 1

      Prejudiced, why? I did do my share of Objective-C programming (some 50k lines by the last count), but it has little to offer over C for tasks other than GUI programming. I think that e.g. C# is a better general purpose language.

    14. Re:C++ is the only logically option by Maury+Markowitz · · Score: 1

      > but it has little to offer over C for tasks other than GUI programming

      That strikes me as similar to saying a Porsche has little to offer other than performance and fun. That statement is demonstrably true, but appears to be missing the point. Is it the case that only some programming is GUI-based? Yes. Is it true that almost every program ends up with a GUI? Also yes. Lets not ignore the forest for the trees.

      But more directly, I disagree with the statement at its core. ObjC, and other languages like it, offers several features that make *very* common tasks *dramatically* simpler:

      1) Late-bound methods. In ObjC you can send any message to any object at any time. That includes dangling pointers or null. What that means is that if you do this...

      String x = LoadStringFromFile("a file that doesn't exist")
      x.printToDebug

      the code runs fine. The answer to any method passed to null is null, which is precisely what you actually want. Why is this useful? Because it eliminates the 10% of the code you write, the code that checks every step of a method like this for any nulls...

      someObjectWithFields.aMethodThatReturnsAField.whichIsAnotherObjectWithAField.trim.printToDebug

      The correct answer for this method is null in the case that anything in it is null. ObjC does that (from now on, I'm using "ObjC" to refer to other languages with similar features, the Smalltalk family). Sure, you *can* put in all the IFs if you feel that you really need to know if Another is null and not AField, but in 99% of the cases I've seen, that's not what you actually need.

      This eliminates many, many lines of code from your project, which makes the resulting code smaller and far easier to read.

      2) Data models. In conventional languages you can't load an object in a generic class and then have it assume the qualities of your model. Let me give you a recent example from my own code. I have a library that can read and write XLSX files, turning them into Rows, Columns and Items (item is the actual value). My program has Accounts, Contracts and Addresses, which are collections of code. In order to turn the Rows into, say, and Account, I have to roll over the rows and create parallel objects that point back to the Row. It's a complete mess. In comparison, in ObjC (from now on, that's a generic term) I can swizzle the object after it is loaded and that Row magically turns into an Account.

      If you don't understand the power of this concept I think you need to look at some actual examples of DB programming under Apple's late, lamented EOF. It is, bar none, the simplest and cleanest object modelling platform I've seen. I understand examples of similar simplicity and cleanliness exist on other dynamic platforms, but I've tried them all on Java, C++ and .net, and I can say from experience that nothing comes *remotely* close. And I say this as someone that's written hundreds of thousands of lines of DB code.

      3) Zombies. This is really just a subset of swizzling applied to a real-world problem. You can flick a switch so that when ObjC releases an object it doesn't, it instead swizzles it into a Zombie. Recall (1)... this means that instead of your program crashing, it calls that method on the Zombie. Zombies have one method that gets all calls, and it prints out useful debugging information.

      Yes, you can do this in other languages, and some even do it. But again, as in (2), ObjC's *implementation* of this is trivially simple and easy to use.

      4) Method signatures are strings. I think this is what you're touching on when you say "good for GUI" but you don't specify. The advantage here is that I can save method calls in files. This has all sorts of interesting side effects. One simple one is that I can bind a button to a method directly... unlike (say) .net, where the button calls a generic method that calls code the development environment writes to call your method. And lets be honest, VS isn't exactly perfect, even when you can read it.

      But t

    15. Re:C++ is the only logically option by serviscope_minor · · Score: 1

      I still prefer my homegrown lib for lists and trees and such

      Uh so how is your library less "bloated" and more readable than the STL?

      ut when I have to choose some publicly available software, I pick Boost over STL

      So how on earth do you square that with boost mostly being a proving ground for the standard library?

      --
      SJW n. One who posts facts.
    16. Re: C++ is the only logically option by Anonymous Coward · · Score: 0

      great fucking post. please mod up +5

    17. Re:C++ is the only logically option by Pseudonym · · Score: 1

      Yeah, I didn't word that well. What I meant is, C++ is better than Objective-C because it isn't an OO superset of C.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    18. Re:C++ is the only logically option by Pseudonym · · Score: 1

      It's bloated and unreadable due to C++'s template syntax.

      I'm with you on the syntax issue. The greatest weakness of C++ is also its greatest strength: it retains something very close to backwards-compatibility with C. That inevitably means that all the good syntax is taken.

      However, "bloated" is a puzzling claim. The whole point of the STL is that you can do things like type "sort" and it chooses the best sort algorithm for the data structure (e.g. merge sort for lists, quick/heap sort for vectors) automatically at compile time. Or you can create an array of 1000 elements, and it will initialise it with object construction or memset depending on the type, and this is all handled for you automatically at compile-time. You do not pay a cost to do this at run-time.

      Your homegrown lib can't do that.

      [...] but when I have to choose some publicly available software, I pick Boost over STL.

      Boost and the STL don't compete. In fact, most of Boost (e.g. Algorithm, Array, Circular Buffer, Container and of course Iterator, among many others) are designed with STL in mind.

      For the rest: Objective-C is not a great language. It has some cute features, but they are primarily useful for GUI programming and don't really contribute to better software development.

      I've said some slightly uncomplimentary things about Objective-C in this thread, but I do have to admit that it's one of the best compromises between "dynamic"/scripty languages and "static"/low-level languages that has yet been developed.

      It's just a shame that it's also based on Simula's broken object model.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    19. Re:C++ is the only logically option by Pseudonym · · Score: 1

      Sather (and Eiffel and Smalltalk etc) are less broken than Simula, I'll grant you that.

      I do come at this from the point of view both as an engineer working in the high-performance computing area, and as a programming language theorist. People like Stepanov, Knuth, Dijkstra, Luca Cardelli, Alan Kay, Benjamin Pierce, and many others have written and spoken (sometimes at length) on the problems with implementation inheritance. And the fact that most OO proponents consistently tell you to avoid it ("prefer composition over inheritance") is telling.

      However, I would say that the claim of "broken concept" is based not on one single argument, but on independent converging lines of evidence.

      Here's another one, which again is not convincing by itself, but adds to the picture: the Curry-Howard isomorphism. One of the signs that you know you've found something interesting is that it turns out to be formally equivalent to something else that's interesting. (Think of the isomorphism between regular languages and DFAs, for example.)

      Programming language theorists have found many such isomorphisms over the last few decades, and what's interesting is that programming language features seem to be equivalent to interesting objects in logic and category theory. For example, Scheme-style continuations are actually Pierce's Law in logic. Call-by-value and call-by-name turn out to be dual in the programming language which is isomorphic to Gentzen's classical sequent calculus.

      Subtype relationships are pretty well-understood, and interface inheritance has a straightforward interpretation (e.g. see Haskell's typeclasses). However, despite searching for decades, nobody has found any such connections with implementation inheritance.

      The industry desperately needs the style of OO that everyone uses to be on a sound theoretical footing, because it makes program analysis and compilers better. Lots of smart people have tried. The fact that we haven't found it by now strongly suggests that it's not theoretically sound.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  3. Re: Classic? by Anonymous Coward · · Score: 1

    Yeah! Learn something new and make new mistakes!

  4. 20 years ? by Anonymous Coward · · Score: 1

    If you take 20 years to pick up a new programming language, maybe programming isn't for you.

    1. Re:20 years ? by Anonymous Coward · · Score: 0

      If you take 20 years to pick up a new programming language, maybe programming isn't for you.

      Another theory is that the person skipped all obvious fads and kept to a single ecosystem.
      If you aren't interested in web programming you will probably skip javascript and php. If you aren't customizing your Linux installation you have probably skipped perl and python too.
      Perhaps the programmer picked up Rexx once upon a time and got burned on the waste of time that was. If you picked up C once upon a time you have seen a lot of programming languages come and go, and mostly just left a lot of unmaintainable code after themselves.
      Sure, it was easy to throw together VB6 stuff to solve small problems back in the days, but to you really want to have to maintain VB6 code today?
      What about every other language that is hyped now? C#? Is that something you want to have to support.
      Do you want to have a system that is stuck on Cobol forever?

  5. Java by buchner.johannes · · Score: 3, Funny

    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.
    1. Re:Java by Anonymous Coward · · Score: 0

      +1 for Java

    2. Re:Java by BarbaraHudson · · Score: 2

      Actually not bad advice, if the poster wants to get into OOP.

      Objective-C is the obvious choice if you also want to make money developing for Mac OS X

      With Apple switching to swift, you'll be learning an orphan language. Best bet is to learn c, then c++. This way you get the basics first.

      However, if you think you're going to make money developing for OSX starting from zero, seriously, what universe do you think you're in?

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    3. Re:Java by bobbied · · Score: 2, Insightful

      I don't expect any contrary opinions here on /.

      (Oh you ARE sarcastic....)

      Java is not the Swiss Army knife of programming languages... There are things it just isn't well suited for... But generally, not a bad choice for most run of the mill projects where performance and foot print don't really matter. However, if you are on limited hardware or have tight response time constraints, Java is not for you (but you hardware and embedded guys know this already.)

      --
      "File to fit, pound to insert, paint to match" - Aircraft Maintenance 101
    4. Re:Java by rwa2 · · Score: 1

      I would put down Java as a good language for learning how to do OOP stuff in the most verbose way possible. But at least it works as documented, and is well-documented. I find myself spending less time fighting the compiler and obscure memory allocation problems, and more time fighting the shear volume of code. That isn't necessarily a bad thing.

      Otherwise, I think I'd have more fun doing something in Python, with some modules implemented in C++ to optimize the performance-critical parts.

    5. Re:Java by Anonymous Coward · · Score: 0

      Learning C is overrated, there is nothing you can do in C that you cannot do in C++ because C++ is a superset of C and most of the things that you do 'the C way' are antiquated and not relevant anymore, those few that are can be learned when you're learning C++.

      The old argument is that you're worried about knowing the underlying functionality of C++ constructs implemented in C but that is rarely even necessary, following that you also would need to be learning how the particular compiler you are using implements things like move semantics or atomics or return value optimization for a particular architecture target, you should be learning assembly language too.

    6. Re:Java by Anonymous Coward · · Score: 0

      He wanted a compiled language. Are you recommending gcj?

    7. Re:Java by Anonymous Coward · · Score: 1

      Actually, I don't think you know what a Swiss Army Knife is good for. I've owned half-a-dozen, so let me tell you.

      The early knives were a dream. Just a few blades, and typically a set of scissors. One blade had the makings for cleaning and grooming nails.

      The current monstrosities are a joke. Handles so wide you really can't use them effectively, but there's a blade / insert for everything.

      In this sense, Java fits the bill. There is at least one library for everything, and sometimes ten or twelve. The performance of the JVM is better than any other non-compiled language (and better than a few compiled ones), with the possible exception of C++ (in some senarios) or C. If you really want to get into performance tuning, one of the fastest minimum latency processing frameworks is in Java. Block oriented I/O without the dual copy problem is available. Infiniband communication channels are available via Java APIs (but that hardware is still quite expensive). That said, the slow stuff is available too (and in droves). If you don't know what you're selecting, odds are you will code yourself into a non-performant corner.

      As far as limited hardware, Java has had literally a decade in the small spaces with Java ME, and for slower but real time environments, there are real time JVMs.

      So, in short, while there are still a few places where it makes absolutely no sense to use Java, and there are a few environments where Java doesn't fit the bill, nearly every one of your provided examples are poorly thought out, and supported with fallacies.

    8. Re:Java by narcc · · Score: 1

      ... There are things it just isn't well suited for...

      Like writing computer programs?

    9. Re:Java by BarbaraHudson · · Score: 1

      Java has a similar syntax to c/c++. And it provides an easier way to get started without shooting yourself in the foot too often. This way, with less frustration and time wasted on the details, he can learn both in just a bit more time than just c++.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    10. Re:Java by Anonymous Coward · · Score: 0

      Java development is very similar to a compiled language because it needs to be compiled to byte code before being run by the virtual machine. You get the same sort of compile-time errors and warnings as with C++.

        But a subtle point is that the virtual machine then just-in-time compiles the byte code to machine code. What this means is that the start up time for Java programs is abysmal but that once Java programs are up and running the performance is very close to C and C++. Java is a terrible choice for little programs that need to be called lots of times from the command line (e.g. a Perl script repeatedly calling little utility programs).

      But Java has garbage collection built into the core of the language so a Java program can trivially utilize certain memory management techniques that are cumbersome in plain C. That mean that a quickly hacked together Java program can often be faster than a quickly hacked together C program because the C program will end up using memory management techniques that are much cruder - for example, a C program might pass around even relatively large structs between functions to avoid a complex maze of malloc and free calls whereas Java would always be passing pointer. Also, the memory garbage collection typically runs in parallel so, in a certain sense, it's a poor man's parallelism. Often I'll quickly hack together a little Java program that does all it's computations on a single thread to keep things simple but then when I run it I see that it's using multiple cores worth of processing power on my workstation (which would otherwise be sitting idle).

      And that gets to one of the main things I like about Java for my routine scientific computations. Usually correctness is orders of magnitude more important than speed for scientific calculations - not so much in the sense of numerical accuracy, per se, but in the sense of avoiding serious bugs that affect the results in a non-trivial way. And a large class of memory errors are impossible in Java - i.e. the Java program crashes with a null pointer exception rather than overwriting a random memory location - that gives an interesting but incorrect result that gets published before being noticed and must then be publicly retracted.

    11. Re:Java by Greyfox · · Score: 1
      No destructors just kills java for me. Yes, I know you have things kind of like destructors that can run at GC time but they're not guaranteed to. That means I have to rely on the programmer to remember to call close before his object goes out of scope, and he's not going to be able to in all cases. That in turn means he's going to be leaking resources. Which seems to be why a lot of the production MQ servers I've seen pretty much HAVE to be rebooted every three days.

      Some time ago I was working for a company that was using Jmeter for functional testing. Don't ask me why, but it seemed to be pretty effective for them. At some point they added an SSH sampler into the mix for it. This worked just fine when you were developing the test and running it from the GUI, but when we ran the test from the command line, it would hang when it should have exited. I went digging around in the ssh sampler code and found that he was closing his ssh connection in what passes for a destructor in Java. This was getting called when the GUI exited, but not from the command line. So the ssh connection would remain open and java would sit there not doing anything, so no GC event could ever take place. Essentially a deadlock with exit waiting ssh to close and that waiting on a GC to happen.

      I fixed it by moving the ssh close connection to somewhere else, but it was still rather awkward and would prevent the ssh connection from being reused. You'd have to create a brand new one each time you wanted to use one.

      Java seems to encourage this sloppy mentality that you don't have to worry about any resources because the language is garbage collected. If you're going to program in it correctly, it requires as much discipline as C++, and at least as much unit testing. I've met very few java programmers who have either.

      --

      I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    12. Re: Java by Anonymous Coward · · Score: 1

      Java is not an answer. The whole JRE means installing an unsafe browser plugin for most people. Oh, and would you like to improve your websperience with ASK.com? Oracle has poisoned it, at least be decent enough to give Java a nice burial.

    13. Re:Java by Anonymous Coward · · Score: 0

      >>> Best bet is to learn c, then c++

      NOooooo! I've seen too much crappy pseudo-C++ code written by C programmers.

      Please learn OO fundamentals and then learn C++. Absolutely no need for learning C first. And for the love of God, please do NOT use raw pointers.

    14. Re:Java by pspahn · · Score: 1

      ...

      Java!

      --
      Someone flopped a steamer in the gene pool.
    15. Re:Java by wheelbarrio · · Score: 1

      Java 7 introduced the Closeable interface and try-with-resources statement to give the programmer every incentive to Do The Right Thing in cases like these, and every good Java programmer I know uses them (see http://mina.apache.org/sshd-pr... for topical example of an SSH client implementing Closeable). True, anyone can code badly but that's not the language's fault and in this case I would hardly say that sloppy mentality is encouraged. A poster above noted that C++98 != C++14. By the same token, Java 1.8 != Java 1.2

    16. Re:Java by countach · · Score: 1

      You've probably got more chance in OS-X than most anything else. What do you advocate, CICS mainframe?

    17. Re:Java by countach · · Score: 1

      Errm, I probably would say Java IS the Swiss army knife of programming languages. Jack of all trades, but master of none. Java might not give you the best result, but it will probably give you less aggravation getting there than most anything else, simply because it is easy to get working and running everywhere, there are a ton of libraries existing, and the compile and link model is simply easier to work with.

    18. Re:Java by countach · · Score: 1

      Yes, as has been pointed out, Java since V7 now has try with resources to auto-close stuff. It's not like you can be totally oblivious in C++ either, you can easily lose resources too if you're pathologically stupid.

    19. Re:Java by countach · · Score: 1

      I might add that well designed programs don't generally open and close resources in lots of places in the code. They will abstract that out and have it done in only a few places.

    20. Re:Java by Anonymous Coward · · Score: 0

      If you want to learn an over-verbose language, not completely object oriented with horrible GUI on a dying platform, indeed, Java is a great choice.

    21. Re: Java by drinkypoo · · Score: 1

      Java is not an answer. The whole JRE means installing an unsafe browser plugin for most people.

      Can be disabled

      Oh, and would you like to improve your websperience with ASK.com?

      Are you new? Download the enterprise installer. It doesn't ask you to install ask.com (or any other bundled bullshit) on install or update.

      Don't use Java because it's a dead end, and at that end, lies Oracle. Not because it doesn't work, or because of ask.com

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    22. Re:Java by Anonymous Coward · · Score: 0

      JavaScript runs Linux.
      What could possibly go wrong?

    23. Re:Java by BarbaraHudson · · Score: 1

      "And for the love of God, please do NOT use raw pointers."

      Raw pointers are great. I have never, and will never, use a so-called "smart pointer." It's easier to just keep track of who owns what. And TR1 sucks. So does template meta programming. Ditto for the "Gang of Four."

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    24. Re:Java by BasilBrush · · Score: 1

      With Apple switching to swift, you'll be learning an orphan language. Best bet is to learn c, then c++. This way you get the basics first.

      If someone was planning on learning a language as a stepping stone to Swift, c or c++ would be a bad choice, leading to developing bad habits that will cause frustration when moving to Swift. As I understand it they'd be best learning a functional language, after which they'll approach problems in a way which fits very well with Swift's world view.

      I can't recommend the particular functional language, as I DID come up the procedural/oo path.

      However, if you think you're going to make money developing for OSX starting from zero, seriously, what universe do you think you're in?

      As an indie, perhaps. But salaries are good in OSX/iOS programming.

    25. Re:Java by BarbaraHudson · · Score: 1

      What do I advocate? That the poster forget it. The poster has pretty much NO chance. There's already an over-supply of programmers, and not enough demand. If they've been futzing around since the early '90s (that's more than two decades) and haven't yet touched c, c++, or even java, they are already so far behind the curve and so close to 50 that by the time they get up to speed, they'll be unhireable.

      Especially since there's a bunch of hungry millennials who can already eat the poster's lunch.

      Unfortunately, this is ultimately just another "I want to change my field of expertise - how do I do it?" There is no short-cut, and in this industry 40 is the new 60.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    26. Re:Java by Greyfox · · Score: 1

      That's handy. Maybe all those MQ servers I've had to deal with in the past will finally stop having to be rebooted every 3 days, if anyone ever gets around to updating them. I've been firmly in the C++ world the past couple of years and have kind of stopped looking at Java since Oracle started being such a dick about the language. If I pick up a java contract in the future, I'll have to familiarize myself with the new features.

      --

      I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    27. Re:Java by BarbaraHudson · · Score: 1

      Consider that in the last 30 years, the only two periods when c wasn't #1 was when c++ demoted it to #2 (1995) and java demoted it to #2 (2010).

      As for the horrible gui, neither c, c++, nor objective c has a native gui (cocoa is just a library).

      Is java dying? At #2, I think not.

      Now, I much prefer c to java - java is over-verbose - but there are ways around that as well.

      And there's the fact that Minecraft was developed in Java and it was sold for $2.5 billion. There's still big money in using the #2 language.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    28. Re:Java by BarbaraHudson · · Score: 1

      Perhaps you missed the fact that the OP has been "toying around" with the idea "since the early '90s." That's almost 25 years. Gotta be getting close to 50, if not more. Given a couple of years to get up to speed, they'll still be unhireable because there are plenty of people half that age who already more experienced.

      Would you hire someone like that - someone who has been sitting on the fence for a quarter-century before even trying to learn it? Back in that period, Turbo C 2.0 was $100. Chicken feed in comparison to pretty much anything else, and certainly well worth it when a decent 286 PC was several thousand dollars.

      Free c / c++ compilers have been around since before the turn of the century as well. And you could just by a linux magazine complete with a distro and compiler toolchain in 2000 for $10.00 or so - no need to download anything on the slow connections of those days. There's no excuse for taking so long to decide to act.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    29. Re:Java by david_thornley · · Score: 1

      In fact, it gets difficult to know who owns what with raw pointers, particularly when they point to data structures that are referenced by more than one function at a time. In modern C++, std::shared_ptr signifies shared ownership, and the object won't be deleted until everybody's through with it (and, yes, you can get cyclical structures that leak memory that way). std::unique_ptr signifies sole ownership, and a raw pointer is a non-owning pointer. That way, a glance at the pointer declaration shows ownership.

      Doing template metaprogramming sucks, since the template language, while Turing-complete, is a really awkward functional language. Using templates can be great.

      I'm not arguing about the Gang of Four, though.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    30. Re:Java by serviscope_minor · · Score: 1

      Well, I've got one from about 16 years ago but I'm pretty sure they still make them.

      It has a large knife, a small knife, a corkscrew, a hook, some scissors, a small flathead blade/can opener combo and a larger flathead screwdrive/can opener combo an awl, a toothpick and some tweezers.

      The handle is a good width and I've used all of the tools repeatedly. The main disadvantage is th blade is quite soft and so it's now worn down from multiple re-sharpenings.

      --
      SJW n. One who posts facts.
    31. Re:Java by BarbaraHudson · · Score: 1

      If you're the programmer, you should make the decision of who owns the pointer on the basis of performance and utility. This is one of the basics that you have to learn good habits around, that's all.

      It's any variable naming conventions and comments that should relay the semantic information of use, ownership, and what happens when free() is invoked.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    32. Re:Java by david_thornley · · Score: 1

      Okay, you make the decision that this thing owns the pointer, but that thing has a copy of it. We know that this thing and not that thing is responsible for destructing what's at the end of the pointer, but when should it do it? Instead of figuring that out, it's easier just to use std::shared_ptr.

      Variable naming conventions can get difficult, particularly since the variable has to be named different things in different contexts, and comments can easily become wrong when they deal with such low-level issues. std::unique_ptr tells you immediately that this is the pointer owner.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    33. Re:Java by BarbaraHudson · · Score: 1

      It's not that hard. When another object is given ownership of the pointer, set a flag in your object to say so, so that you don't try to free it in the destructor.

      Ditto if you have only a copy of the pointer - set the flag to say that it is only a copy.

      All it takes is one bit. No need for reference counting, worrying about circular references, etc.

      Another way is to only allow the object that creates the pointer to own the pointer, and other objects can only modify the data through access methods in the owning object. As long as the objects that own the data are destroyed after all the other objects, there's no chance of trying to access a non-existent pointer.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    34. Re:Java by Anonymous Coward · · Score: 0

      My experience is:

      - Java requires way less discipline because it makes errors easier to find (e.g. stack traces).
      - The kind of rare, hard-to-diagnose errors you describe in Java are a daily occurrence in C++. (You'll never have stack corruption in Java.)

    35. Re:Java by david_thornley · · Score: 1

      What that reads to me is that you've come up with a more clumsy implementation of std::unique_ptr, in which you have to maintain flags in every object that uses the pointer, set and reset them properly and consistently, and remember to write the conditional delete in every class that might use the pointer. I really, really don't see any advantage in your method over std::unique_ptr.

      It doesn't address shared ownership at all, but requires the owning object to destruct after all using objects have been destructed, It seems to me that, if you have some sort of mechanism to make sure all users have destructed before the owning object does, you may as well use std::shared_ptr, and if you don't have such a mechanism you're making your program subject to memory faults if the path of execution changes. or else you're doing most of your dynamic memory locations up front and having them last throughout most of the program.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    36. Re:Java by BarbaraHudson · · Score: 1
      I noticed you didn't say anything about the second method, which I've used before I started doing this: just keeping track of what your code is doing so you don't have dangling pointers. Unfortunately, most people are too lazy to keep track of their allocations and frees and who owns what.

      It's not rocket science, and the last way is the best way in c. It also runs faster using less memory. The path(s) of execution should be well known - if they aren't, your code is bad - after all, programs are deterministic. Even threaded or interrupt-driven programs.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    37. Re:Java by david_thornley · · Score: 1

      The paths of execution can be hard to determine. Deterministic does not mean easy to figure out.

      It is entirely possible that different reasonable paths of execution will result in a different natural order of freeing objects. In that case, you can try to set things up so you can prove an order of destructing, or you can keep track of who's using the memory to see when it can be deleted, and if you're doing the latter you'll find it easier and more convenient to use std::shared_ptr.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    38. Re:Java by BarbaraHudson · · Score: 1

      Funny how I never had that problem when writing multi-threaded programs in c or c++. Oh, right, I didn't bother with crap like the stl :-).

      You can either exercise total control, and guarantee no dangling pointers, or take the easy way out and pray.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    39. Re:Java by david_thornley · · Score: 1

      Personally, I use the STL libraries heavily, and find that they make my life easier, and exercise total control over pointers with unique_ptr and smart_ptr (haven't had occasion to use weak_ptr yet).

      And, no, I don't know why you didn't have problems with uncertain order of execution while writing multi-threaded programs. I have enough problems with mostly single-threaded large programs that run a long time and react to user input

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    40. Re:Java by BarbaraHudson · · Score: 1

      Guess I was just more careful - and had a tyrant for a boss. The primary server had to start up 400 threads at start, and never terminate a thread to reclaim lost memory (terminating a thread and restarting it would have too much overhead). The secondary server had the same specs, except only 100 threads. Both servers had to communicate with each other and the outside world, as well as loading a list of modules for each one at startup.

      Ran it over a 4-day weekend at 1,000 requests/second on a machine with only half a gig of ram, and when I got back to work, not one byte lost (would have been easy to know because I was running linux and bsd w/o swap. Even 1 byte lost per request would have killed it, or at least killed one or more threads, and there was no provision to restart a dead thread, or a hung one ...).

      Anything's possible if you don't accept the "received wisdom" that it's "umpossible" to write c/c++ code that doesn't leak memory and you're willing to test, test, test (and try some weird stuff), like a real challenge, and you have a boss who insists that nothing less is acceptable so he gives you the time to "make it so."

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    41. Re:Java by david_thornley · · Score: 1

      That's an impressive achievement, yes, but it seems to me it would have been easier to get the same effect with smart pointers. You still have to put some thought into ensuring that circular references don't occur, but I'd suspect it would be easier than what you did.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    42. Re:Java by BarbaraHudson · · Score: 1
      It's not hard to prevent circular references - just restructure your code to avoid them. If you have a circular reference, you're probably doing something wrong, or at least lazy. :-)

      The only trick I used was what every kid hears from their parents - if you take something, put it back when you're finished/ It applies to malloc() as much as it applies to your toys when you were a kid.

      Which is why people should learn assembler before learning c or c++ - they'll have more respect for memory allocation.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
    43. Re:Java by david_thornley · · Score: 1

      The most common assembler target around is the screwy x86/amd64 architecture, and I really don't want to start anybody on that. I've worked to some extent in six different assembly languages, some for long periods of time, and my brain just blanks out when I try to learn how to program my current chips. I miss the days of the TRS-80 Color Computer: that 6809 had the sweetest architecture I've ever seen in an 8-bit CPU. The IBM 360 had an easy one to work with (of course, that was intended to be programmed in Basic Assembly Language, which was hardly basic).

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    44. Re:Java by BarbaraHudson · · Score: 1

      I really liked the 6809, but the 68B09E, along with the mmu that let you move 8k blocks of memory, and Microware OS9 and 512k of ram, multi-tasking was awesome for those days. Of course, now, with the flat memory model for x86, things make more sense. 3 floppy drives ... a whole meg of disk storage! Peripherals for speech, home automation, touch pad. Assembler, c, and pascal compilers. Those were exciting times.

      --
      "Transparent" is a shit show that trades on every stereotype going. A man in drag is NOT a transsexual.
  6. C++, C++, C++ by Anonymous Coward · · Score: 3, Informative

    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.

    1. Re:C++, C++, C++ by countach · · Score: 1

      Hmm, in my experience few people use C++ any more.

    2. Re:C++, C++, C++ by Anubis+IV · · Score: 1

      It only even exists because of the hipster mentality to "be different" just for the sake of being different with no real other point.

      That's quite the revisionist history you have there, though I do agree with much of the rest of what you've said.

      In truth, both languages saw their first releases in 1983 (though they had both been under development for a few years prior), both languages were being actively developed in parallel at that same time, and Objective-C was selected as the basis for NeXTSTEP back in the mid-80s, before the meteoric rise of C++ had yet begun in earnest. Given Apple's financial state in the late '90s, their desperate need for a new OS, and their past failure at building a new Mac OS themselves, they were forced into a position where they needed to purchase an OS from someone else. As such, their decision to purchase NeXT and use NeXTSTEP as the basis for what would become both OS X and iOS was born more out of desperation and an acute awareness of their precarious financial situation than out of a hipster mentality to "be different".

      That said, I completely agree with your opinion regarding which language is the better one to learn. For all intents and purposes, Objective-C really is just single-vendor language, as you pointed out, and it's slowly being obsolesced by that vendor in favor of a different language, meaning there's an indefinite expiration date on its life. In contrast, C++ continues to be actively developed, and while it may be getting overshadowed a bit in more recent years, it's still strong and will doubtless still be alive and kicking for several decades to come.

  7. C++14 != C++98 by gentryx · · Score: 3, Interesting

    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
    1. Re: C++14 != C++98 by Anonymous Coward · · Score: 2

      And almost as hard to read as perl.

    2. Re: C++14 != C++98 by RightwingNutjob · · Score: 1

      Only if written by perl programmers. The dynamic type checkers are a godsend for anyone doing lots of ipc between different processes and the user. A little bit of ugly in one place can make the rest pretty.

    3. Re:C++14 != C++98 by sexconker · · Score: 1

      I can read and understand C++.
      C++ on the other hand is an indecipherable bizarro language that makes only half sense 90% of the time and only 90% sense the other half of the time.

      It's worse than Old English vs. English.

    4. Re:C++14 != C++98 by AuMatar · · Score: 0

      I wish people would stop adding to C++. C++ as it stood in 1998 was a good, if somewhat complex, language. The new additions (except for a few of the libraries) make the language way too complex and lead to unreadable code.

      You need to learn that concise != good. If it did, everyone would be programming in perl 1 liners. Auto is the most braindead addition in history, it causes bugs, loses all the advantages of a typed language, and only needs to exist because they fucked up the STL by not using proper inheritance. Any code review that uses them is an auto bounce and fix. Templates are the most abused language concept in history- if you're using it for anything other than a container class, odds are 98% that you're writing hard to follow, hard to maintain code that should be rewritten

      C== was better when it was treates as C++98.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    5. Re: C++14 != C++98 by lq_x_pl · · Score: 4, Funny

      A coworker of mine refers to perl as a 'write-only' language.

      --
      An internal system operation returned the error "The operation completed successfully.".
    6. Re: C++14 != C++98 by Anonymous Coward · · Score: 1

      1996 called and it wants its bad joke back.

    7. Re: C++14 != C++98 by Anonymous Coward · · Score: 1

      1876 called, they need you and Mr. Watson.

    8. Re:C++14 != C++98 by Pseudonym · · Score: 1

      I wish people would stop adding to C++. C++ as it stood in 1998 was a good, if somewhat complex, language.

      That's because in 1998, we didn't know that Simula-style objects were deeply unsound.

      It's all the features which have been added since then which have made C++ useful. Unfortunately, the main reason why new features tend to be added to C++ is to fix the previous round of features.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    9. Re:C++14 != C++98 by Anonymous Coward · · Score: 1

      >loses all the advantages of a typed language
      No it doesn't. You still have strict typing, you just don't need to tell the compiler what the type is as it will infer it from the rhs. If the function I'm calling (say std::unordered_map::begin()) returns a specific, known type, why the hell should I have to type out the type AGAIN? There is no reason.
      auto it = propertyMap.begin(); declares a type that can hold the output of that function call and CANNOT EVER hold another type. It's exactly like typing std::unordered_map::const_iterator it = propertyMap.begin(); except far far less noisy.

      >Any code review that uses them is an auto bounce and fix.
      Wow. You need to actually learn how to write code

      >if you're using it for anything other than a container class, odds are 98% that you're writing hard to follow, hard to maintain code that should be rewritten
      You are a shitty dev. Templates are amazing for things beyond templates that are not containers. Such as policy based coding. For a simplistic example, look at some of the boost math libraries. By default, it uses long double. But maybe you're on a machine that only has floats so you want to do you bessel function math using a float. So you can toss a `` in the type and it works.

      I get the sense that you learned how to use C++ in the late 80s/early 90s and don't actually know how to use it anymore.

    10. Re:C++14 != C++98 by Shados · · Score: 1

      What's readable or not is relative to the context of the reader.

      A lot of the features that were added, were only added once they were pretty much standard everywhere else.

      I remember the first time I saw a lambda in a language... var foo = (x, y) => x * y

      What...the...fuck...is going on there.

      Of course, now that syntax or slight variations of it are everywhere, so most people will be able to read the above just fine, even if their language is choice doesn't use that exact syntax (ie: ruby). The C++ version is a little messy, but it sure as hell was needed.

      Same thing can be said of most of the additions.

    11. Re: C++14 != C++98 by narcc · · Score: 1

      1972 called, they're still pissed you returned their 'write-only memory' joke in such poor condition.

    12. Re:C++14 != C++98 by Anonymous Coward · · Score: 0

      The new additions (except for a few of the libraries) make the language way too complex and lead to unreadable code.

      Everything is unreadable if you aren't going to bother to understand the change, should we only add features that you already know how to read? If you can't understand lambdas then that's your problem, it's not that hard.
      The new threading model means we can finally write properly portable threaded c++ code.
      Using nullptr rather than 0 (or a NULL typedef) is obviously a *lot* better.
      Range-based for loops are even simpler than traditional for loops. for(auto& element : vec) {}
      The new override and final identifiers make intentions much clearer and improve readability.
      Strongly typed enums? Should be pretty obvious.

      Auto is the most braindead addition in history, it causes bugs

      No, 'auto' doesn't cause bugs.

      loses all the advantages of a typed language

      A "typed language"? Are you sure you know what you're talking about? Even if you meant "strongly typed" you are still wrong since the type of 'auto' is deduced at compile time.

      It also gives me the advantage of being able to refactor code, for example the type of a container, without having to change all the iterator references to it.

      for( std::vector<std::pair<myobjpointer *, std::stack<myvec<float>>>> it = whatever_map.begin(); it != whatever_map.end(); ++it ) { }

      There is absolutely no reason you need to specify all of that because you know that already based on the type of the map, so it is much easier, more readable and refactorable to write:

      for( auto it = whatever_map.begin(); it != whatever_map.end(); ++it ) { }

      Templates are the most abused language concept in history- if you're using it for anything other than a container class, odds are 98% that you're writing hard to follow, hard to maintain code that should be rewritten

      Nope, if I write vector and matrix classes, for example, that I want to be compatible with either doubles or floats then template classes are most definitely the way to go.

      I suspect it's more your lack of understanding than anything specific, which would explain why you didn't call out anything specific in your post. Also why you would suggest that using things you aren't specifying and probably don't understand would cause bugs.

    13. Re:C++14 != C++98 by nmb3000 · · Score: 1

      That's because in 1998, we didn't know that Simula-style objects were deeply unsound.

      I'm interested in learning more about this. Would you mind elaborating, or sharing a link to an article discussing it?

      --
      "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
      /)
    14. Re:C++14 != C++98 by khellendros1984 · · Score: 1

      Pseudonym posted this earlier in the thread, and I think that some of the ideas in the interview are what they're referring to.

      --
      It is pitch black. You are likely to be eaten by a grue.
    15. Re:C++14 != C++98 by Pseudonym · · Score: 1

      khellendros1984 gave the link to the Stepanov interview, but there's also this and this and this among many others.

      OOP is starting to decline now. It's already dropped out of high-performance computing. While Moore's Law hasn't slowed down yet, the clock speed bubble has burst. RAM is larger than it's ever been, but accessing it is more expensive than it's ever been relative to the CPU speed. All those extra transistors are going into more parallelism (SIMD, ILP, more cores, etc) instead of more cycles per second, and OOP is poorly-equipped to exploit this.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    16. Re: C++14 != C++98 by ClickOnThis · · Score: 1

      1964 called. They want their APL manual back, along with the "write-only language" jokes.

      --
      If it weren't for deadlines, nothing would be late.
    17. Re:C++14 != C++98 by Anonymous Coward · · Score: 0

      I don't read information formatted with "fuck". Grow up.

    18. Re: C++14 != C++98 by Anonymous Coward · · Score: 0

      Your mom just called. She's got a bad back.

    19. Re:C++14 != C++98 by Hognoxious · · Score: 1

      I can read and understand C++.
      C++ on the other hand is an indecipherable bizarro language

      And we won't know until we open the box.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    20. Re:C++14 != C++98 by AuMatar · · Score: 1

      I'm cool with nullptr for 0. But auto absolutely causes bugs. I've seen it, where programmers assume the auto datatype is one thing and it turns out to be another. It was a major performance issue in a program I debugged. Turns out the compiler assumed they were using floating point where they wanted to use int, and the processor didn't have a floating point unit, so it was all emulated in software. Unfortunately it wasn't found until after release.

      In addition, it decouples the data type from the code in maintenance. Want to know what that auto loop is actually doing? You need to find and check wherever the container was defined. This takes time, and leads to bugs when maintainers forget or make the wrong assumption. For saving 10 characters at writing time you cost orders of magnitude that when maintaining the code.

      Furthermore- the reason for auto was they fucked up the STL by adding too many features (allocators) and insisting on their algorithms library (which in 15 years of writing C++, I have never seen used) being compatible with pointers as well without using a wrapping class. Stupid, stupid ideas. You don't perpetuate mistakes with new features which add new problems- you correct them.

      I completely understand the new features of C++- I just think the vast majority are a bad idea.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    21. Re:C++14 != C++98 by TheRaven64 · · Score: 1

      The main advantage of auto is in templates, where the type is something complex derived from template instantiations. You simply don't want to make it explicit. Oh, and in lambdas, where explicitly writing the type of the lambda is very hard (though you generally cast to std::function for assignment). As to using a float instead of an int... I have no idea how you'd do that with auto. The type of auto is the type that you initialise it with. If you're using a platform where you don't have hardfloat, then why do you have APIs that return floats? There's your bug, the use of auto was just a symptom.

      And if you've never seen anyone use the algorithms library, then you must be using C++ in a very specialised environment. I've not seen any C++11 code that didn't use std::move. I've rarely seen a nontrivial C++ file that didn't use std::min or std::max, and most code will also use std::copy. The only code that I've seen that didn't use the algorithms library included is own, poorly optimised and buggy, versions of several of them.

      --
      I am TheRaven on Soylent News
    22. Re:C++14 != C++98 by countach · · Score: 1

      You _can_ write very efficient code, and you _can_ write very concise code, but the mental effort required to make all that happen means that few people think it is worth the effort.

    23. Re: C++14 != C++98 by tylikcat · · Score: 1

      +1

      (Though, in fact, I've run across perl programmers who write structured, well documented code.

      Seriously. And I hadn't been drinking or taking drugs at the time.)

    24. Re: C++14 != C++98 by halivar · · Score: 1

      I GOT IT!!! I GOT IT!!!! *look around sheepishly* I... I got it....

    25. Re: C++14 != C++98 by Anonymous Coward · · Score: 0

      kind of funny, all that perl bashing on probably the 1st xxl perl site ...

    26. Re:C++14 != C++98 by Anonymous Coward · · Score: 0

      Sounds like you have a case of bad code. Relying on the compiler invisibly casting floats to ints is never a good idea, especially when the potato you're compiling for doesn't have the hardware to support it. But by all means go ahead and keep blaming the language for not adapting to your poor practices.

    27. Re:C++14 != C++98 by AuMatar · · Score: 1

      Float for autos- someone used the wrong version of a library function that returned float to initialize the auto. Kid was new, he didn't know the effects it would have. Auto wasn't the bug, but without auto the bug wouldn't have existed- the problem would have been minimized to a single call and caused a compiler warning that we would have caught and fixed. Auto made the bug worse.

      No, I've used C++ in a very normal environment. STL container classes- used all over the place. The algorithms library? More complicated, harder to understand, and much harder to maintain. Very few places use that. And they shouldn't- while min and max aren't too bad, I would always prefer to see an explicit loop with the code embedded in the loop than a function call where I have to hunt down a functor (another thing that should never have come to be) to find out what the fuck is actually being done.

      If you want to write Ruby- use Ruby. Keep that shit out of C++.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    28. Re: C++14 != C++98 by rochrist · · Score: 1

      ....throws a SNOBOL.....

    29. Re: C++14 != C++98 by Anonymous Coward · · Score: 0

      from me bending her over and pounding it.

    30. Re:C++14 != C++98 by david_thornley · · Score: 1

      Auto doesn't kill programs, stupid programmers kill programs. The numeric conversion rules are well defined, APIs have to be defined to be used, and anybody who expects something to return an integral type and actually gets a floating-point type is doing something seriously wrong. It sounds like you were probably doing embedded programming (as any reasonably modern non-embedded processor does have built-in floating point), and doing it badly.

      Do you want to know what "for (auto i = foo.crbegin(); i != foo.crend(); --i)" does? It traverses foo from end to beginning, not altering the contents of foo. Is there a problem with that? Specifying the type of i instead of using auto doesn't guarantee that foo is the right container to be traversing, and if foo is the right container then there's nothing wrong with the statement.

      If you haven't used anything in the algorithms library in fifteen years, you're missing the point of much of C++ and your opinion is worthless. You not only don't understand the new features of C++, you don't really understand C++98. The algorithms library is much too useful to be intelligently avoided.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    31. Re: C++14 != C++98 by Anonymous Coward · · Score: 0

      it was auto tha caused this. pleAse read.

    32. Re:C++14 != C++98 by erapert · · Score: 1

      Auto is the most braindead addition in history, it causes bugs, loses all the advantages of a typed language, and only needs to exist because they fucked up the STL by not using proper inheritance.

      You. Are. Talking. Out. Your. Ignorant. Ass.

      Auto SOLVES every single one of those things you're complaining about.

      Shut up. Now.

    33. Re:C++14 != C++98 by AuMatar · · Score: 1

      If you want to use auto, go to a dynamically typed language. Strong typing is a feature, it prevents bugs and saves time and effort in maintenance. If you use auto, you're a shitty programmer. Auto solves NO problems except the number of characters you need to type when declaring stl iterators. Its a bad feature used to patch over other poorly designed features. Which basically describes almost all of the additions in the last 10 years to C++.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    34. Re:C++14 != C++98 by Anonymous Coward · · Score: 0

      But auto absolutely causes bugs. I've seen it, where programmers assume the auto datatype is one thing and it turns out to be another.

      You know what type it is, if you initialize it to a type it is that type and you cannot have auto uninitialized.

      It was a major performance issue in a program I debugged. Turns out the compiler assumed they were using floating point where they wanted to use int, and the processor didn't have a floating point unit, so it was all emulated in software.

      You don't seem to understand how this feature works, the compiler *does not* assume they were using floating point, it gave auto the type of float because they were using floating point. The bug is not with auto it is with other parts of your codebase that are using floats when they should be using integers.

      In addition, it decouples the data type from the code in maintenance. Want to know what that auto loop is actually doing? You need to find and check wherever the container was defined.

      You know what the loop is doing by reading the code and static analysis tells you exactly what type auto is too.

      For saving 10 characters at writing time you cost orders of magnitude that when maintaining the code.

      How exactly does this cost orders of magnitude of time when maintaining the code?

      I completely understand the new features of C++- I just think the vast majority are a bad idea.

      It seems pretty evident that you don't, your only beef is with auto and that appears to be pretty misguided. Stop telling yourself you understand it when you obviously do not.

    35. Re:C++14 != C++98 by Anonymous Coward · · Score: 0

      Float for autos- someone used the wrong version of a library function that returned float to initialize the auto.

      And how exactly did you get away with passing that variable through the rest of the codebase that was supposed to not use floats? Did you just ignore all the warnings about implicit casts?

    36. Re: C++14 != C++98 by Anonymous Coward · · Score: 0

      Amazon was originally written in Perl using HTML::Mason

    37. Re:C++14 != C++98 by david_thornley · · Score: 1

      On a scale of 1-10 for strong static typing, Haskell comes out at about 11. A lot of the typing is deduced, not explicitly declared, so there's the equivalent of heavy use of auto. Auto solves the problem of not knowing the type (common in templates, which preserve strong typing a whole lot better than any object-oriented equivalent), or having a type that is not easy to figure out, as well as simplifying iterator declaration and making it harder to get wrong.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    38. Re:C++14 != C++98 by david_thornley · · Score: 1

      Simple variable declaration is where I'd advise not using auto. I hate "auto v = [initialization]" where v is of a fairly simple type. Floating-point and integer types have distinct semantics (what does a/b mean?), and I'd like to make that more explicit. auto is more useful for iterators, since one iterator is much like another.

      C++ algorithms are useful. You're better off using them than coding things yourself. You're likely not to use some of them enough to remember them, but something like std::find_if is easier to write than a loop, and can be treated as a value rather than calculated before use.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    39. Re:C++14 != C++98 by exomondo · · Score: 1

      If you want to use auto, go to a dynamically typed language.

      No, you misunderstand what auto is, it has nothing to do with dynamic typing. It's type is deduced at compile-time, in fact you can find out its type with static analysis.

    40. Re:C++14 != C++98 by Anonymous Coward · · Score: 0

      Auto solves NO problems except the number of characters you need to type when declaring stl iterators.

      But he just gave you a link that demonstrates many problems that auto solves. Did you not read it or do you lack the cognitive ability to understand it? If you want to dispute the resolutions to the many problems listed in that link then go right ahead.

      But based on your posts on this topic you won't, because you don't know enough about it.

      • -You seem intent on sticking to your view regardless of all the evidence to the contrary
      • -You call everybody else "shitty programmers" for using auto yet you can't explain what you don't like about it.
      • -You say Herb Sutter is wrong in all of those listed solutions to problems but don't tell us why.
      • -You incorrectly associate auto with dynamic typing, further evidence you have no idea what you are talking about.
      • -You say "strong typing is a feature", well it is a feature of auto too. You say this because you don't know what auto or strong typing are. If you did you would know that auto *is* strongly typed, its type is deduced at compile time, you cannot have an uninitialized auto variable (a variable with no type) and you cannot change its type.

      So in short, as was said here, "Shut up. Now.". You look stupider every time you post.

    41. Re: C++14 != C++98 by Anonymous Coward · · Score: 0

      Edsger Dijkstra called and says he made up that joke in 1988.

    42. Re:C++14 != C++98 by AuMatar · · Score: 1

      The reason they're useful for iterators is that they fucked up iterators. There should have been a base abstract iterator class with child classes for the various types/classes. Then you could have just declared it as an iterator* and not worried. Rather than providing bad patches they should fix the initial problem. Patching on mistakes just leads to problems.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    43. Re:C++14 != C++98 by AuMatar · · Score: 1

      -You seem intent on sticking to your view regardless of all the evidence to the contrary
      -You call everybody else "shitty programmers" for using auto yet you can't explain what you don't like about it.

      Pot. Kettle.

      You look stupider every time you post.

      Yup that too.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    44. Re:C++14 != C++98 by Anonymous Coward · · Score: 0

      Pot. Kettle.

      Nope, because you provided no evidence. So here, refute this list. Oh right, you dont actually understand the concept of auto which is why you can't provide any evidence nor refute the contrary evidence presented to you. So yet again the only thing you have succeeded at is looking stupid.

      It isn't a hard concept but you even compared it to dynamic languages which is irrefutable proof that you have no idea what you are talking about.

    45. Re:C++14 != C++98 by Anonymous Coward · · Score: 0

      The reason they're useful for iterators is that they fucked up iterators. There should have been a base abstract iterator class with child classes for the various types/classes. Then you could have just declared it as an iterator* and not worried.

      How is that different to auto? If you have a variable of type iterator* then what is its specialization, what does that iterator point to? It has to be inferred just like auto, so doing that is not advantageous at all, in fact it is the same but without the ability to explicitly specify its type.

  8. Objective C by xx_chris · · Score: 2, Insightful

    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++.

    1. Re:Objective C by sg_oneill · · Score: 3, Interesting

      C++ can be clean. The problem is really Macro metaprogramming madness tends to lead to some really strange code and sometimes straight up gibberish. I much prefer Objective C as well, I think its terse, readable and *usually* fairly resistant to a lot of the gunk C++ has accumulated. HOWEVER with that said C++ *can* be well written and clear. Hell even PERL can be. Its just that often it isn't.

      --
      Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.
    2. Re:Objective C by Anonymous Coward · · Score: 0, Offtopic

      Might I recommend Go? It's a new spiffy modern language, but very C-like. And despite being compiled, it allows for rapid application development due to elegant syntax, and copious type inference.

      No, it doesn't have generics. (it's quite a common question)

    3. Re:Objective C by Anonymous Coward · · Score: 0

      Python is also a syntactically nicer language than C++ by some measures. However, just like Objective-C, there are environments where it is not feasible and you will need to use C++.

      Just because you like the way a language sounds, say French, that doesn't mean it's the right choice for international business relations. You have to learn English and Mandarin for that - just like you have to learn C++ if you want to be a versatile programmer.

    4. Re:Objective C by Drishmung · · Score: 2, Interesting
      I agree.

      I was surprised to find how clean Obj-C was. Eventually, I figured out that it's because of two things:

      [1] The weird at first [receiver message] syntax makes it explicit that it is a message passing object model. I find that a natural and helpful model, rather than the procedural-like syntax of C++ and Java. The syntax helps me think in objects, with a clean visual and mental distinction between the Obj bits and the procedural bits.

      [2] NextStep is a thing of beauty.

      Against that, modern C++ has more modern and advanced syntax (lambda, templates). I'm not sure they make up for it. But rather than C++ I'd go for some other modern language (insert large list here).

      --
      Protoplasm. Quiet Protoplasm. I like quiet protoplasm.
    5. Re:Objective C by Anonymous Coward · · Score: 0

      Against that, modern C++ has more modern and advanced syntax (lambda, templates).

      Objective C has lambdas.

    6. Re:Objective C by Anonymous Coward · · Score: 0

      Assuming you're not a troll, I feel sorry for you - you're going to have a VERY hard time in programming life if you can't understand something as simple as C++

    7. Re:Objective C by Drishmung · · Score: 1

      Against that, modern C++ has more modern and advanced syntax (lambda, templates).

      Objective C has lambdas.

      Sorry, you are right. I'd forgotten about blocks. Objective C 2.0 also added some syntax extensions.

      --
      Protoplasm. Quiet Protoplasm. I like quiet protoplasm.
    8. Re:Objective C by Anonymous Coward · · Score: 0

      Assuming you're not a troll, I feel sorry for you - you're going to have a VERY hard time in programming life if you can't understand something as simple as C++

      C++ "simple"??? I have a hard time not believing you're the troll. You must be a genius.

      Even Rob Pike thinks it's too complex. (You may remember Rob from such hits as "Unix" and "Plan 9." He also wrote The Unix Programming Environment and co-wrote The Practice of Programming with Brian Kernighan, the "K" in "K&R C.")

    9. Re:Objective C by Malc · · Score: 1

      Never tried SmallTalk?

    10. Re:Objective C by Anonymous Coward · · Score: 0

      While C++ does indeed suck, I would argue Objective-C is even worse. C++ at least tries to make its extensions feel somewhat natural expansions in syntax to plain C. Objective-C looks like to two completely unrelated languages combined in a freak accident. I am also not very fond of all the boilerplate required.

    11. Re:Objective C by Anonymous Coward · · Score: 0

      c++ is simple. Sure you can make it complex if you want to. but you can do the same with anything.
      I've never understood the desire in some programmers to make things as complex as they can. I've seen C++ guys write a huge complex template monstrosity with layer upon layer of templates when i've done the same thing in "C with classes" in three of four neatly defined classes.
      And obj-c is has horrible syntax. It should not be possible to have it compile and link ok only to crash cos you misspelled something.
      If it were me tho, i'd recommend c#. it's lurvly.

    12. Re:Objective C by Anonymous Coward · · Score: 0

      Simple programs written in C++ are simple. C++ itself is not simple.

      Do you need to know every nook and cranny of the language to get anything done? No. But if you're thrown into the deep end of someone else's code base, you will almost certainly find lots of code of which you have no clue how it works.

      Stroustrup's The C++ Programming Language, 4th Edition is 1200 pages long. The ANSI version of K&R is 272 pages.

      Hell, even Stroustrup's introductory book meant for beginners is 1300 pages! He recommends a full semester to cover it.... 15 hours a week for 14 weeks.

      Simple, huh. I'm sure it would take you only 12 weeks, genius that you are...

    13. Re:Objective C by chaircrusher · · Score: 1

      Using the phrase "Macro metaprogramming" makes it sound like you don't understand C++. There are macros -- as in the C Macro preprocessor, which has been around for 40 years -- and there is Template Metaprogramming, which is a relatively new thing. But they're completely different. If one is serious about re-usable code in C++, one learns how C++ templates work. Templates complement C++ class inheritance by solving a different problem: where class inheritence allows re-use of code to manipulate similar data, Templates allow to reuse code on different data. The simplest example being something like: template Adder { T Add(T a, T b) { return a+b; } }; This template code works on anything -- built-in types or class objects -- that implements the '+' operator. Objective C had one advantage over C++ -- Closures/lambda expressions. Closures are now part of the latest C++ standard, and they're implemented in a more rigorous, type-safe manner.

    14. Re:Objective C by david_thornley · · Score: 1

      In fact, people who don't know $LANGUAGE often can't read a page of $LANGUAGE without referring to something, and even people who do know $LANGUAGE can have trouble with badly written $LANGUAGE. Also, people who don't understand $LANGUAGE pretty well shouldn't write production code in $LANGUAGE. And, of course, most languages should be more like $LANGUAGE.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  9. Big difference by Anonymous Coward · · Score: 0

    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.

    1. Re:Big difference by Anonymous Coward · · Score: 0

      they've tried to add so much stuff to it so it can compete with modern dynamic languages

      Like what? If anything, C++ is becoming more and more *functional*.

  10. Smalltalk. by jcr · · Score: 1

    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."
    1. Re:Smalltalk. by Pseudonym · · Score: 1

      I was going to say Newspeak, but yeah, Squeak is fine.

      Eiffel or Sather would also be good approaches. Don't damage your brain by using languages whose object module is based on Simula.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    2. Re:Smalltalk. by Anonymous Coward · · Score: 0

      I was going to say Newspeak.

      doubleplusgood comrade

    3. Re:Smalltalk. by countach · · Score: 1

      Is Sather still alive and kicking? I thought it was dead. Come to that I thought Eiffel was dead.

  11. False choice by 1+a+bee · · Score: 1

    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!

    1. Re:False choice by Anonymous Coward · · Score: 0

      Objective-C is not classic.

      Really? And what exactly makes C++ classic? The fact that it was released in the early 80s? Well so was Objective C.

    2. Re:False choice by Anonymous Coward · · Score: 1

      Objective-C actually predates C++

    3. Re:False choice by Carewolf · · Score: 1

      Objective-C actually predates C++

      Not really. The are both from 1983, and work on C++ started in 1979 where work on Objective-C started in 1981. I would say they are equally old, and unlikely to have even influenced eachother before birth.

    4. Re:False choice by Anonymous Coward · · Score: 0

      no, it's classic because you can walk into pretty much any job interview and say "i've 10 years c++" and at least expect a decent chance of the job (specialist areas not withstanding).
      Do the same with obj-c and you'll be lucky if you even make it to the interview stage.

  12. Ask yourself what you want to do by Anonymous Coward · · Score: 0

    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.

  13. Re: Classic? by Anonymous Coward · · Score: 1

    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..

  14. C++11 or newer by Anonymous Coward · · Score: 1

    C++11 and newer add hugely useful features, and it runs everywhere. Learn it. Use it. Profit.

  15. SmartEiffel: Classic Compiled Object Language by Anonymous Coward · · Score: 0

    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.

  16. Go Old School by radams217 · · Score: 2

    Have you ever heard of VB6? I'd start there. Nailed it.

  17. Objective-C is a lot of work by OrangeTide · · Score: 4, Informative

    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
    1. Re:Objective-C is a lot of work by Anonymous Coward · · Score: 0

      True, but the GNUstep folks don't take upstream patches unless your target platform is popular. If you're working on a small embedded platform or god forbid a small BSD project, don't bother submitting.

      Expect to port new versions periodically yourself.

      There also seems to be a pattern of the GNUstep folks breaking most applications every 5-10 years as they decide to start over on some major part of the system.

    2. Re:Objective-C is a lot of work by brambus · · Score: 1

      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.

      Contrast with implementing the C++ base libraries (such as the STL) and you'll quickly see which is simpler. The real difference is that C++ already has more implementations for more platforms. I agree with your conclusion - availability can make its use for your project a non-starter. However, unless we're talking about pretty weird embedded stuff or some weird OS platform like Haiku or something, GNUstep has been already been ported to lots and lots of platforms (including most of the major *nixes and Windows).

    3. Re:Objective-C is a lot of work by OrangeTide · · Score: 1

      I've ported SGI STL to various platforms in the past. And I used to be the system software lead for an embedded product, where I maintained the toolchain and libraries for MIPS and PowerPC (PowerQUICC) products. C++ runtime is a real chore to get right, but it's a path well tread. Obj-C Base Library is technically slightly easier, as the API is smaller, but it's so easy to get wrong and not know it until way later, and there is so little information on getting it right.

      A lot of the L4 Kernels use a thin subset of C++ runtime. Which can be a pain to port, and a bigger pain to implement from scratch if you're doing a new clean-room L4.

      I really don't like C++ anymore, and I now refuse to accept a jobs where I have to do anything significant with it. I currently have that luxury, but if the job market goes really bad we'll see how well I hold to that position. I'd probably take a job with less pay learning/doing Erlang, Go, Nim, or whatever if C without C++ was no longer a career option.

      --
      “Common sense is not so common.” — Voltaire
    4. Re:Objective-C is a lot of work by brambus · · Score: 1

      Wait, so you're porting or implementing it anew? One is not the other. Also, runtime != base library. Did you try to port the base library, or the runtime? Porting or even rewriting the runtime is pretty straightforward and I'm aware of at least one project where a single person did it without much trouble. The base library, yeah, a lot less simple, but still simpler than writing a new stdc++. Also share your sentiment on C++. It's way, way too big for my tastes. For the kinds of work I do (systems stuff, OS stuff, like you), C is plenty expressive enough.

    5. Re:Objective-C is a lot of work by OrangeTide · · Score: 1

      Both porting and implementing, in different situations. L4 being my example of having to construct a small runtime and standard library subset for a kernel environment in C++.

      Porting work for was Linux based for CPU variants that were not well supported at the time by most of the standard libraries. the NetBSD based platform at the same job didn't need to run any of the C++ based apps, so I diudn't even bother trying it. I suspect it would have just worked, because after the kernel changes to support the weird MMU were done the user space started up right away.

      --
      “Common sense is not so common.” — Voltaire
    6. Re:Objective-C is a lot of work by brambus · · Score: 1

      Ah, ok, cool work. So were you trying to port libobjc and/or gnustep to this platform? gnustep is quite a bit more than a simple basic set of classes. It's perfectly possible (albeit not quite as comfy) to write objc programs which don't use it.

    7. Re:Objective-C is a lot of work by Anonymous Coward · · Score: 0

      It was a long time ago, I think it was called libobjects. It was some non-GUI parts like NSObject and NSString. I didn't keep the originals, because I wrote that for a company. But I did find my minimal proof-of-concept library that defines a base object for all other objects to be implemented on top of. Pretty much just needed to define a good structure and a few low-level functions like allocate_object() to handle the low level business.

  18. C++ is probably a little bit better by Chalnoth · · Score: 4, Informative

    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.

    1. Re:C++ is probably a little bit better by TheRealMindChild · · Score: 1

      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.

      You mean using C++ like it is compiled javascript? pffffffffffffffffff

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    2. Re:C++ is probably a little bit better by Required+Snark · · Score: 2, Insightful
      C++11 seems to be somewhat useable. However, before that it was a complete disaster. Every time I looked at it, I saw code bases that endlessly re-implemented data structures and storage management solutions.

      Even with the standard libraries, there were rarely systems without a lot of custom storage code. By it's own claimed abilities for code reuse, C++ was a failure before C++11.

      Every time I brought this up, the C++ fanboys had a fit. I'm rather sure that I was forced out of some jobs because I said this. I know I didn't get hired when I expressed this opinion. I think I was better off not going to those places.

      So now I'm going to make the same mistake again. If we take Stroustrup's publication of The C++ Programming Language in 1985 as the start of the ongoing C++ era, then it took over 25 years for the language to become somewhat OK. I can only come to the conclusion that C++ itself was a badly designed language, and this is proven by the time that it has taken to reach it's current state.

      In my estimation, C++ was never a good idea. Even though it has improved significantly, it will always be crippled by it's basic design flaws. It is overly complex. It has a vast number of interacting corner conditions that interact in strange ways and can produce bizarre side effects. These have increased over time.

      The object model creates problems and you always end up programming around it. Refactoring is invariably difficult; that's where the phrase "brittle objects" comes from. Object encapsulation works poorly. Changing the internal workings of an object is very likely to propagate outside the object. No matter how much precoding design occurs, you will always be modifying objects in ways that required a large amount of code changes in a great number of files. All of this requires a lot of testing.

      Debugging has always been a problem. One of the other posts here suggested using CLANG because of it's better error reporting. Thats right now, after 25 years. Let's face it, C++ is legendary for the obscurity of it's compile and link time error reporting. Beyond that, it's not like the run time debugging environment is any better. All that it supports is the kind of break point debugging that was in C. No value added beyond K&R.

      So flame away, fanboys. I'm used to it. The truth hurts, and the more squealing I get, the more I know that I am saying the truth.

      --
      Why is Snark Required?
    3. Re:C++ is probably a little bit better by ShakaUVM · · Score: 1

      >Debugging has always been a problem. One of the other posts here suggested using CLANG because of it's better error reporting. Thats right now, after 25 years. Let's face it, C++ is legendary for the obscurity of it's compile and link time error reporting. Beyond that, it's not like the run time debugging environment is any better. All that it supports is the kind of break point debugging that was in C. No value added beyond K&R.

      This is true. I teach introductory computer science using C++, and one of the biggest hurdles for my students is understanding the error messages from the compiler. Half the time they don't mean anything unless you already know what it's supposed to mean.

      And that's before even getting to templates. Once you get into templates... /shudder. The error messages are insane.

      I tried compiling the rather simple boost program from the "getting started" section here: http://www.boost.org/doc/libs/...

      Without the proper library linked in (i.e. just doing a "g++ test.cc"), I get 38 lines of vomit that look like this: .text._ZN5boost11 basic_regexIcNS_12 regex_traitsIcNS_16cpp_regex_ traitsIcEEEEE6assignEPKcS7 _j[_ZN5boost11basic_ regexIcNS_12regex_ traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEPKcS7_j]+0x22

    4. Re:C++ is probably a little bit better by Anonymous Coward · · Score: 0

      I agree.

      I love it though, really. But as a hobby language :-)

      You can make it so... complex! So elegant, so endlessly unmaintainable!

      I'd prefer C for reality :-) It's less obscure, albeit the code is not elegant. But elegance is probably not a good thing.

      Elegance is when you do something insanely smart. A sign of the dangers, is when not even yourself understand it after a month :-)
      (And I'm sooooo elegant, I can't work my old code!)

    5. Re:C++ is probably a little bit better by Carewolf · · Score: 1

      C++11 seems to be somewhat useable. However, before that it was a complete disaster. Every time I looked at it, I saw code bases that endlessly re-implemented data structures and storage management solutions.
      Even with the standard libraries, there were rarely systems without a lot of custom storage code. By it's own claimed abilities for code reuse, C++ was a failure before C++11.

      That is how C++ is meant to be used. If you only need fixed standard data structures, you might as well use a higher level language. What something like C++ or C gives you is the ability to write your own data-structures, if you don't need that, they are probably overkill.

      C++11 doesn't really change that. It just makes the custom data structures even more powerful, and slightly easier to write.

    6. Re:C++ is probably a little bit better by Anonymous Coward · · Score: 0

      which is why you stay the hell away from boost. It's a fucking nightmare. Also use a decent IDE (VS) and you'll be grand. gcc compiler outputs suck donkey balls.

    7. Re:C++ is probably a little bit better by countach · · Score: 1

      LOL, you just gave me deja-vu about my previous life as a C++ programmer.

    8. Re:C++ is probably a little bit better by Anonymous Coward · · Score: 0

      So flame away, fanboys. I'm used to it. The truth hurts, and the more squealing I get, the more I know that I am saying the truth.

      I agree with many of your points but perhaps you shouldn't try so hard to come off as a troll.
      With the way you talk and seem to act, I'd seriously go out of my way to avoid you in real life, you seem like a major pain.

    9. Re:C++ is probably a little bit better by Chalnoth · · Score: 1

      Debugging has always been a problem. One of the other posts here suggested using CLANG because of it's better error reporting. Thats right now, after 25 years. Let's face it, C++ is legendary for the obscurity of it's compile and link time error reporting. Beyond that, it's not like the run time debugging environment is any better. All that it supports is the kind of break point debugging that was in C. No value added beyond K&R.

      I started development in C++, but have since done quite a bit of development in Java, JavaScript, Go, and Python. I've really come to miss Clang's expressive compile errors, though there are other things about these languages that can be nice. Java is okay. JavaScript is abominable. Go is nearly as good as Java. Python is pretty terrible. As far as compile errors are concerned, anyway.

      The other languages have other things that are good and bad, but C++, especially C++11 is great for just getting things to compile. One other cool thing about modern C++ is that it's easier than ever to force more and more errors to occur during compile time, instead of waiting for a runtime error to blow things up in production.

      To make the most of C++ really requires good programming practices, though. For that I highly recommend Scott Meyers' "Effective C++" books.

    10. Re:C++ is probably a little bit better by serviscope_minor · · Score: 1

      Well basically no. Given your statement:

        So flame away, fanboys. I'm used to it. The truth hurts, and the more squealing I get, the more I know that I am saying the truth.

      I don't expect this reply will get through to you or get meaningful a responses. Others might benefir so here goes:

      Even with the standard libraries, there were rarely systems without a lot of custom storage code. By it's own claimed abilities for code reuse, C++ was a failure before C++11.

      Well, depending on how you meant that, it's either wrong or a triumph of C++. I have used systems where there has been extensive use of custom containers. The main reason for that was it targeted android and android didn't really ship with C++. It shipped with a language looking much like C++ except with several key features and the standard library nuked. It's hardly C++'s fault for languages that are almost-but-not-quite C++ not being C++.

      Other than that one, people mostly seem to make do with the standard containers for things they work for.

      In my own code I also make use of two non STL containers, one for images and one for Linear Algebra (vectors and matrices). It's a triumph that these work and look and feel just like native or standard library things. They also don't use custom code: it's either C++ arrays for fixed In my own code I also make use of two non STL containers, one for images and one for
      sized objects and backed by std::vector otherwise.

      So now I'm going to make the same mistake again. If we take Stroustrup's publication of The C++ Programming Language in 1985 as the start of the ongoing C++ era, then it took over 25 years for the language to become somewhat OK.

      No one will deny that C++11 was late. Hell it was meant to be C++0x. However, you're comparing one of the better languages today (C++14) with languages from 30 years ago which is disengenuous. It took C++ 25 years to become a good language relative to others 25 years from its inception. But it was good in the mean time compared to its contempories too.

      I wouldn't want to use '98 era C++ now, but I wouldn't want to use Java 1.1, VB6, ancient javascript, bash 2.06 or a host of others now either.

      In my estimation, C++ was never a good idea.

      Well, the world more or less disagrees with you. It's the only language out there that provides high level abstractions and low runtime penalties. The only serious competitors have come around recently and aren't really production ready. What else scales as well?

      Changing the internal workings of an object is very likely to propagate outside the object.

      Not if you code worth a damn. Yes we all know objects are sized things and changing the object requires a recompile. However, my code compiles on LLVM, GCC and Visual Studio and ha at various times compiled on MIPS Pro and whatever that sun compiler was. I think someone got it to compile with STLPort on Android too back when that was a thing.

      That's 6 complete, from scratch reimlementations of the same objects (the standard library). Yet despite those complete changes no fooling around was required in that regard.

      --
      SJW n. One who posts facts.
  19. c++ by Anonymous Coward · · Score: 1

    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.

    1. Re:c++ by Dutch+Gun · · Score: 1

      I agree. C++ has really seen something of a renaissance in the last few years with C++ 11 and 14. CPU core speed has flattened, and people are realizing that efficiency isn't really something that can be ignored in many cases. Moreover, C++ is and always has been a very portable language, as you can compile it on just about every platform imaginable.

      Nowadays, you can write C++ and be assured that you'll rarely have to even think about explicit memory management or leaks. Moreover, what really surprised me was how I actually now prefer the simpler, more versatile, and more predictable referece-counted paradigm over managed memory and garbage collection. The lack of a destructor mechanism means that releasing resources in a predictable manner tends to be a bit less elegant because it's handled in a different way. In C++, memory is just like any other resource.

      A lot of people talk about the complexity of C++. There are a couple of things to remember. C++ IS a pretty big and complex language of course, but you don't necessarily have to actually deal with much of that complexity in many circumstances. First, a lot of complexity is related to it's own backwards compatibility both with C and it's own early features. Unless you're maintaining or interfacing with old code, many of those features are largely irrelevant when writing modern C++. If that's not the case, you either have some exceptional circumstances, a very old codebase, or you're not really using the language correctly. Second, C++ can be viewed as two different languages: one suited for library writers, and one for library users (or application programmers). Writing C++ for use in languages can actually be rather difficult - it should be viewed as expert-level language skills. However, C++ actually makes it extremely easy to use a library. And in fact, a well designed library should actually be very difficult to use incorrectly, especially when compared to C.

      The language definitely has it's strengths and weaknesses, and I certainly wouldn't recommend it for everything. I'd say C++ starts to really shine when you talk about extremes. If you need your program on a lot of different platforms, need it to run extremely fast, or it has to run with extremely limited constraints, or it's an exceptionally large and complex program, then C++ may be a good fit.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    2. Re:C++ by Bill+Dog · · Score: 2

      C++ is very complex, and whole swaths of the language can be safely ignored.

      And this is why I wouldn't recommmend C++. I loved the language and did it for right around ten years (1999-2009), and saw people online who knew it, but I never met anyone live in my professional career who ever bothered to really learn it. (And now later, I'm having the same experience with JavaScript.)

      But I wonder about why the very particular constraint of "classic OOP compiled". I don't think I'd recommend any of those anymore; aside from specialized applications, if what one is going to be writing is large enough to utilize OOP, then VM'ed languages are much more relevant these days.

      --
      Attention zealots and haters: 00100 00100
    3. Re:c++ by Marginal+Coward · · Score: 1

      Moreover, C++ is and always has been a very portable language, as you can compile it on just about every platform imaginable.

      Gosh, I guess you don't remember the early days when Borland, Microsoft, and others had incomplete and differing implementations of the C++ "standard". It was almost impossible to get templates to run on different compilers unchanged. I think it simply took a decade or so for the compiler vendors to fully implement such a complex language. Fortunately, those days are behind us now. Evidently the C++ standard is better specified now, and the compilers are much better at implementing it.

    4. Re:c++ by Dutch+Gun · · Score: 1

      Well, it definitely wasn't perfect. I cross-compiled code with Microsoft, Borland, gcc, Watcom, and others years ago, but I don't recall it ever being as bad as you seem to remember. If you used a reasonably conservative set of language features, it was definitely possible to keep your code quite portable.

      Nowadays, as you mentioned, it's an entirely different situation, as full standards compliance seems to be getting a lot more attention.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    5. Re:c++ by Anonymous Coward · · Score: 0

      Moreover, C++ is and always has been a very portable language, as you can compile it on just about every platform imaginable.

      Or you should in theory at least.
      In the 8-bit arena (Embedded or old) C++ support is pretty much nonexistent or incomplete.

      Heck, once you leave the architectures supported by GCC the portability of C++ becomes questionable.

    6. Re:c++ by Dutch+Gun · · Score: 1

      Or you should in theory at least.
      In the 8-bit arena (Embedded or old) C++ support is pretty much nonexistent or incomplete.

      Heck, once you leave the architectures supported by GCC the portability of C++ becomes questionable.

      Was anyone confused that I might be talking about an Apple II or Commodore 64 when I said "just about every platform"? And regarding embedded, it seems relatively easy to find C++ compilers for embedded hardware.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    7. Re:c++ by tylikcat · · Score: 1

      "Nowadays, you can write C++ and be assured that you'll rarely have to even think about explicit memory management or leaks."

      Crazy talk.

      I am not saying this isn't true - I am just remembering that at one point a huge part of my job was auditing other people's server code for, well performance, scalability, reliability and disaster failover recovery. And "Okay, we're going on the magical mystery tour and find all the memory leaks you swore up and down did not exist," was a thing. A really common thing. Ugh.

      Seriously, working as a performance analyst for very high traffic highly distributed internet applications... is kind of what brought to biology, really, via non linear dynamics systems theory. As the systems got complex, sometimes their behavior got really weird - and that was so much more interesting than the rest of my job, by that point. (And now, in a rather impoverished ivory tower, I mostly use Python. Heck, half of my rig code is written using PyGame, because I was in a hurry and it got the job done, and it continues to get the job done well enough that I keep modifying rather than replacing it.)

    8. Re:c++ by tshawkins · · Score: 1

      Arm, avr and pic all have gnu c++ compiler environments.

  20. Why not Pascal? by Megol · · Score: 4, Interesting

    Object Pascal that is. It's available in Free Pascal for a lot of operating systems and is a small and fast development environment.

    1. Re:Why not Pascal? by Em+Adespoton · · Score: 1

      Because if you go with Object Pascal, you're going to be constantly confusing your stringtypes and endianness. Pascal's a great teaching language (first thing I had formal training in), but since nobody's using it for modern deployment, the only thing you're really going to be able to transition to is Delphi.

      Pre-C++11 is a nightmare, as it does so many things wrong OO-wise that I wouldn't really call it object oriented at all. 11+ begins to get more sane, and might be worth learning.

      But if you do ObjectiveC, you can significantly add to the percentage of developers who can build for GNUStep :D

    2. Re:Why not Pascal? by Anonymous Coward · · Score: 0

      But if you do ObjectiveC

      I thought Apple's long term plan was to displace Objective C with Swift. To that extent, Objective C might be a dead end.

    3. Re:Why not Pascal? by Anonymous Coward · · Score: 1

      I've been developing a 3D game engine using Object Pascal for many years as well as contributing to the Freepascal compiler and Lazarus projects. You don't have a clue what you're talking about. confuse my string types? my endiness?

      C++ isn't the only language that has evolved. Freepascal is available on all major platforms, it produces code just as fast as any compiled language, we have no problem with getting our string types confused and endiness is a generic programming concern that is no more an issue in Object Pascal than any other language.

      The current flavours of the Object Pascal have their roots in Turbo Pascal which then evolved into the Delphi dialect of the language, the latest best being the FPC native dialect which blows C++14 out of the water in many respects.

      Turbo Pascal and Delphi were principally designed by Anders Hejlsberg who Microsoft hired to design a little language known as C#. I hear it's quite popular in the business world.

    4. Re:Why not Pascal? by Anonymous Coward · · Score: 0

      Because Ada is everything Pascal wishes it could be.

    5. Re:Why not Pascal? by Anonymous Coward · · Score: 0

      > Because Ada is everything

      You could have stopped there!

    6. Re:Why not Pascal? by Megol · · Score: 1

      Because if you go with Object Pascal, you're going to be constantly confusing your stringtypes and endianness.

      I don't understand what you mean by this?

      Pascal's a great teaching language (first thing I had formal training in), but since nobody's using it for modern deployment, the only thing you're really going to be able to transition to is Delphi.

      Provably false. It isn't as popular as some languages but it is used for real world products.
      Free Pascal is mostly Delphi compatible BTW.

      Pre-C++11 is a nightmare, as it does so many things wrong OO-wise that I wouldn't really call it object oriented at all. 11+ begins to get more sane, and might be worth learning.

      But if you do ObjectiveC, you can significantly add to the percentage of developers who can build for GNUStep :D

      I'm not sure you understand what object orientation refers to in most languages - sure no (?) language that went from a structured to object orientated model are pure OO languages. But most people isn't interested in pure OO languages anyway, most just want abstract data types to be supported.
      Some languages that aren't called object oriented but "just" object based essentially "just" support abstract data types. Those that then add inheritance are then called object oriented.

    7. Re:Why not Pascal? by Anonymous Coward · · Score: 0

      Ok - I stand corrected Free Pascal or Delphi.

  21. Consider C by Anonymous Coward · · Score: 0

    With anonymous unions in C11, C knocked out the last hurdle to using it smoothly for OOP.

  22. I have done lots of both and say C++ absolutely. by EmperorOfCanada · · Score: 1

    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++.

  23. Who cares by Anonymous Coward · · Score: 4, Insightful

    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.

    1. Re:Who cares by Anonymous Coward · · Score: 1

      I sure hope you aren't writing your C++ like you're writing your Java. That would make you a terrible C++ programmer.

    2. Re:Who cares by Anonymous Coward · · Score: 0

      No one who has deep knowledge of C++ would spew such ignorance. Learning something in two days is for Java, Python and Visual Basic.

    3. Re:Who cares by Anonymous Coward · · Score: 0

      This bullshit is always trotted out by people who are familiar with a half dozen samey languages and have no idea how close their horizons are. Try starting out in only C and learning LISP or Prolog or Factor or J "in a few days" by "reviewing the syntax and doing the same things in slightly different ways".

    4. Re:Who cares by pspahn · · Score: 1

      What is "learning"? Is that running through some prewritten bits to get some calendar application working ... you know, as an abstract concept you then "know". Go through that in two days and then go back to your day job doing whatever it is.

      Then fast forward six months. "Oh yeah, I wanna do some more of that coding I learned! I got this sweet idea for an application!"

      "... wait, shit ... what was the syntax for that again?"

      "... I know the class I need is here somewhere ... "

      etc. etc.

      You certainly did a great job of "learning" that language in two days, right?

      My point is that it is not possible to "learn a programming language" in two (or a few) days. If you use a few programming languages in your day to day job, then yes, you can explore another language and get the general idea in a day or two. But then you go right back to not using it.

      You can't learn a programming language unless you use it.

      --
      Someone flopped a steamer in the gene pool.
    5. Re:Who cares by Anonymous Coward · · Score: 0

      i've always thought of it like this:
      you can go from c to c++ fairly easily but it's a bit more tricky to go the other way
      you can go to c++ to java or c# fairly easily but it's a whole load harder to go the other way.
      and so on.

    6. Re:Who cares by countach · · Score: 1

      To some extent it's true you can learn syntax in a few days. HOWEVER, learning to think in a paradigm is a different matter. How long to pick up Scheme syntax? An hour. How long to change your brain to think in Scheme, and not in C/Java/C++/C# ? Well that's a whole different matter.

    7. Re:Who cares by Anonymous Coward · · Score: 0

      A few years ago, I would have agreed with your statement about learning a new language in a few days. That was before I learned Haskell which turned everything inside out and upside down. If you want to challenge yourself to learn something new, give it a try. I haven't had a chance to use the language professionally, but it has changed the way I approach software design even when working in an imperative language.

    8. Re:Who cares by assertation · · Score: 1

      I couldn't disagree more. That might have been true a long time ago, but nobody learns a new language, at least not well, in a few days.

      I have seen too many JSPs and Java functions that literally go for pages.

    9. Re:Who cares by david_thornley · · Score: 1

      Programming is not independent of language. The language specifies what sort of constructs are natural and what sort have to be constructed painstakingly. Try writing functional code in C, or generic code in almost any language, if you don't believe me. Different languages emphasize different styles (or "paradigms", if you like that word) of programming, and learning a new one often takes years.

      You're also a crap C++ programmer, and probably a crap Java programmer. Good C++ does things in a C++ way, not a Java or Pascal way.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    10. Re:Who cares by Anonymous Coward · · Score: 0

      This. It really doesn't matter much.

    11. Re:Who cares by Anonymous Coward · · Score: 0

      That's only true if you stick to the Algol family of languages -to which all the languages you list belong.

      If, however, you switch to the other family of programming languages, Lisp, then that requires more than just a review of syntax.

  24. Even Apple is abandoning Objective-C by msobkow · · Score: 4, Informative

    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.
    1. Re:Even Apple is abandoning Objective-C by maccodemonkey · · Score: 4, Interesting

      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.

      They've done no such thing. The biggest writer and maintainer of Obj-C code is Apple. They're sitting on a huge source base they'll continue developing on. Please link me to where Apple has said Swift is replacing Obj-C. Because they haven't. And they've said the opposite many times. Everything I've read/heard is that Obj-C will continue to be a first class language on iOS and Mac (with Swift and Obj-C both being considered first class languages.) You can have more than one language on a single platform. Shocking, I know.

      Not to mention, for such a dead end, Apple's still writing a lot of new Obj-C. The iWatch OS (what runs on the watch itself) is Obj-C. Apple has not shipped a single API on Mac or iOS written in Swift. Not one. So it makes zero sense that Apple would consider Obj-C a dead language, and yet continue to write source they'll have to maintain for years in it. And if you think Apple is going to rewrite the millions of lines of Obj-C in Mac OS X and iOS in Swift, you really don't understand software engineering very well.

      Another problem is that Swift is missing basic language features. Obj-C can link to C++ code. Swift? Nope. That alone means Swift can't replace Obj-C code. Everyone has C++ code they need to link to. Apple has C++ they need to link to in their own APIs. So does Adobe. Microsoft. And they'll probably fix it in the future. But you can't even approach suggesting Swift is going to replace Obj-C with a straight face until that is fixed.

      Now look, I'm not trying to argue against Swift here. It's a valuable language to use and learn. This isn't a desperate "Obj-C forever!" post. But if you think Obj-C is going anywhere in the next decade or two... It can't. Apple will continue upgrading it, and continue supporting it, or else they're going to end up putting themselves in a corner where they can't even maintain their own software. That's not opinion, that's realism. It's knowing when a tool is right for a problem. And we're nowhere near Swift even being able to entirely replace Obj-C in usage.

      Heck, the last Xcode beta even shipped with some upgrades to Obj-C. So I don't even need to argue that point. It's not a question of if Apple will keep advancing Obj-C. They are.

    2. Re:Even Apple is abandoning Objective-C by msobkow · · Score: 1

      The fact that Apple has to maintain internals using Objective-C does not conflict with the fact that they're pushing platform developers to use Swift. There are pieces of Apple's stack written in C, C++, and probably even other languages as well, seeing as the vast majority of their code base comes from open source.

      Of course Apple hasn't said Objective-C is a dead end. There would be a revolt and a mass fleeing from the platform if they did that.

      But they sure as hell aren't encouraging people to stay on Objective-C instead of moving to Swift.

      Are you sure you're on the same internet as the rest of us? I've read several articles and summaries (including on Slashdot) that have made it clear Apple wants people to use Swift.

      Oh, wait. Never mind. Apple person. You don't deal with the same reality as the rest of the world.

      --
      I do not fail; I succeed at finding out what does not work.
    3. Re:Even Apple is abandoning Objective-C by Anonymous Coward · · Score: 0

      Excellent summary of ObjC+Swift, nice post.

    4. Re:Even Apple is abandoning Objective-C by maccodemonkey · · Score: 3

      Of course Apple hasn't said Objective-C is a dead end. There would be a revolt and a mass fleeing from the platform if they did that.

      ...from their own developers? Again, out of the whole community, they have the largest Obj-C source base. If they abandon Obj-C within the next 10 years, they won't be able to ship anything. And it's going to take at least a decade to rewrite everything, if that was even their goal. During which time they ship no features. Apple can't abandon Obj-C because they need to use Obj-C. If they abandon Obj-C, they abandon Mac OS X and iOS. And they will be done in the market. And given that new API is still written in Obj-C, that's a process they haven't even started yet. In April they're shipping a brand new hardware platform that still runs on Obj-C.

      For a past data point, Microsoft said with Vista they were going to rewrite Windows in C#. How did that go? Replacing an entire language is simply not realistic. If you're an engineer, you should know that.

      Furthermore, once you're talking about the pain and suffering in moving everything to Swift, maintaining Obj-C looks like a far easier and more desirable costume. And that's what Apple is doing.

      But they sure as hell aren't encouraging people to stay on Objective-C instead of moving to Swift.

      I've talked with engineers on the Swift team who've said that's not the intention (and are wondering why the public thinks that). But please. Do go on.

      I've read several articles and summaries (including on Slashdot) that have made it clear Apple wants people to use Swift.

      "I've read articles from other people who think they know what they are talking about, and they wrote something that they think is right. Look at me! I'm such an expert!"

      Oh, wait. Never mind. Apple person. You don't deal with the same reality as the rest of the world.

      I... deal with the realities on the Apple platform?

    5. Re:Even Apple is abandoning Objective-C by msobkow · · Score: 1

      http://ask.slashdot.org/story/14/11/28/2148254/ask-slashdot-objective-c-vs-swift-for-a-new-ios-developer

      http://ask.slashdot.org/story/14/09/26/2247211/ask-slashdot-swift-or-objective-c-as-new-ios-developers-1st-language

      From http://www.raywenderlich.com/74138/swift-language-faq:

      So you can still use Objective-C. However, Apple seems to be encouraging you to use Swift for any new development, while not expecting you to go back and re-write all of your Objective-C code.

      From www.archer-soft.com/en/blog/technology-swift-vs-acobjective-c-pros-and-cons:

      Swift was created in order to replace Objective-C, however, Swift is capable of working alongside Objective-C while using Cocoa and Cocoa Touch frameworks.

      --
      I do not fail; I succeed at finding out what does not work.
    6. Re:Even Apple is abandoning Objective-C by msobkow · · Score: 1

      Five minutes with Google and no Apple-rosy glasses.

      Most Linux libraries are built with C. Does that mean you have to use C to program Linux? Of course not.

      So too with the existing Objective-C libraries. The language used to write a library is irrelevant; what matters is the language bindings the programmer uses to invoke the libraries.

      --
      I do not fail; I succeed at finding out what does not work.
    7. Re:Even Apple is abandoning Objective-C by maccodemonkey · · Score: 1

      http://ask.slashdot.org/story/14/11/28/2148254/ask-slashdot-objective-c-vs-swift-for-a-new-ios-developer

      http://ask.slashdot.org/story/14/09/26/2247211/ask-slashdot-swift-or-objective-c-as-new-ios-developers-1st-language

      From http://www.raywenderlich.com/74138/swift-language-faq:

      So you can still use Objective-C. However, Apple seems to be encouraging you to use Swift for any new development, while not expecting you to go back and re-write all of your Objective-C code.

      From www.archer-soft.com/en/blog/technology-swift-vs-acobjective-c-pros-and-cons:

      Swift was created in order to replace Objective-C, however, Swift is capable of working alongside Objective-C while using Cocoa and Cocoa Touch frameworks.

      None of which are first party sources. Please cite one.

      Here, I'll help you out. Here is a quote from one of your own sources:
      "To quote Apple, “Objective-C is not going away, both Swift and Objective-C are first class citizens for doing Cocoa and Cocoa Touch development.”"

      You're purposely digging around Apple's own statements that Swift and Objective-C are first class citizens.

      Wait, first class citizens? That sounds a lot like what I said in an earlier reply. Hmmmmmm.

    8. Re:Even Apple is abandoning Objective-C by msobkow · · Score: 1

      The whole question of Swift vs. Objective-C is irrelevant, anyhow. The original article is asking about C++ vs. Objective-C.

      Their initial target platform is Linux, not MacOS or iOS.

      Which brings me back to my original point: Objective-C is a dead-end.

      --
      I do not fail; I succeed at finding out what does not work.
    9. Re:Even Apple is abandoning Objective-C by Anonymous Coward · · Score: 0

      Remember Java as a first class citizen on OS X? Apple may say and suggest one thing, but they have shown they will bend the way of reality.

    10. Re: Even Apple is abandoning Objective-C by maccodemonkey · · Score: 1

      Which brings me back to my original point. There are millions of lines of Obj-C out there, that will need to be maintained or improved for decades. Even if developers wanted to, Swift isn't compatible with a lot of use cases. And brand new Obj-C code is being written and shipped today by companies including Apple. Yes, Swift is a great new addition, but Obj-C will be around for few decades more.

      By no measurable metric based in reality is Obj-C dead. Obj-C is as dead as Visual C++ became when Microsoff rolled out C#, in that it's not. Multiple languages is great. This isn't some Highlanderish situation that you're trying to make it out to be.

      If OP learns Obj-C he's have a skill valuable for many many years to come. And I'm not saying that's what he should do. C++ is valuable too. But it's not a dead end, and if you say that, you really don't understand the realities of maintaining existing products, or the use cases of Swiff va, Obj-C at this point. I have projects still where Swift wouldn't be able to replace the Obj-C source entirely even if I wanted it to.

    11. Re:Even Apple is abandoning Objective-C by countach · · Score: 1

      "Apple has not shipped a single API on Mac or iOS written in Swift. "

      Apple has specifically designed Swift so that if the day comes that they are writing APIs in Swift instead of Objective-C, YOU WON'T EVEN KNOW. They have the same internal object model and memory layout. They are basically the same language with a different syntax. (Not quite, but it's not too far off).

      And while Apple might not have declared Objective-C dead, people who've seen how Apple operate before can clearly see the writing on the wall.

    12. Re:Even Apple is abandoning Objective-C by Anonymous Coward · · Score: 0

      Apple's situation right now with Obj-C and Swift looks a lot like Microsoft's situation in 2002 with C++/Win32/COM/MFC and C#/VB/.Net.

      I'd bet that in a few years, Obj-C will still be the preferred language for the guys that have been doing Obj-C all along, while the newbies and "app" developers will use Swift because it's way easier. And Obj-C will still be required for certain things, because Swift will have a pesky runtime that won't be able to handle non-runtime-friendly libraries. Welcome to P/Invoke hell, Apple developers!

    13. Re:Even Apple is abandoning Objective-C by CraigCruden · · Score: 1

      What???? As far as I was aware... Swift is language which depends on LLVM (which is not a virtual machine as in jvm). This is the same as Objective-C which is now compiled using Clang (many many years since gcc was replaced with clang). LLVM is just a pseudo assembly language which is compiled down to machine code. It is not a virtual machine. It is compiled down just like Objective-C. When using the REPL or as with Objective-C when it is being run inside xcode I believe it is in jit form, but this is no different than Objective-C.

    14. Re:Even Apple is abandoning Objective-C by david_thornley · · Score: 1

      Of course Apple hasn't said Objective-C is a dead end. There would be a revolt and a mass fleeing from the platform if they did that.

      Apple has done that sort of thing several times in the past. They may have angered some developers, but there were plenty left.

      Remember when we were supposed to use OpenDoc? Hypertalk? Java? Or haven't you followed Apple development as long as I have?

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  25. C++ - but look at C# as well by slincolne · · Score: 1, Informative
    I'll admit I haven't seen much of Objective C (apart from on OSX) - while C++ is pretty much available on anything and anywhere. However I'd also recommend having a look at C#.

    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)

    1. Re:C++ - but look at C# as well by Shados · · Score: 2

      Generally when people say compiled language, and they refer to things like Objective C and C++, they usually mean compile to as close to native code as possible. I love C#, but its fairly obvious that bytecode languages were not options this time around.

      C++/Boost is their best bet.

    2. Re:C++ - but look at C# as well by Touvan · · Score: 1

      MS is switching C# to an AOT system using their very mature C++ backend. Unity3D is doing something similar, and Xamarin does AOT on iOS already (though not through a mature C++ backend). It's still memory managed, but going forward it will be as compiled as anything else.

    3. Re:C++ - but look at C# as well by phantomfive · · Score: 2

      I'll admit I haven't seen much of Objective C (apart from on OSX) - while C++ is pretty much available on anything and anywhere. However I'd also recommend having a look at C#. If you are not allergic to Microsoft products it's got a lot to recommend it:

      But stay away from Entity Framework and Nuget. EF is slow, and Nuget....well, even Microsoft evangelists criticize it.

      Cross-platform tools like Xamarin (which as an interesting ecosystem for cross-platform mobile apps)

      If you do want to do cross-platform development, you should stay away from advanced C# features like code-contracts. In fact, if you really want to do that, then you should have at least one person developing on Linux, so you stay aware of all the little incompatibilities.

      --
      "First they came for the slanderers and i said nothing."
    4. Re:C++ - but look at C# as well by Shados · · Score: 1

      Entity Framework being slow isn't the problem with it. The performance of an ORM only really depend on 2 things. The time it takes to do the mapping, which is trivialized by the actual queries and is really a micro-optimization, and the SQL generated.

      The later is fine in almost all of the mainstream ORMs, and the only real issues come from N+1 queries, and not aggregating queries that can be by using the context and futures. ActiveRecord based ORMs have issues because of the way context vs model objects is managed but they can still handle it fine, the N+1 problem is almost always a developer thing.

      The reason Entity Framework sucks is that its API is poorly documented, so short of reading the code, no one knows how to do things correctly, a lot of its features are not exposed through the tools, thus encouraging using the RAD/shitty ways of doing things, and they pulled it in all directions trying to make everyone happy, ending up with a lowest common denominator.

      You can get perfectly good performance out of EF, it has all the features an ORM needs to achieve it. Its just hidden/awkward/changes all the time/forces you into writing shitty code.

    5. Re:C++ - but look at C# as well by phantomfive · · Score: 1

      The reason Entity Framework sucks is that its API is poorly documented

      That is true too.

      You can get perfectly good performance out of EF, it has all the features an ORM needs to achieve it.

      I don't believe it. I've worked pretty hard at it (one example, inserting a large number of rows into two tables, one that has a foreign key into the other table, can take 1000 times longer than simple SQL queries).

      --
      "First they came for the slanderers and i said nothing."
    6. Re:C++ - but look at C# as well by Shados · · Score: 1

      That will heavily depend on how you do it. If you have a 1 to N, and insert the object trees one by one, you're going to get a crazy amount of back and forth. The amount of queries will be the same, and similar to the ones you do manually, so there won't be any meaningful differences there.

      The main difference is that you're likely to do "Insert 1 in master, 5 in detail, 1 in master, 5 in detail", batching them in groups of 1 and N, when the correct way is to insert all the rows in master, then all the rows in details (batching in smaller groups if transaction size is a problem).

      EF can handle that scenario just fine. Its just not that clean.

      That's just understanding how an ORM work, and all ORMs have these issues. You get used to working around them. (You'd have a seizure seeing what Rails Active Record does, yet people use it in petabyte scenarios.)

    7. Re:C++ - but look at C# as well by phantomfive · · Score: 1

      The main difference is that you're likely to do "Insert 1 in master, 5 in detail, 1 in master, 5 in detail", batching them in groups of 1 and N, when the correct way is to insert all the rows in master, then all the rows in details (batching in smaller groups if transaction size is a problem).

      I'll try it out.

      --
      "First they came for the slanderers and i said nothing."
    8. Re:C++ - but look at C# as well by mosdave · · Score: 1

      I don't disagree about avoiding EF, but Nuget? It has its quirks, to be sure, but it mitigates way more friction than it creates. Calling Skeet's brief comment a criticism is a bit disingenuous, I think.

    9. Re:C++ - but look at C# as well by phantomfive · · Score: 1

      For almost a decade, I hadn't had a corrupt Visual Studio project file. Start using nuget, and I did. Nuget adds much more friction that it removes.

      --
      "First they came for the slanderers and i said nothing."
  26. Re: Classic? by Em+Adespoton · · Score: 3, Insightful

    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.

  27. Clear Winner by BlackHawk-666 · · Score: 2

    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.
  28. C++ important on Apple too by perpenso · · Score: 3, Informative

    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).

    1. Re:C++ important on Apple too by countach · · Score: 1

      Err, well you've got to write the core code in _something_, and why not Objective-C? You can compile it for any platform you like, and I'm a big proponent of sticking to one programming language for everything. You lose a lot by shifting between paradigms and being unable to pass objects around between different layers. Most likely Apple's iTunes for Windows is written in Objective-C and it works for them. Objective-C is a pretty thin layer around C, and at least in the old days, just preprocessed it into C, so it isn't inherently less portable than C.

    2. Re:C++ important on Apple too by BasilBrush · · Score: 1

      C++ is also important when targeting Apple.

      Not quite. Although you can compile C++ as part of an OSX or iOS project, there's no point - other than using someone else's library. The parts of projects that aren't Obj-C tend to be C.

      Why?

      You're dropping out of Obj-C for cross platform compatibility, because you're dealing with a low level Apple API, or because you want maximum speed for some part of the code. All these things are usually best served by C. If you're wanting objects at the expense of speed, then you wouldn't stray from Obj-C in the first place.

    3. Re:C++ important on Apple too by tlhIngan · · Score: 1

      Not quite. Although you can compile C++ as part of an OSX or iOS project, there's no point - other than using someone else's library. The parts of projects that aren't Obj-C tend to be C.

      Why?

      You're dropping out of Obj-C for cross platform compatibility, because you're dealing with a low level Apple API, or because you want maximum speed for some part of the code. All these things are usually best served by C. If you're wanting objects at the expense of speed, then you wouldn't stray from Obj-C in the first place.

      Technically, you can just call C code straight from ObjC - ObjC code compiles C code just fine (unlike C++, which cannot compile C code).

      Whether that code is in the same file or different doesn't matter - ObjC is a superset of C.

    4. Re:C++ important on Apple too by swillden · · Score: 1

      You're dropping out of Obj-C for cross platform compatibility, because you're dealing with a low level Apple API, or because you want maximum speed for some part of the code. All these things are usually best served by C.

      Cross-platform compatibility of C++ code is excellent these days, C++ can call low-level Apple APIs exactly as well as C, and there is no performance cost to C++ unless you choose it.

      Unless you're concerned that you may need to target a platform not supported by a decent C++ compiler (which is really rare, given that gcc is basically everywhere), the only reason to choose C over C++ is personal preference or concern that some of the users of the code may not know C++.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    5. Re:C++ important on Apple too by perpenso · · Score: 1

      You lose a lot by shifting between paradigms and being unable to pass objects around between different layers.

      That is not my experience. It feels quite natural and automatic to think Obj-C when doing UI code and think C++ when doing core code. Plus passing objects around seems a non-issue. One can use C++ structures and classes in Obj-C code and Obj-C objects tend to be those interfacing with the UI code, objects of no interest to the core code. And if an Obj-C object is input from the user its trivial to convert to an ordinary UTF8 string, int, etc.

      Most likely Apple's iTunes for Windows is written in Objective-C and it works for them.

      That assumes one uses the gnu toolchain. When I write portable code I like to build it in Apple Xcode, MS Dev Studio and with GNU. Different warning can be useful and well as running regression tests on output from these three different code generators.

    6. Re:C++ important on Apple too by BasilBrush · · Score: 1

      Cross-platform compatibility of C++ code is excellent these days, C++ can call low-level Apple APIs exactly as well as C, and there is no performance cost to C++ unless you choose it.

      1) Good but not as good as C.
      2) But it's an unnecessary third layer. Obj-C has the objects. C has the speed and compatibility. What do you need a third layer for?
      3) Indeed. So virtually no one uses it in this scenario.

      Only time I see it used is when it's a library that was written in C++ on another platform and is simply being used on a Mac.

    7. Re:C++ important on Apple too by perpenso · · Score: 1

      All these things are usually best served by C.

      Untrue. As far as my C++ code goes its kind of "light" on the use of templates, classes, etc. I don't use them because they are available, I use them when they make sense. My code is sort of C'ish in this respect.

      If you're wanting objects at the expense of speed, then you wouldn't stray from Obj-C in the first place.

      Untrue. Obj-C is not as portable as C++. Even when not targeting MS Windows I like to compile the core code and run regression tests using MS Dev Studio. Yet another set of warnings, yet another code generator to help spot bugs. Plus I also tend to write code so that someone else can eventually maintain it. Obj-C is a niche language, C++ has a much broader user base.

      There really is no downside to using C++ in core code rather than Obj-C.

    8. Re:C++ important on Apple too by BasilBrush · · Score: 1

      Obj-C is not as portable as C++

      And C++ isn't as portable as C. Or as efficient.

      There really is no downside to using C++ in core code rather than Obj-C.

      But there are downsides to using it in this capacity rather than C. Which is why few do so.

    9. Re:C++ important on Apple too by david_thornley · · Score: 1

      You can run standard C++ on any modern general-purpose processor. It doesn't have a standard ABI, which C has in practice, but if you're writing your code you just use one C++ compiler and you're fine. Technically, C is more portable. If you're talking about programming a computer or a phone or something like that, it's just as portable.

      C++ can be written as efficiently as C, since you can make any C program into C++ with minor changes. C++ also has facilities that make it easier to write efficient code than in C; std::sort is not only easier to use than qsort(), it's more efficient.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    10. Re:C++ important on Apple too by swillden · · Score: 1

      Cross-platform compatibility of C++ code is excellent these days, C++ can call low-level Apple APIs exactly as well as C, and there is no performance cost to C++ unless you choose it.

      1) Good but not as good as C.

      In most cases these days it's a distinction without a difference.

      2) But it's an unnecessary third layer. Obj-C has the objects. C has the speed and compatibility. What do you need a third layer for?

      I see this differently. Obj-C has the objects I need to interact with the framework. C++ has the speed, compatibility and expressive power I want. C has speed and compatibility, but lacks expressive power, which creates a lot of tedium and loses a lot of safety.

      3) Indeed.

      We agree on something :-)

      So virtually no one uses it in this scenario.

      Only time I see it used is when it's a library that was written in C++ on another platform and is simply being used on a Mac.

      I haven't really done much on Macs, but I did a lot of work on NeXTstep back in the day, and C++ was quite common in scientific computing there. Actually, what I saw a lot of was "Objective-C++"... they may have grown further apart, to the degree that this no longer works, but in the early 90s gcc allowed you to mix Objective-C and C++ constructs freely in the same code. So a common approach was to build everything in an OO fashion, but to choose between Objective-C and C++-style classes based on performance and flexibility tradeoffs. The result required you to be fluent in both, but that really just means being fluent in C++ because a C++ programmer can learn Objective-C in a day (which is something I respect about the language).

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    11. Re:C++ important on Apple too by perpenso · · Score: 1

      Obj-C is not as portable as C++

      And C++ isn't as portable as C.

      Straw man, the question is Obj-C v C++ not C++ v C. And for nearly any practical sense you are mistaken, its rare to find an environment that has C support but not C++.

      Or as efficient.

      Speaking as an assembly language programmer, you have been misinformed. Can C++ classes and templates be misused, absolutely, but that is a programmer's error not the language's. Can an STL class be overkill, yes, but the STL is about convenience and correctness not performance, and a programmer's misuse of such a library is another programmer's error.

      **IF** and when it matters code can be written in a C'ish manner, possibly with minor use of classes or templates, and the generated code will not suffer. To be honest when dealing with extremely time critical code if C++ is going to be replaced I will replace it with assembly.

      Limiting your options to C in the non-time critical portions of you code is completely unnecessary. You can write the C'ish code I mentioned above or you can write pure C code if you with for the minor amount of code that is time critical.

      There really is no downside to using C++ in core code rather than Obj-C.

      But there are downsides to using it in this capacity rather than C. Which is why few do so.

      Again, a straw man, and again you have been misinformed with respect to C++'s usage. Ex: "C++ is the main development language used by many of Google's open-source projects." http://google-styleguide.googl...

    12. Re:C++ important on Apple too by BasilBrush · · Score: 0

      Speaking as an assembly language programmer

      You can't claim authority here. I was programming assembler as far back as 1983.

      Can C++ classes and templates be misused, absolutely, but that is a programmer's error not the language's.

      What you mean by "misused" here is using the C++ parts of C++. Because if you do, you will almost certainly be slower than C. For example virtual functions require an extra level of indirection over C function calls.

      **IF** and when it matters code can be written in a C'ish manner, possibly with minor use of classes or templates, and the generated code will not suffer.

      And when it doesn't matter then no need to stray from Obj-c. There's no reason to have 2 OO languages in a project.

      Again, a straw man, and again you have been misinformed with respect to C++'s usage. Ex: "C++ is the main development language used by many of Google's open-source projects."

      Shut the fuck up. I've already said more than once that the only reason people use C++ in iOS or OSX projects is when they are leveraging a library that's in C++.

    13. Re:C++ important on Apple too by perpenso · · Score: 1

      Speaking as an assembly language programmer

      You can't claim authority here. I was programming assembler as far back as 1983.

      Me too, 6502 (Apple II, C64) and PDP-11. 68K too via Apple II coprocessor boards, maybe that was '84. Its how we did our earliest Mac development, couldn't afford a Lisa. Eventually 68K on Mac once native development was an option. And a ton of x86 throughout the late 80s and 90s, less so in the 2000s. A little bit of PowerPC in the 2000s too. Recent years just doing it for fun or looking at the generated code from compilers.

      Can C++ classes and templates be misused, absolutely, but that is a programmer's error not the language's.

      What you mean by "misused" here is using the C++ parts of C++. Because if you do, you will almost certainly be slower than C. For example virtual functions require an extra level of indirection over C function calls.

      You are wrong, doubly wrong actually.
      (1) If the class is not using inheritance you don't get the indirection.
      (2) If you need the abstraction/indirection then you are simply doing your own indirection manually in C code. Been there, done that, in the late 80s when C++ was too new and object oriented methodologies would greatly benefit the application at hand.

      **IF** and when it matters code can be written in a C'ish manner, possibly with minor use of classes or templates, and the generated code will not suffer.

      And when it doesn't matter then no need to stray from Obj-c. There's no reason to have 2 OO languages in a project.

      I've proven this wrong already. Read past posts regarding portability, ex MS Dev Studio.

      Again, a straw man, and again you have been misinformed with respect to C++'s usage. Ex: "C++ is the main development language used by many of Google's open-source projects."

      Shut the fuck up. I've already said more than once that the only reason people use C++ in iOS or OSX projects is when they are leveraging a library that's in C++.

      You missed the point. Its not that google is using C++ libraries, its that they are writing their libraries in C++. Plus you are doubly wrong again since people also use C++ in Apple targets for portability.

    14. Re:C++ important on Apple too by BasilBrush · · Score: 1

      For example virtual functions require an extra level of indirection over C function calls.

      You are wrong, doubly wrong actually.
      (1) If the class is not using inheritance you don't get the indirection.

      If you're not using inheritance then you won't use a virtual function. (Did you read what I wrote?)

      If you need the abstraction/indirection then you are simply doing your own indirection manually in C code.

      Not necessarily. Just because you might do things with objects in C++ doesn't mean the code would be written as pseudo objects in C.

      You missed the point. Its not that google is using C++ libraries, its that they are writing their libraries in C++.

      Portable libraries. It makes no fucking difference whether the library was written within the same conglomerate.

      Plus you are doubly wrong again since people also use C++ in Apple targets for portability.

      Are you hard of thinking? That was the one exception I made. Using portable libraries. However if the library intended to be portable starts on OSX, then it's virtually always written in C.

    15. Re:C++ important on Apple too by perpenso · · Score: 1

      For example virtual functions require an extra level of indirection over C function calls.

      You are wrong, doubly wrong actually. (1) If the class is not using inheritance you don't get the indirection.

      If you're not using inheritance then you won't use a virtual function. (Did you read what I wrote?)

      Yes, I'm rejecting the notion that C++ code inherently involves inheritance. Note my reference to minor use classes and templates being quite useful and not performance hindering.

      You missed the point. Its not that google is using C++ libraries, its that they are writing their libraries in C++.

      Portable libraries. It makes no fucking difference whether the library was written within the same conglomerate.

      It however does disprove you claim that C++ isn't being used to a large degree.

      Plus you are doubly wrong again since people also use C++ in Apple targets for portability.

      Are you hard of thinking? That was the one exception I made. Using portable libraries. However if the library intended to be portable starts on OSX, then it's virtually always written in C.

      I'm not referring to libraries, I'm referring to the app's core code itself.

      Also many libraries are merely C for legacy reasons. For new code, refer to Google's use of C++ again.

  29. Teenagers by Anonymous Coward · · Score: 1

    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!

  30. C++ is a safe bet by Anonymous Coward · · Score: 0

    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.

  31. Good ties in FOO by manu0601 · · Score: 2

    Submitter wants a "widespread compiled language that has good ties into FOSS".

    What about plain old C? Otherwise, second best choice seems C++

  32. C++ is a good bet by Anonymous Coward · · Score: 0

    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.

  33. C++ by amightywind · · Score: 0

    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
  34. Objective C, of course by Anonymous Coward · · Score: 0

    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.

    1. Re:Objective C, of course by Anonymous Coward · · Score: 1

      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.

      Then you never programmed in EDL for the IBM Series/1. EDL was an interpreted Assembler. Written for a machine that combined all the worst features of the PDP/11 and System/360. "Bank switched memory? Why yes sir!".

    2. Re:Objective C, of course by Anonymous Coward · · Score: 0

      Easy now, I used EDL and it was not too bad, back when choices were much more limited. The memory partitions weren't that bad - you could have multiple copies of the same program running, communicating with each other. Kind of like virtual machines...

  35. Headless applications in Objectionable-C? by Lumpio- · · Score: 1

    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.

  36. Cross platform development. by Savage-Rabbit · · Score: 2

    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
    1. Re:Cross platform development. by drinkypoo · · Score: 1

      ntegrating 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.

      Poster is looking to find out which one language to use, so your suggestion is out of line. However, it's probably the most useful and informative text in this whole thread. (There have been some other mentions of the same fact, but none of them have been as explicit.) Here's the upshot: If you want to be able to use your code elsewhere in the future, use C++. Which means, basically, you'd have to be insane and/or sociopathic to use ObjC. It may cause you problems, and it will certainly cause anyone else problems in the future.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  37. Wrong two choices by thisisauniqueid · · Score: 2

    This is like asking "which medical technique should I use for treating headaches, trepanning or inhaling mercury vapors?"

  38. I'd go for C by Zobeid · · Score: 4, Interesting

    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.

    1. Re:I'd go for C by RightwingNutjob · · Score: 0

      Jeez, why all the hate for C++. It's a wonderful language when you use it correctly (ie don't pretend its java). And as a wise man once said, a determined Real Programmer can write FORTRAN programs in any language.

    2. Re:I'd go for C by Anonymous Coward · · Score: 0

      You CAN do OOP in C but it looks horrible. Jusst look at all the casts in gtk code. If you're going to do OOP, why would you not use a language that gives you the proper syntatic sugar for it?

    3. Re:I'd go for C by halivar · · Score: 1

      C, on the other hand, is eternal and evergreen.

      Yeah, but at this point, isn't C++ also? C predates C++ by 10 years, but that gap looks smaller and smaller as time goes by, and both are in continue active development and use.

  39. Object Pascal by Anonymous Coward · · Score: 0

    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.

  40. What is the goal? by 140Mandak262Jamuna · · Score: 1
    Why do you want to learn a classic object oriented compiled language?

    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
  41. The best of both worlds! by Yaztromo · · Score: 1

    Objective-C++!

    (Yes, there is such a thing. And yes, I'm being facetious.)

    Yaz

    1. Re:The best of both worlds! by Drishmung · · Score: 1

      Well then, why not Object Oriented COBOL? (In COBOL idiom, ADD 1 TO COBOL GIVING COBOL.)

      --
      Protoplasm. Quiet Protoplasm. I like quiet protoplasm.
  42. Not hating on C++, but something to consider by Anonymous Coward · · Score: 1

    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.

  43. both? by shadowrat · · Score: 1

    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.

  44. Give up. by Anonymous Coward · · Score: 0

    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,

  45. C++ is superior: more strongly typed by Chuck+Messenger · · Score: 1

    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!

    1. Re:C++ is superior: more strongly typed by WorBlux · · Score: 2

      And haskell is about 10/10, being able to expressively type functions, and make custom types. Point being some may find 7/10 good enought to catch stupid errors, while letting the code be a bit terser and more readable. I'm not sure the tradeoff is at the couple hundred lines territory, as there are often ways to add in additional type restriction in dynamicly typed languages, and you may just want to start with a quick and dirty prototype as a template for the final version.

    2. Re:C++ is superior: more strongly typed by Required+Snark · · Score: 2

      Actually, Haskell goes all the way to 11,

      --
      Why is Snark Required?
    3. Re: C++ is superior: more strongly typed by dirthead · · Score: 1

      Ruby is very strongly typed. It is just lazy about it.

    4. Re:C++ is superior: more strongly typed by david_thornley · · Score: 1

      You seem to be advocating not only strong but static typing, which are different things. Any Common Lisp entity knows what type it is, for example, and you can't say that about C++. However, the C++ compiler knows what type something is, while in Common Lisp that's optional.

      A really strong static type system is incompatible with C++'s OO system, in that, given a Base and Derived class, the compiler won't know if a Base * is a Base * or a Derived *, and that's essential for polymorphism.

      Most of C++'s type weaknesses were inherited from C. If you avoid C-style casts and unions (usually only necessary in fields where type safety is not a concern), C++'s type safety increases markedly.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    5. Re:C++ is superior: more strongly typed by Chuck+Messenger · · Score: 1

      Are you referring to dynamic typing? In my (perhaps simplistic) view of the world, there is dynamic typing and static typing. "Strong" typing, to me, is static typing.

      What other kind of typing is there? I'd be interested to hear about Common Lisp's class system, which seems to be in-between static and dynamic somehow.

      I agree with you about C++'s weakness (one example) - that you need to use a pointer (uggghh!) in order to get polymorphism. That's an example of why C++ doesn't score a 10/10 on the scale.

  46. Which to choose by crbowman · · Score: 1

    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.

    1. Re:Which to choose by david_thornley · · Score: 1

      You can't learn object-oriented programming as a way of thinking in a month. At least I couldn't come within an order of magnitude of that, and I'm very good at picking up new programming ideas.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  47. Ada 2012 by darkwing_bmf · · Score: 1

    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/

    1. Re:Ada 2012 by Anonymous Coward · · Score: 0

      Astoundingly solid choice. Might be better to start with Ada 95 though and work up from there for better gcc support. Also Ada 2005 and 2012 can pull in things that depend on a particular run time, while 95 and earlier are great languages for playing on bare metal. The quality of documentation on the language though is astounding. The rationale document especially makes it clear WHY the language works as it does.

  48. ObjC++ by staalmannen · · Score: 1

    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?

  49. Why? by Anonymous Coward · · Score: 1

    Don't use OOP at all.

  50. Choose Something Else for Headless by Anonymous Coward · · Score: 0

    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?

  51. choose your lens mount carefully by epine · · Score: 1

    You can always find another language that is better at it on every single aspect you look at. Jack of all trades master of none.

    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).

  52. you can do osx and ios in c++ by Anonymous Coward · · Score: 0

    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.

    1. Re:you can do osx and ios in c++ by CraigCruden · · Score: 1

      You have your history mixed up. They are different directions from the same root language, but Objective C is not a "superset" of C++. C++ (preprocessor for C) started as C with Classes. Objective C was originally a preprocessor for C which tried to patch in Smalltalk ideas ontop of C. One is not a superset of the other... but they both have the same C roots. It is not much different than having all the different languages compile down onto the jvm, they are not supersets or subsets of each other - they just use the jvm. It provides a transportable platform onto which to compile/run the "compiled code". Creating preprocessors on top of C gave similar advantages to both of these "new languages".

    2. Re:you can do osx and ios in c++ by david_thornley · · Score: 1

      C++ never was a C preprocessor. The transformations were too complex for that. Cfront was a compiler that compiled early C++ to C, and passed on a lot of stuff intact. See Stroustrup, The Design and Evolution of C++.

      Objective-C was a strict superset of standard C (at least back then; I haven't followed C evolution since C99). Its extensions were strictly syntax errors in C. C with Classes (later to become C++) was never a strict superset, as, among other things, it made "class" a keyword. The fact that the differences between C and Objective-C are so different from C syntax meant that they could be added to C++, making Objective-C++.

      The O-O approaches are different. Objective-C was intended to put the Smalltalk O-O system into C, while C with Classes took O-O features from Simula and added them to C. Then, C++ started evolving into something considerably different that was mostly backwards compatible.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    3. Re:you can do osx and ios in c++ by CraigCruden · · Score: 1

      "Cfront was a compiler that compiled early C++ to C"

      "A preprocessor is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers."

      It is a preprocessor. It might be an advanced one, but it is still a preprocessor.

    4. Re:you can do osx and ios in c++ by david_thornley · · Score: 1

      In which case the compilers in gcc were preprocessors (at least way back when), since they created assembly-language code that went to as. Java is a preprocessor, since it compiles to JVM code which is either interpreted or compiled. Any front end for LLVM is a preprocessor, since they create intermediate code that will be transformed to executables by another program.

      In other words, I think your definition of preprocessor is far too general to be really useful.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    5. Re:you can do osx and ios in c++ by rjh · · Score: 1

      Cfront worked by translating C++ into C, which was then run through a C compiler. As such, cfront had to be abandoned in the early 90s because there were certain syntactic structures that simply couldn't be expressed in a reasonable amount of C source code.

      The original poster is (mostly) correct. Cfront was a compiler only in the sense that it did a transform of one language (C++) into another (C). It was not a compiler to any extent beyond that; compiling to native code was left up to the system C compiler.

      Where the original poster is wrong is calling C++ a "preprocessor for C". That's a reasonably-correct way to describe one early implementation of a C++ compilation system, but it's not an accurate way to describe the language itself.

    6. Re:you can do osx and ios in c++ by david_thornley · · Score: 1

      Cfront was only a preprocessor if your definition includes a full parse. Cfront compiled early C++ into C. From Stroustrup, Design and Evolution of C++, page 67:

      Cfront was (and is) a traditional compiler front-end that performs a complete check of the syntax and semantics of the language, builds an internal representation of its input, analyzes and rearranges that representation, and finally produced output suitable for some code generator.

      So, if you're happy calling a compiler front end a preprocessor, then, yes, Cfront was a preprocessor, and javac also a preprocessor. I still don't think that's a useful definition of the word.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  53. Sigh by Cafe+Alpha · · Score: 3, Interesting

    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.

    1. Re: Sigh by Anonymous Coward · · Score: 0

      I agree with you. Most of the languages today are not that great, especially with the push into functional programming everywhere. I suspect this is simply because many developers get easily locked into a platform and don't like the idea of having to learn something new. Personally I quite like the Python/C hybrid. You write in a very high level langauge for most stuff, and then you can dip down into C for the parts that need optimising.

  54. go by Anonymous Coward · · Score: 0

    For system programming, use go.

  55. The Rust Language by Trevelyan · · Score: 4, Interesting

    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.

  56. Re:Abandoning Objective-C is a bad choice of words by CraigCruden · · Score: 1

    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.

  57. Re:I have done lots of both and say C++ absolutely by countach · · Score: 1

    The [[[][]]][] in Objective-C are an extremely simple concept to grasp. The same can't be said for all the >< in C++.

  58. I should think the choice is obvious by DrXym · · Score: 1

    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.

  59. Objective-C is a mongrel by Theovon · · Score: 1

    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).

  60. Re: Classic? by dargaud · · Score: 1

    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 ?
  61. Silly Dichotomy by ChaoticCoyote · · Score: 1

    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.

  62. Neither. Java. by drolli · · Score: 1

    Java is nowadays a "classic" compiled OOP language.

  63. Re:I have done lots of both and say C++ absolutely by Anonymous Coward · · Score: 0

    Come to Lisp, we have ()(((()))(())))()

  64. A variant of C++ by Misagon · · Score: 1

    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
  65. C++ All The Way by ClayDowling · · Score: 1

    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.

  66. * 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.

  67. Good ties into FOSS? Battle won by suy · · Score: 2

    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.

    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.

  68. Re: Classic? by david_thornley · · Score: 1

    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
  69. Then, How Best To Learn? by WheezyJoe · · Score: 1

    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...
    1. Re:Then, How Best To Learn? by Dutch+Gun · · Score: 1

      I think this question has been answered pretty well on Stack Overflow. C++ is too deep and complex to learn from a few web tutorials of unknown quality. Get a good tutorial book and just follow along - that's how I learned it. Then get a good reference book for more in-depth knowledge as you move past the basics.

      Anything that at least covers C++ 11 is fine, as C++ 14 was more about some minor tweaks that you can learn on your own.

      Be careful about learning bad habits from C++ code examples you find on the web, or in older projects. Essentially, if you see the code using new, delete, and raw pointers, it's likely outdated. You may still need these on occasion, but their use is vanishingly rare in modern C++.

      --
      Irony: Agile development has too much intertia to be abandoned now.
  70. Re:I have done lots of both and say C++ absolutely by EmperorOfCanada · · Score: 1

    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.

    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:

    // 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
    int GetUserIDFromUserName(string username)
    {
    //Set the user_id to its default value
    int user_id=0;
    .... some kind of username lookup ...
    //When complete return the user's id if any matches found. Otherwise return -1
    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.

  71. Smalltalk by DanielOom · · Score: 1

    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.

  72. Both, of course by slickrockpete · · Score: 1

    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.

  73. There is no doubt about that ... by Anonymous Coward · · Score: 0

    ... Delphi !!!

  74. Re: Classic? by Em+Adespoton · · Score: 1

    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.

  75. C++ on Linux by iamacat · · Score: 1

    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.