Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

random man5

macrumors newbie
Original poster
Jul 22, 2008
9
0
I want to start learning to program and I was wondering which language is better for a beginner Objective-C or C++. Also can you use Objective-C to write windows apps.

Also I would like to jump straight into either of the above languages. A lot of people say it is good to start with an easier language. like C or Basic but is it necessary or can I start with Objective-C/C++.

Thanks (sorry if anything I said didn't make sence like I said I'm a noob) :)
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
What to start with really effects what you want to do. The only thing you asked that can be answered absolutely is whether or not you can write Windows apps in Objective-C. Gcc will compile objective-C, so you could write a command line program using objective-C that would run on windows, but you're probably asking if you can write graphical programs on windows using only Objective-C, and you won't be able to do that.

Windows has a few APIs(Application Programming Interfaces) you can use to create graphical applications. These are mostly C++ APIs, and the newer are .NET APIs, and C# seems to be the most popular language to use to access them, but I believe most of the .NET languages are interoperable due to the .NET runtime.

Objective-C is what you'd need to use to access the Cocoa API for programming applications on OS X.

As a note, C is unlikely to be easier than C++ or Objective-C, just different. The nice thing about learning C is that almost every iterative programming language has syntax similar to C, and C gives you a great foundation that can be applied elsewhere.

Anything else to be added is going to be totally subjective. What you want to do might help us give you input one which language will be more useful. One thing to note is if you start with C you'll have a leg up if you want to use either C++ or Objective-C.

-Lee
 

random man5

macrumors newbie
Original poster
Jul 22, 2008
9
0
I'm not sure

I am not quite sure what I want to do. I guess that I want to learn the basics and eventually move onto more complex and gui programs. I don't have an idea for a particular app or anything.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I think for basics C is a good starter... note that any C is valid Objective-C and most C will behave the same if compiled with a C++ compiler.

perl is nice because you can run an interpreter prompt and just play with things instead of going through the write, compile, run (the last two are in one step for perl) cycle.

The things you need to know, without taking Object-Oriented programming into account are:
declaring and using variables, types of variables (not relevant in perl)

operators: arithmetic operators, bitwise operators, boolean operators, etc. what their results are, etc.

control structures: how to conditionally execute code, execute code repeatedly until a condition is met, etc. (Note: in perl do...while is not a control structure, oddly enough, so break will break outside of the control structure above the do...while)

functions, function parameters (including pass by value and pass by reference), return types: learn how to break tasks into reusable components and put them in functions to make your program easier to extend and understand

pointers: In perl a ref is not quite the same, but similar. In C pointers form the foundation for most advanced uses. This concept extends to Objective-C and C++, and it's one of the stickier things to wrap one's head around.

These are what I consider the basics that, once mastered, will apply to almost any new language you attempt to learn. Once you get to Object-orientation things change a bit, but generally what is added is the syntax to declare classes, initialize instances of a class, and call methods on a class or object.

-Lee
 

liptonlover

macrumors 6502a
Mar 13, 2008
989
0
It really does depend on what you want to do in the end... you don't want to spend years on objective C only to find when you're done that it's not what you need. An exaggerated example, but you get the idea.

First, Objective C is an EXTENSION of C. So to learn objective C you will need to know C to an extent. If you don't want to do a bunch of extensive C learning, just get the "becomeanxcoder" book at cocoalab.com. It's a free pdf tutorial that will take you from a "noob" with no experience to a beginner cocoa/objective C programmer. It will teach you enough C and general programming knowledge, and will get you started with objective C and cocoa.

I don't have a very wide knowledgebase when it comes to what language is for what, but I know a bit.

BASIC is BAD BAD BAD BAD BAD!!! Do not learn BASIC. You will pick up bad habits, and it's just naturally different from what your goal should be in any language.

Java I believe can be used cross platform, but I've heard that involves some complications and is naturally a painful language. Can someone correct me if I'm wrong?

C is pretty much a must, at least to an extent. It's the most common, most base language to learn. A lot of languages are based on it or are like it, and learning it will teach you a lot of general programming things.

Objective C is for... pretty much anything. I know people say C++ is what you want for games, but as far as I can tell so far Obj-C is fine for games as well and I'm going to give it a shot.

C++ Everyone tells me is a hard language, a weird language, and a bad one unless you're going to be very serious about learning. Either you get it or you don't is what I'm understanding. I also keep hearing that it's the best language for games of any sort.

You could also learn flash, but I wouldn't do that personally. It's a common thing, and it'll run for anyone who has a flash player but it's very expensive to get into and the apps aren't very professional looking.

Finally, there's the whole internet "programming". Personally I don't think HTML really counts as a programming language, but when you put it together with php and all those things so that you can make great websites, interactive objects, and even online apps, THEN you've got sometihng there.

There's also ruby and perl, c#, unity3D, python and other scripting languages, and a million other unknown languages and variations of languages.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Java I believe can be used cross platform, but I've heard that involves some complications and is naturally a painful language. Can someone correct me if I'm wrong?

GUIs in Java is where things go a little south in the cross-platform department. If you are writing server-side code, Java is fantastic. I can develop on a windows machine and deploy on a linux machine without issue. There is a very large developer community and as such a ton of tools have sprung up around Java such as Ant. On top of that, the JNI provides a gateway into C/C++ if you need to wrap higher-level logic around low-level interaction with the system. In short, I think Java is pretty great.

The painful part for a beginner is navigating the libraries. Their breadth is a blessing and a curse. They'll do most anything you might need, but you have to become adept at knowing where to find the functionality. I don't particularly enjoy the idea that to print to the console you need to go a few classes deep, but once you know your way around this is less of a concern.

I think a procedural language that allows for things to be non-OO at the beginning are easier to learn with. I was taught from the start on an OO language and feel that things would have gone better getting a grasp on basic concepts before Objects get involved.

-Lee
 

iShater

macrumors 604
Aug 13, 2002
7,027
470
Chicagoland
Java.

Although someone mentioned the breadth of the libraries, those libraries are better documented and easier to use than creating things from scratch or having to find non-standard APIs for doing stuff.
 

liptonlover

macrumors 6502a
Mar 13, 2008
989
0
@ lee - So what language do you recommend then? BASIC is the easiest language to learn of course, but I'm regretting the fact that I learned it ever since I became serious about programming instead of just some little kid that knew something most kids didn't know. I would recommend learning C in depth, and in case anyone's interested I know the best link for that, and C++ as well as challenges and links. http://www.cprogramming.com/
But learning C well enough to make an application, GUI or no GUI, would add so much time to the process. And really, the becomeanxcoder tutorial is just so darn awesome and good you should be fine learning about OOP using it.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I think C is the best place to start. It provides a very solid basis for other procedural languages and programming concepts. I think Java is fine but shields you from a lot of details. It also thrusts OO on you immediately and I thinks it's best to get the basics down before you get to Objects.

-Lee
 

liptonlover

macrumors 6502a
Mar 13, 2008
989
0
yeah it's kind of like BASIC only with OO. When I started on C, I was so lost when I heard that I need libraries, header files, all that.
 

alaceo

macrumors member
Feb 21, 2008
32
0
If you want to get up and running with writing Cocoa apps quickly and working with a higher level language, you may want to consider Python. It has Cocoa bindings and is recommended heavily by many people for learning programming and OOP concepts with. From there you can work your way down to lower-level languages.

If you want to learn a lot about programming and take your time doing so, go ahead and start with C or Objective-C. Objective-C is a strict superset of C so everything you learn in C you can carry over to Obj-C. Obj-C introduces OOP concepts and gives you the Cocoa framework and is very object-oriented.

If you don't have a reason to use C++ and plan on doing Mac development, just forget it for now. *Very loosely speaking* Obj-C will handle anything you would use C++ for, especially on a Mac since C++ can't utilize Cocoa and the Carbon framework that uses C++ is depreciated.


Overall, its all just up to whatever you feel like learning.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.