tags:

views:

1161

answers:

14

One thing I've really been meaning to get back into is C++ programming but I am not sure if I should go back to C++ (which I have some basic console programming knowledge) or should I look into C or Objective C? I'm looking at the long term as well as ease of coding such as good editors, compilers, etc as well as which would be the quickest to get set up and running.

To go along with that, what software would you suggest for working with a suggested language?

[EDIT]

A few people have made mention that it is hard to suggest something when I never said what I was doing. I don't have any specific program in mind at the moment, I'm just looking at starting with one of these three languages for either long-term investment and work or as a jumping point to something else.

+4  A: 

If you think Apple is going to rule the world someday, Objective C.

Right now I think iPhone Cocoa development is where it's at. So, Obj-C, personally.

bpapa
+7  A: 

If you're working primarily on Windows, I'd suggest C++. Microsoft is putting a lot of work behind the new C++/CLI and the native C++ compiler. With the new TR1 and C++0X additions, a lot of the issues that have existed in the past are being addressed.

Eclipse
+4  A: 

I'd say - pick any language you like and stick with it for a while. In the meantime focus on algorithms. These are the building blocks of programs. The language is just a language.

If you've learned/mastered one it's just a question of some weeks to switch to something different, especially if you stay in the same familiy of languages (e.g. C, C++, Objective C, Java, C# ect..)

Nils Pipenbrinck
A: 

If you want to focus only on Windows operating system , then I suggest that directly start with C# (.Net Framework)

goths
Although Mono is one version number behind Microsoft, they're actually doing a very good job. This is to say: C# works very well on non-Windows platforms too!
Thomas
Depends what you are doing on the windows operating system. There's still applications where C# wouldn't be appropriate.
Doug T.
Not sure why this has been voted down so hard .. there's a lot to be said for a VM-based language with garbage collection.
pjc50
+1  A: 

Depends on what you're doing. If I had to choose one, I'd say C++. It's more cross-platform than Obj-C and less of a pain than C. But if you're doing Mac programming, you would want to know Objective-C. If you're doing any embedded programming or any kernel hacking, you'd probably want to use C.

Jason Baker
+3  A: 

You can disregard any answer that didn't first ask what you'll actually be doing. Without that information, the answer is either wrong, misleading or simply irrelevant.

Loren Segal
+1  A: 

Is there a reason why not go with C++ and go with C or Objective C instead? C++ has nowadays by far the widest community, largest existing codebase, and is best featured of all three. If you do not think that's true, please clarify (seriously, I am really interested).

Besides, C++ is the only one being supported by MS in terms of .NET (if you plan to migrate to .NET one day, of course).

petr k.
+1  A: 

Start with C, then maybe extend your knowledge to C++ if you need object orientation. Objective C is an obscure thing like like Apple Script that only Apple developers have ever heard of (if any), you won't get far with that language (no offense to fans of that language).

C is pretty easy to learn (compared to C++) and you have a good basis knowledge for any other language you might want to learn later (especially C++).

Regarding the answer from Loren Segal, what you want to do doesn't matter when you want to choose between C and C++. It's just a matter of preference. Both have the libraries for everything (since C++ libraries are often just object oriented wrappers around C libraries), both have a huge community, stable IDEs and compilers.

jkramer
+5  A: 

I can really only speak of C and C++. Learning either wouldn't hurt, if for the only reason that so much legacy code is in C and C++.

Pure C is often the only option for operating systems, driver development, or embedded development environments. Other uses include times when performance is very critical-- where you want to be as "close" to the internals of the machine as possible. It never really hurts to know C because these applications of it don't seem to be going away anytime soon. C is also the "lingua franca" for a lot of *nix applications. So if you want to contribute to a lot of open source projects (apache/svn/cvs/etc), knowing C would be a requirement.

C++, in my experience, is used when you would like to be "close to the machine" as when coding for C, but you would like the option of including higher levels of abstraction via some OOP. C++'s major strength (and biggest weakness) is that its multi-paradigm. It gives you almost all the stuff you can do in C plus lots of Object-Oriented features. For example, you could reuse lots of super-optimized C code as needed while creating classes, doing inheritance/polymorphism-- as much "object-orientedness" as you want. There's even ways to throw in some functional programming into the mix...

C++ is often criticized as trying to be too many things to too many people. As an attempt to do everything, critics say, its not very good at any one thing. C++ used to be the "lingua franca" for desktop applications, but Java and .Net have really taken a lot of Enterprise users away. Still, many applications that care both about performance and using the huge amount of additional, useful, usually good-enough-for-your-purposes features only available in C++ will choose C++.

Doug T.
+1  A: 

Intel is investing a lot in C++ libraries for running against their processors. Since Intel seems to be dominating the PC processor world lately, it seems like a decent choice.

Josh McAdams
+4  A: 

My take:

Of the three choices you've displayed, your best initial bet is probably C. Once you know C, have a handle on its quirks and are proficient in it, learning C++ or Objective-C will most likely be fairly trivial. (Your hardest points there will be in the object orientation side of the world.)

At the moment, Objective-C is used most frequently on Macs, but there are some who forget that GNU tools exist for Objective-C, and that is supported in GNUStep as well. (The current Mac OS X is based heavily on the old NextSTEP, of which GNUStep is more or less a clone.) The thing about Objective-C, however, is that it's not widely used outside those two environments -- making it something of a narrow environment. (And with Obj-C, like just about any other modern OO language, you'll spend much more time learning the framework classes than the actual underlying syntax/lexical rules.)

I'm primarily a C# developer. That pays my bills, and does so nicely. C# wasn't on your list, and I suspect I know why: It sounds like you're looking to be closer to the metal, less abstracted away. I get that -- and I think it's the right choice for long-term career growth. I started with umpteen abstractions between my code and the box (first professionally with Java, then VB6, then .NET), and as a result, I now am working hard in my spare time to play "catch up" with the rest of the world -- I'm currently going through the K&R book. Admittedly, I have no professional need to get that close to the metal -- but I do feel a personal need to understand the machine as best I can.

(Plus, ironically, I'm looking at getting back into Cocoa development via Objective-C. I used to putter around in it years ago, and I think I'm better positioned to "get" it now ... I personally feel that foreknowledge of C will make moving into Objective-C much easier, smoother, and make me less likely to introduce disastrous memory-related bugs in my code!)

At the end of the day, I think having the pre-existing knowledge of C (while it wasn't, obviously, necessary for me!) is a Very Good Thing, and probably makes moving to other languages over time (which you will do, unless you do OS, driver or embedded work) easier and smoother. I'm not saying "you can't get by without it," I'm saying that based on the way your question was phrased ... I think it's the right answer for that scenario.

John Rudy
A: 

Pure C is a good basic to have no matter what other programming language you then focus on. Objective-C in particular is just basic C code with smalltalk ideas sprinkled on top. Even though C++ ventures far from C it still is, in my view, clear that C is the most useful language to know. In Objective-C you often drop down to C. In Ruby, Python, Erlang and countless other languages you also often go into C mode. It's also a language you can always count on being able to use on every computer you touch.

So it is my personal view that every programmer really should know C. At least a little bit.

Jon Gretar
+2  A: 

I look at your question slightly differently and would ultimately suggest that you learn Objective-C. I have a couple of reasons for this.

One, Obj-C has a very different way of looking at the OO model as its generally implemented in languages like C++. Obj-C is based upon Smalltalk and as such all "method calls" are implemented as messages sent to the appropriate object. Because of this programmer's have been able to extend this into some very interesting, and quite powerful, techniques. Part of the reason of learning a new language should always be to extend your view of how things can work -- Obj-C has much more potential than either C or C++ in this respect.

Two, Obj-C, on the Mac at least, has an extremely powerful framework behind it with an excellent toolchain. C and C++ don't really have the same cohesive framework on any platform, though Microsoft probably comes close in their implementation. Just working with Cocoa was enough to convince me that Obj-C is a great language. The library is really well thought out and makes me jealous of those who get to work with it on a day-to-day basis.

Three, Obj-C is a superset of C, so by learning it you will already be familiar with the syntax of C. Also, the C Standard library is quite anemic and can be learned quite quickly. C++ is slightly better, what with boost being available, but boost is nowhere near as cohesive as Cocoa.

Ultimately you need to decide what your priorities are. If you are just looking to learn something new go with Obj-C.

A: 

I recently learned objective-C (because I started playing around with Cocoa) after having been a C++ developer for 10 years or so.

I found the experience of learning objective-C in addition to C++ extremely instructive, even though I probably won't use objective-C for any real project.

Both objective-C and C++ add a layer of object-oriented programming on top of C. But they do it in almost completely opposite ways. It seems that every time C++ made one design decision, objective-C made the opposite choice. For example, C++ uses static typing, whereas objective-C uses dynamic typing. Or, (recent) objective-C uses garbage collection which C++ does not.

This really made me understand the concepts of object-oriented programming and the design choices involved with it in a much better way.

Cayle Spandon