Ask Slashdot: Which Classic OOP Compiled Language: Objective-C Or C++? 407
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.)
c++? (Score:4, 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.
Re:c++? (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.
Re: (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.
Re: (Score:2)
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;
}
Re: (Score:2)
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.
Re: (Score:3)
"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 lumbe
Re: (Score:2, 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.
choose your lens mount carefully (Score:2)
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 wor
Re: (Score:3)
First, WindowsMaker doesn't use Objective-C, it's written in C. However, GNUstep [gnustep.org], 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+
Re: (Score:3)
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
Re:c++? (Score:4, Informative)
Actually, they use it for its dynamic binding and loading, but don't let facts [apple.com] get in the way of your FUD!
Re: (Score:3, Informative)
Actually, they use it for its dynamic binding and loading, but don't let facts [apple.com] 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.
Re: (Score:2)
Actually, they use it for its dynamic binding and loading, but don't let facts [apple.com] 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.
Re:c++? (Score:5, Informative)
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.
Re: (Score:3)
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 imple
Re: (Score:3)
> 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 a
Re:c++? (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.
Re: (Score:3)
Could Objective-C evolves, now that the pope is no more ?
Nope, it was swiftly replaced after his demise.
C++ is the only logically option (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.
Re:C++ is the only logically option (Score:4, Insightful)
Re: (Score:2)
I knew that would get voted down. Let's just say I'm in good company [stlport.org].
Re: (Score:2)
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.
Re: (Score:2)
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.
Re: (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.
C++ important on Apple too (Score:4, 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).
Java (Score:4, Funny)
I don't expect any contrary opinions here on /.
Re: (Score:3)
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?
Re: (Score:2)
Re: (Score:3, 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.)
Re: (Score:2)
... There are things it just isn't well suited for...
Like writing computer programs?
Re: (Score:2)
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.
Re: (Score:2)
Some time ago I was working for a comp
C++, C++, C++ (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.
Objective C (Score:2, Insightful)
Re:Objective C (Score:4, 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.
Re: (Score:3, Interesting)
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
Re: (Score:2)
Never tried SmallTalk?
Re: (Score:2)
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.
Re: (Score:2)
Re: (Score:2)
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.
False choice (Score:2)
Go Old School (Score:2)
Objective-C is a lot of work (Score:5, 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)
C++ is probably a little bit better (Score:5, 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.
Re: (Score:2)
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
Re: (Score:3, Insightful)
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
Re: (Score:2)
>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
Why not Pascal? (Score:5, 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.
I have done lots of both and say C++ absolutely. (Score:2)
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++.
Who cares (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.
Even Apple is abandoning Objective-C (Score:5, 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.
Re:Even Apple is abandoning Objective-C (Score:5, 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.
Re: (Score:2)
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
Re:Even Apple is abandoning Objective-C (Score:4)
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?
Re: (Score:2)
http://ask.slashdot.org/story/14/11/28/2148254/ask-slashdot-objective-c-vs-swift-for-a-new-ios-developer [slashdot.org]
http://ask.slashdot.org/story/14/09/26/2247211/ask-slashdot-swift-or-objective-c-as-new-ios-developers-1st-language [slashdot.org]
From http://www.raywenderlich.com/74138/swift-language-faq [raywenderlich.com]:
From www.archer-soft.com/en/blog/tec [archer-soft.com]
Re: (Score:2)
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.
Re: (Score:2)
http://ask.slashdot.org/story/14/11/28/2148254/ask-slashdot-objective-c-vs-swift-for-a-new-ios-developer [slashdot.org]
http://ask.slashdot.org/story/14/09/26/2247211/ask-slashdot-swift-or-objective-c-as-new-ios-developers-1st-language [slashdot.org]
From http://www.raywenderlich.com/74138/swift-language-faq [raywenderlich.com]:
From www.archer-soft.com/en/blog/technology-swift-vs-acobjective-c-pros-and-cons [archer-soft.com]:
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.
Re: (Score:2)
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.
Re: Even Apple is abandoning Objective-C (Score:2)
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 rolle
C++ - but look at C# as well (Score:2, Informative)
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)
Re: (Score:3)
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.
Re: (Score:2)
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.
Re: (Score:3)
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 [youtube.com] 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.
Re: (Score:2)
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
Re: (Score:2)
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).
Clear Winner (Score:3)
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.
Good ties in FOO (Score:3)
Submitter wants a "widespread compiled language that has good ties into FOSS".
What about plain old C? Otherwise, second best choice seems C++
I'd go for C (Score:5, 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.
Headless applications in Objectionable-C? (Score:2)
Cross platform development. (Score:3)
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 [wikipedia.org] 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).
Wrong two choices (Score:3)
What is the goal? (Score:2)
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
The best of both worlds! (Score:2)
Objective-C++!
(Yes, there is such a thing. [archive.org] And yes, I'm being facetious.)
Yaz
Re: (Score:2)
both? (Score:2)
my
C++ is superior: more strongly typed (Score:2)
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 flexi
Re: (Score:3)
Re: (Score:3)
Which to choose (Score:2)
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.
ObjC++ (Score:2)
Sigh (Score:4, 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.
The Rust Language (Score:5, Interesting)
In the last few months Rust [rust-lang.org] 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 [rust-lang.org].
Good ties into FOSS? Battle won (Score:3)
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.
C++14 != C++98 (Score:4, Interesting)
Re: C++14 != C++98 (Score:2)
And almost as hard to read as perl.
Re: (Score:2)
Re: C++14 != C++98 (Score:5, Funny)
Re: (Score:2)
1972 called, they're still pissed you returned their 'write-only memory' joke in such poor condition.
Re: (Score:2)
1964 called. They want their APL manual back, along with the "write-only language" jokes.
Re: (Score:2)
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.
Re: (Score:2)
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.
Re: (Score:2)
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?
Re: (Score:2)
Re: (Score:2)
khellendros1984 gave the link to the Stepanov interview, but there's also this [cat-v.org] and this [lucacardelli.name] and this [cat-v.org] 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
Re: (Score:2)
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
Re: (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
Re: (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.
Re: (Score:2)
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
Re: (Score:2)
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.
Re: (Score:2)
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.