PDA

View Full Version : Is learning programming on OS X a good idea?




Not Available
Jun 30, 2009, 08:16 AM
Tomorrow I'll be buying my first Mac computer ever, a 2.26Ghz 13" MacBook Pro. I'm going to use it 90% for learning programming and programming languages (C/C++, Python, Cocoa and Ojective-C, PHP and SQL) .

My question is if it is a good idea to learn this on OS X. I see that many tools have been developed by third party companies, but I'm just curious if it's going to be more productive on a Mac, or it would be better on a Windows-based machine.

Thanks in advance!



Tallest Skil
Jun 30, 2009, 08:23 AM
I don't see why not!

XCode* is an amazing tool; you'll grow to love it.

*requires free online developer account. Sign up at developer.apple.com

Meek Wriggle
Jun 30, 2009, 08:30 AM
Tomorrow I'll be buying my first Mac computer ever, a 2.26Ghz 13" MacBook Pro. I'm going to use it 90% for learning programming and programming languages (C/C++, Python, Cocoa and Ojective-C, PHP and SQL) .

Thanks in advance!

Cocoa and Objective-C are Mac only, so you're in for a treat there, and of course the Mac has good support for C/C++. But nearly all other programming languages are out of date on the Mac; Python, Perl, Java, Ruby (not sure about PHP). Some of these you can update yourself as I did with Python and Perl (the latest Python, 3.1, can be downloaded from the Python website, and Perl can be nabbed by Googling ActivePerl). The only way to update Java on the Mac is whenever Apple decides it's time as the Java website doesn't have the latest version for Mac to download. So we're basically stuck with Java 5 while the rest of the world gets Java 6. BOO to Apple for this because Java 6 has been out for about 2 years now.

EDIT: You can also download MySQL from their site you need up to date SQL.

Further edit: You might find it easier, if you're going to be using scripting languages like Perl, Python, Ruby, etc, (oh, and Java of course, until Apple update it) to use Bootcamp for a Windows install. But for C/C++/Obj-C/Cocoa you'll be fine with using Leopard.

ortuno2k
Jun 30, 2009, 08:30 AM
YES! - Xcode is a great tool and you will be able to use it for all your programming needs.
Although, for programming in Python, I downloaded their software from their site (you can do it on XCode but it takes a bit longer to set up). For Obj-C, C++, & C, I've used my MBP without any problems.
Have fun!

Not Available
Jun 30, 2009, 08:42 AM
Thanks a lot, guys! I've already had a look over some of the tools I'd like to use.

For Python, I will definitely be downloading the latest package available on http://python.org.

For C/C++, I was thinking of Code::Blocks (htttp://codeblocks.org). They say they could use one or two Mac developers for their OS X port. Is it a good idea to use this 3rd party software, or should I stick to XCode?

Java is definitely bad news. I didn't know about that.

I think it's just the fact that all I could find on Google was a 2001 post, stating that at programming, Windows is still a better platform.

Thanks a lot again, and I'm also looking forward to your further answers!

ryan
Jun 30, 2009, 08:49 AM
Java 6 is available for OSX and it is most likely already installed on your Mac if you've been keeping up with the software updates; if you haven't you can download the various Java updates from here (http://developer.apple.com/java/download/).

GroovyLinuxGuy
Jun 30, 2009, 08:54 AM
Can't answer to C/C++, or Objective C, but for Python, Perl, and TCL (yes, there is still someone using it!!) OS X is great. I downloaded MacVim (http://code.google.com/p/macvim/) for my editor (sometimes I don't want to work in the terminal with plain old vim) and am pretty happy with my set up

Meek Wriggle
Jun 30, 2009, 09:09 AM
Java 6 is available for OSX and it is most likely already installed on your Mac if you've been keeping up with the software updates; if you haven't you can download the various Java updates from here (http://developer.apple.com/java/download/).

Hmmm, thanks for that. My system is up to date. What confuses me is why Eclipse insists on using the JDK 1.5 for compiling my programs. When I try and use 1.6 I get a warning message (on the New Project creation screen).

Sorry for the thread derail, but this is confusing me now.

Not Available
Jun 30, 2009, 09:11 AM
Oh, here's something I've really wanted to ask you: what is your opinion on Panic's CODA, if you've ever used it. It looks like the ideal web development application, but I'm still curious about a user review.

P.S.: I'm sorry for my English not being perfect, as it's not my primary language.

lee1210
Jun 30, 2009, 09:13 AM
Thanks a lot, guys! I've already had a look over some of the tools I'd like to use.

For Python, I will definitely be downloading the latest package available on http://python.org.

For C/C++, I was thinking of Code::Blocks (htttp://codeblocks.org). They say they could use one or two Mac developers for their OS X port. Is it a good idea to use this 3rd party software, or should I stick to XCode?

Java is definitely bad news. I didn't know about that.

I think it's just the fact that all I could find on Google was a 2001 post, stating that at programming, Windows is still a better platform.

Thanks a lot again, and I'm also looking forward to your further answers!

For C/C++/Objective-C, you should be fine with XCode. I have only used that, and the terminal/gcc for programming on the mac, so I can't speak to the quality of third party offerings.

My opinion on Windows vs. UNIX or UNIX-alikes for programming is 100% for UNIX. The only reason you'd need windows is if your only goal was to build windows apps that require .NET. Mono is available for other platforms, but I treat it with trepidation when it comes to commercial use.

I think OS X is a great environment for programming, and I'd say the next choice for operating systems for this purpose would be linux. Cygwin is the only thing that makes it possible for me to get programming done on windows.

-Lee

Not Available
Jun 30, 2009, 12:27 PM
Well... thanks a lot, everybody! I've chilled down!

mslide
Jul 1, 2009, 03:06 PM
IMO, a Mac is the perfect computer to (learn to) program with. The platform is widely enough used where you can use it for day to day tasks with no trouble, yet, it is unix based so you get all the advantages of that as well. You get all the tools you will probably ever need by downloading XCode. That will also get you all the typical tools needed to program the Unix way, so to speak. I still prefer the latter to xcode, although it is a great tool. I stick to the basics when I program, even on windows,... terminal, vi, gdb, gcc, Makefiles, etc. I would start off with C and C++ as those are widely used on all platforms.

Not Available
Jul 2, 2009, 05:03 AM
Hi, guys! I've got my MacBook and have installed XCode 3.1.3. It looks and feels awesome, but I've got one problem, which is quite weird...

I went to File >> New File... >> C and C++ >> C++ File, I configured what had to be configured, wrote my program, but I can't find a place where I can compile & run it. Any help will be appreciated.

Note that I've created a FILE, not a PROJECT.

Winni
Jul 2, 2009, 05:50 AM
It all depends on what your ultimate goal and target market are. If you want to write business applications, investing time in the OS X platform is in almost all cases a WOFTAM (waste of f.... time and money). OS X is NOT an enterprise or business platform and Apple is not a player in the enterprise market, end of discussion.

If you want to write apps for home users or maybe even want to enter the Indie game developer niche, the Mac is fine.

In my very personal opinion, the Mac is not a good development platform. Or, to be more precise, it completely sucks when compare with Windows. Windows has a richness of programming languages and development tools that the Mac can only dream of, and almost all of them allow for the development of applications that look and behave completely native. On the Mac, if you don't use Objective-C and Cocoa, it is more difficult to find alternatives with 100% support for the Mac platform.

If client side apps and games don't interest you, then you won't care about this. All scripting languages are there, Mono is getting better with each release and even Java is currently up-to-date.

But again: If you're in it for the money (and with that large set of languages that you want to learn you must be in it for the money), you have to very carefully evaluate your business case. Windows is where the corporate money is. Macs are almost exclusively used only by home users or a few professional individuals who are in the audio/video business.

sammich
Jul 2, 2009, 05:57 AM
You could use XCode to make simple CLI (command line interface) programs, but you can also use a program like TextWrangler (http://www.barebones.com/products/TextWrangler/) (free) or TextMate (http://macromates.com/) ($$$ but very very good). I tried using XCode for a simple CLI but I was too cumbersome for me back then, maybe someone can clear that up.

Hi, guys! I've got my MacBook and have installed XCode 3.1.3. It looks and feels awesome, but I've got one problem, which is quite weird...

I went to File >> New File... >> C and C++ >> C++ File, I configured what had to be configured, wrote my program, but I can't find a place where I can compile & run it. Any help will be appreciated.

Note that I've created a FILE, not a PROJECT.

If you're compiling say a simple helloWorld.cpp file CLI program, just navigate to the location of your cpp file via terminal (ie 'cd') then compile using g++ -o helloworld helloWorld.cpp

Not Available
Jul 2, 2009, 06:14 AM
It all depends on what your ultimate goal and target market are. If you want to write business applications, investing time in the OS X platform is in almost all cases a WOFTAM (waste of f.... time and money). OS X is NOT an enterprise or business platform and Apple is not a player in the enterprise market, end of discussion.

If you want to write apps for home users or maybe even want to enter the Indie game developer niche, the Mac is fine.

In my very personal opinion, the Mac is not a good development platform. Or, to be more precise, it completely sucks when compare with Windows. Windows has a richness of programming languages and development tools that the Mac can only dream of, and almost all of them allow for the development of applications that look and behave completely native. On the Mac, if you don't use Objective-C and Cocoa, it is more difficult to find alternatives with 100% support for the Mac platform.

If client side apps and games don't interest you, then you won't care about this. All scripting languages are there, Mono is getting better with each release and even Java is currently up-to-date.

But again: If you're in it for the money (and with that large set of languages that you want to learn you must be in it for the money), you have to very carefully evaluate your business case. Windows is where the corporate money is. Macs are almost exclusively used only by home users or a few professional individuals who are in the audio/video business.
No, I want C/C++ and Python for education purposes (there are many competitions going on in our country from 9th to 12th grade, and I've got two years to prepare for them :) ), Cocoa and Objective-C because I want to develop a Hangman game, together with one of my friends, for our iPod Touches, and PHP and SQL because I've got a lot of ideas for online applications, which are mostly going to be used by me (I'm willing to develop a CMS because I find this to be the best way to enhance your skills, and I also want to port an offline application written in C++ which is all about managing and controlling databases).

I'm too young to think of business just yet, and could you be more specific about the tools a PC has and a Mac dreams of? XCode and Code::Blocks are amazing, CODA as well. I don't know if Eclipse has an OS X version, but so far, except for some platform switching problems, I love this OS.

duggram
Jul 2, 2009, 06:38 AM
Holy buckets!! Sounds like you are very young and way ahead of the game now. Use the Mac, have fun, go forth and be fruitful (i mean produce lots of code)!

mslide
Jul 2, 2009, 07:02 AM
If you want to write business applications, investing time in the OS X platform is in almost all cases a WOFTAM (waste of f.... time and money). OS X is NOT an enterprise or business platform and Apple is not a player in the enterprise market, end of discussion.

I don't necessarily agree. Using a language like C++ and a framework like Qt allows you to write GUI applications that are very portable and will run on Windows, OSX or Linux/X11 and they will look and feel just like native applications. For my own projects, even if my target is Windows, I usually do all my development on my Mac (or a linux machine) as it is much faster for me to do it on a unix platform and those skills translate to all other platforms.

cqexbesd
Jul 2, 2009, 08:33 AM
I think it's just the fact that all I could find on Google was a 2001 post, stating that at programming, Windows is still a better platform.

In my day job I have to support 6 or so UNIX variants and Windows. Let me say that Windows sucks to develop under. Unreliable and poor development tools compared to UNIX. Sadly I don't get to develop for OSX so I can't compare that equally.

Of course this is just my opinion and ppl will no doubt disagree. What you are developing and in what language/environment will probably have an effect on that as well.

Andrew

mongrol
Jul 2, 2009, 05:30 PM
Not Available,
Stick with XCode and Objective-C and C++ for now. Learn the IDE and the environment and how to manage projects. Do tutorials (www.cocoadevcentral.com) to kick off with.

IGNORE everyone punting you towards other IDE's, text editors, their favourite language etc. Stick to one thing till you get comfortable and don't try to do too much by collecting all the latest and greatest tools and libraries.

Learn to program. Not to play with programming tools.

lee1210
Jul 2, 2009, 05:47 PM
Not Available,
Stick with XCode...<snip>Learn to program. Not to play with programming tools.
I'm not necessarily disagreeing with your sentiment, but these seem at odds. Learning XCode might be considered "playing with programming tools" before one has really learned to program. I think part of programming is understanding how compiling/linking/etc. works, and XCode abstracts that all away. It is learning a tool that is very narrowly available instead of learning things that apply many places (I can compile with gcc on Windows, Linux, BSD, Solaris, OS X, etc.) like compiling with GCC.

Again, I don't think using XCode at this phase is a specifically bad idea at all, but I do feel that knowing what's going on under the hood and mastering a decent UNIX editor like vi(m) should occur pretty early in ones programming career.

-Lee

HiRez
Jul 2, 2009, 06:57 PM
I agree with mongrol, I wouldn't worry so much about what language or environment you use. If you learn to program in anything, you'll be better prepared for everything else. Being a programmer isn't about knowing a language or API, it's about solving problems, and doing it efficiently, something you will learn no matter what tools you are using. The most important thing is to just get started and hopefully start with something you're passionate about, that will help keep you motivated during the rough spots.

Personally I love Objective-C/Cocoa for desktop (or iPhone) apps and Python/Django for web apps. But you really can't go wrong with anything. If you're still in high school, you shouldn't be too worried about getting aligned with the next business software trend or whatever, just learn to program first using whatever is the most fun for you, then you can move into what makes the best sense for your career. Well some people with disagree with me, but that's my advice.

blkdogb
Jul 3, 2009, 12:17 AM
Java 6 for OS X is 64-bit only. The latest release of Eclipse 3.5 is available in Cocoa 64-bit, so Eclipse 3.5 will run fine on Java 6. Previous Eclipse versions (Carbon) will require 32-bit Java 5 on OS X.

Not Available
Jul 3, 2009, 02:40 AM
I'm not necessarily disagreeing with your sentiment, but these seem at odds. Learning XCode might be considered "playing with programming tools" before one has really learned to program. I think part of programming is understanding how compiling/linking/etc. works, and XCode abstracts that all away. It is learning a tool that is very narrowly available instead of learning things that apply many places (I can compile with gcc on Windows, Linux, BSD, Solaris, OS X, etc.) like compiling with GCC.

Again, I don't think using XCode at this phase is a specifically bad idea at all, but I do feel that knowing what's going on under the hood and mastering a decent UNIX editor like vi(m) should occur pretty early in ones programming career.

-LeeThat's the next thing I want to do, after I get my foot wet on programming: learning to use UNIX and FreeBSD. I'll look into vi(m) just in order to get an idea on how it works.
I agree with mongrol, I wouldn't worry so much about what language or environment you use. If you learn to program in anything, you'll be better prepared for everything else. Being a programmer isn't about knowing a language or API, it's about solving problems, and doing it efficiently, something you will learn no matter what tools you are using. The most important thing is to just get started and hopefully start with something you're passionate about, that will help keep you motivated during the rough spots.
Well... that's my weakness: it takes me a lot of time to get the motivation and see the reason behind something. But now I've got the reason and use for each of them. I've also got the material I need.
Not Available,
Stick with XCode and Objective-C and C++ for now. Learn the IDE and the environment and how to manage projects. Do tutorials (www.cocoadevcentral.com) to kick off with.

IGNORE everyone punting you towards other IDE's, text editors, their favourite language etc. Stick to one thing till you get comfortable and don't try to do too much by collecting all the latest and greatest tools and libraries.

Learn to program. Not to play with programming tools.Well... I didn't know at first anything about XCode, and being something delivered by the OS manufacturer, I assumed it's a bad tool with lots of flaws and limitations (see iWeb), but now I see it's an awesome tool, actually, and I kind of enjoy using it.

Thank you, guys! You've helped me a lot so far, I really wasn't expecting :)

Cromulent
Jul 3, 2009, 06:02 AM
That's the next thing I want to do, after I get my foot wet on programming: learning to use UNIX and FreeBSD. I'll look into vi(m) just in order to get an idea on how it works.

No need to use FreeBSD as Mac OS X is basically the same with a different GUI on top. Just learn to use the Terminal application in Mac OS X and you should be fine.

Not Available
Jul 3, 2009, 08:37 AM
No need to use FreeBSD as Mac OS X is basically the same with a different GUI on top. Just learn to use the Terminal application in Mac OS X and you should be fine.
So can I actually use a UNIX book in order to learn how to use the Terminal?

bkap16
Jul 3, 2009, 10:10 AM
So can I actually use a UNIX book in order to learn how to use the Terminal?

Yes. Apple's Terminal.app uses Bash, which is one of the most popular Unix shells. OS X is a BSD derivative, just like FreeBSD, and Leopard comes with X11. Just about any program that works on various Unix implementations (including the desktop environments) will compile and run on OS X and everything in that UNIX book should work without a problem.

Not Available
Jul 3, 2009, 10:22 AM
Hmm... I guess this is also why a compiled *.cpp file is seen as a "Unix Executable File" by the OS.

Not Available
Jul 15, 2009, 01:15 PM
Well... hi, guys! I'm back.

Unfortunately, I'm not satisfied with what Xcode has to offer. I mean... it looks like a great development tool for large applications, but I'd like something simpler, as everything I do for now resumes to running the code in the textbook I'm currently following, and solving the exercises at the end of the section. For this job, Xcode seem rather annoying, and full of useless stuff.

For example, the code window is already small. I don't need Xcode to add all the Copyright stuff at the beginning of the program. And I can't keep on deleting it each time I create a new file.

Also, each time I add a new file, I'm required to deselect the previous one as being the target file. And this is rather annoying, getting you out of the mood.

What I'd like you to do is tell me other IDEs you know, and I'll check each of them. I've also heard some stuff about vim. I'll look into it, but I'd still like you to tell me about other IDEs. Or at least, tell me about how I can organize the application better.

Thanks in advance!

mslide
Jul 15, 2009, 01:30 PM
What I'd like you to do is tell me other IDEs you know, and I'll check each of them. I've also heard some stuff about vim.

I always try to keep everything as simple as possible.

If all you're doing is basic command line only programming exercises from a beginner programming book, then I recommend that you just use basic text editors and compile stuff on the command line (I always do that, no matter how complicated my program is, because I don't like using IDEs but that's for another thread). Pick a text editor and use that. I personally prefer vim but it takes a long time to really get the hang of it. emacs is another popular and very powerful editor. If you want something extremely simple, then use nano. All of these should already be installed on your Mac and can be executed from within Terminal.

For compiling your code, learn how to use the command line compiler for whatever language you are using (e.g. use g++ for programming in c++).

If you're stuff is getting too cumbersome to always type out on the command line, when compiling, then learn to use a build system (I use cmake + makefiles) or then start using an IDE.

If you need to debug your code, start learning how to use the GNU GDB debugger.

This way, you will develop a solid foundation and know what is going on 'under the hood' when you use an IDE.

Not Available
Jul 15, 2009, 02:00 PM
I've downloaded Emacs, and I can't seem to find my way around it. So now I'm downloading Vim from Google Code, VERY SLOWLY. I'm optimistic about it because I've also found some kind of *.PDF book which will most probably help me a lot.

Cromulent
Jul 15, 2009, 02:09 PM
I've downloaded Emacs, and I can't seem to find my way around it. So now I'm downloading Vim from Google Code, VERY SLOWLY. I'm optimistic about it because I've also found some kind of *.PDF book which will most probably help me a lot.

Vim and Emacs come along with Mac OS X. No need to install them separately.

Cinder6
Jul 15, 2009, 02:37 PM
For Vim, just go into the Terminal.app and type in 'vimtutor'. That'll help you get through all of the basic commands. There's some more advanced stuff than what's in there (and are real timesavers, too), but you'll be up and running with what it does have.

To reiterate what others have said, don't bother with Xcode for the simple things you're doing now. Generally, if you're just doing a CLI program, you won't care about all the project management. Plus, it's always good to know how the stuff works in the background. Try making your own Makefiles, modularize your programs, etc.

Not Available
Jul 15, 2009, 03:39 PM
Vim and Emacs come along with Mac OS X. No need to install them separately.
Yes, I've just figured that out. What I was downloading turned out to be the graphical interfaces, which I pretty much get to hate, now that I discovered vim. I simply love it, and the tutorial I'm following is so awesomely written, I haven't read something so good in a while.

For Vim, just go into the Terminal.app and type in 'vimtutor'. That'll help you get through all of the basic commands. There's some more advanced stuff than what's in there (and are real timesavers, too), but you'll be up and running with what it does have.

To reiterate what others have said, don't bother with Xcode for the simple things you're doing now. Generally, if you're just doing a CLI program, you won't care about all the project management. Plus, it's always good to know how the stuff works in the background. Try making your own Makefiles, modularize your programs, etc.
After I finish reading the 89-pages *.PDF, I'll try playing with it more by myself, and I'll also have a look over 'vimtutor'. I've already discovered the syntax highlighting by myself and it feels awesome :)

I'll also have a brief look over the terminal commands I need in order to compile my programs. I've read some things about makefiles, but I'm still not into them. I'll have to dig further.

Thanks a lot!

Cinder6
Jul 15, 2009, 04:13 PM
As I recall, the default .vimrc OS X comes with is pretty sparse. If you want, I can post mine, which does code highlighting for all the common languages.

Not Available
Jul 15, 2009, 05:42 PM
Nevermind, I've got this solved. I will try working the rest of the book *quietly*, and if any more problems occur, I'll be a bother once again around here :)

Not Available
Jul 16, 2009, 06:48 AM
I'm sorry for double-posting. Also, problem solved.

jayrobinson
Jul 16, 2009, 11:49 PM
What is your opinion on Panic's CODA

As a young professional web developer who is also learning C, I love using Coda for my work all day and study at night.

At work, I "Command-1" into my sites all day, and when I come home I "Command-5" into the Terminal interface, connect to the Local shell and easily compile my elementary C programs:

$ cc myProgram.c

I can see all my files on the left file source list and drag them into the command line if I'm too lazy to write out ~/Projects/C/a.out or what have you.

I subscribe to Al3x Payne's theory (http://al3x.net/2008/09/08/al3xs-rules-for-computing-happiness.html) that you should use as little software as possible. Although I want to make it to Xcode eventually, for learning and compiling C it is overkill.

Cinder6
Jul 17, 2009, 11:34 AM
You're probably aware of this, jayrobinson, but:

You can specify a name for the output executable with gcc.
gcc -o myproj myproj.c

You can even simplify it further. For really simple programs (that is, those with only one source file), you can use make without a makefile.
make myproj

Both will produce the same named executable. If you have multiple sources, though, you have to use a Makefile.

Not Available
Jul 17, 2009, 01:13 PM
You're probably aware of this, jayrobinson, but:

You can specify a name for the output executable with gcc.
gcc -o myproj myproj.c

You can even simplify it further. For really simple programs (that is, those with only one source file), you can use make without a makefile.
make myproj

Both will produce the same named executable. If you have multiple sources, though, you have to use a Makefile.
I'm actually using g++ MYPROJ.CPP -O MYPROJ when I'm compiling my C++ programs (I'm sorry about not code-ing). Is it a syntax difference, or am I doing it in a wrong manner (I'm talking about you writing -o first, not the gcc/g++ commands).

Cinder6
Jul 17, 2009, 01:58 PM
'make' will also handle .cpp files (it'll do the equivalent of g++), FYI.

There's no difference in where you place the -o option; it's purely choice.

g++ myproj.cpp -o myproj
g++ -o myproj myproj.cpp
make myproj

They all do the same thing. I like using make, as it's simpler, less typing, and you don't have to remember to use gcc or g++ if you switch between C and C++ a lot.

(Note that it's not 'make myproj.cpp', as that'll fail.)

Muncher
Jul 17, 2009, 08:37 PM
I didn't know at first anything about XCode, and being something delivered by the OS manufacturer, I assumed it's a bad tool with lots of flaws and limitations (see iWeb)...

Not XCode. It's a very useful piece of software. And using Cocoa with it is very easy.

johnselmos
Oct 7, 2009, 12:50 PM
I much prefer doing any kind of development on a Mac. Its Unix based, so for me it replicates a development environment a lot better than a windows box.

Amigaman
Oct 9, 2009, 12:46 PM
I've downloaded Emacs, and I can't seem to find my way around it. So now I'm downloading Vim from Google Code, VERY SLOWLY. I'm optimistic about it because I've also found some kind of *.PDF book which will most probably help me a lot.

Have you tried TextMate (http://macromates.com/)?