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

52 of 407 comments (clear)

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

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

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

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

    8. 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
    9. 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
    10. 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.

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

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

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

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

  5. 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 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. 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 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.
  7. Go Old School by radams217 · · Score: 2

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

  8. 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
  9. 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 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?
  10. 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.

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

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

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

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

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

  17. 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
  18. 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?"

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

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

  21. 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."
  22. 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
  23. 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.

  24. Re:C++ is superior: more strongly typed by Required+Snark · · Score: 2

    Actually, Haskell goes all the way to 11,

    --
    Why is Snark Required?
  25. 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.

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

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