Thinking About Developing, Or Well, Programming
Well. I think I'm ready to get my hands wet in the program aspect of computers, but I am unsure of where to start. My initial thought of where I would like this to go is being able to maybe debug mac programs, and add a few things. I guess this is the "developer title." From what I know, I install XCode in my applications folder and I get started with that. But I'm a little intimidated, does the Developer site from Apple help with getting started?
I am very familiar with internet-based programming. By that I mean html, javascript, php, etc. I assume this sort of code does the same thing for computer programs, but you're doing an application; not a website or web page. Where do you suggest I get started? How do you suggest I get started? Should I become a "developer" like mac says on their site and just start from there?
Also, I understand what XCode does, but what is XTools and other stuff like that? Can you create everything from the bare code to an actual application with the graphics using this XCode without having to go through tons of different applications?
I see there are all kinds of programming for different applications, but what are the major applications ran on? Cocoa, Carbon, other names like that? Is there something like an html editor for these applications or is that what XCode does?
So, I'm asking you experienced what I can do with maybe creating new plugins for music stuff (Audio Units, and of that sort) for that would most affect me. I am just trying to expand my computer knowledge and I am falling in love with my mac, and I want to help out others. Are there people that go through and add little things to programs to make them work for a few people (Or maybe all).... are these called the developers?
In advance, thanks!
I am very familiar with internet-based programming. By that I mean html, javascript, php, etc. I assume this sort of code does the same thing for computer programs, but you're doing an application; not a website or web page. Where do you suggest I get started? How do you suggest I get started? Should I become a "developer" like mac says on their site and just start from there?
Also, I understand what XCode does, but what is XTools and other stuff like that? Can you create everything from the bare code to an actual application with the graphics using this XCode without having to go through tons of different applications?
I see there are all kinds of programming for different applications, but what are the major applications ran on? Cocoa, Carbon, other names like that? Is there something like an html editor for these applications or is that what XCode does?
So, I'm asking you experienced what I can do with maybe creating new plugins for music stuff (Audio Units, and of that sort) for that would most affect me. I am just trying to expand my computer knowledge and I am falling in love with my mac, and I want to help out others. Are there people that go through and add little things to programs to make them work for a few people (Or maybe all).... are these called the developers?
In advance, thanks!
Comments
If you just want to add some additional functionality to an app, you might just want to learn AppleScript. It'll be easier than something like C, and with AS you can do a lot.
Carbon: basically, at this stage in the game, avoid it. If you programmed for OS9 and classic, then Apple recommending using Carbon libraries (i'll explain "libraries" in a second) so you could more easily transfer from classic to OSX. Apps that take advantage of Carbon can run on OS9, and natively in OSX.
Cocoa: if you want to program for OSX, you pretty much have to use the Cocoa libraries these days. Cocoa libraries will allow you to create graphical applications that work well with the OS.
A library is basically a bunch of organized code that running programs read and execute, to perform common tasks. For example, every OSX program is going to need a menu bar; in the Cocoa libraries there are ways for programmers to call up some menus and put them in the standard location.
you won't be able to just jump into XCode. XCode assumes competance in some programming language, like C, Obj-C, etc. For OSX programming, Objective-C is pretty much the language to use. Others may recommend Java, C, or C++. Java and Objective-C will give you relatively easy access to the Cocoa libraries.
You can create a completely graphical program purely in code. It's incredibly difficult though. You will quickly find that visualizing how to organize GUI elements is a lot easier than remembering measurements, distances and numbers in your head. Off the top of my head, I can't remember what the name of the program is that you use to work with the GUI on OSX. It does integrate pretty nicely with XCode, iirc.
.
It sounds like you are more interested in tinkering than becoming a developer. You will probably find that programming isn't just that easy. you won't be able to just pickup a book on C, then start hacking away on the mach kernel the same night. it takes a solid weekend of training.
if you really do want to write applications, get a good book on programming in Objective-C or Java. Once you know the language well, you can then learn Apple's libraries (ie, Cocoa). Then you can write programs of your own, or work on others (if you can wrangle the source code from them).
I'm an experience programmer and it took some time before I started thinking the cocoa way. I'm a well trained and experienced, but something about the lisp-esque syntax through me off. Also, the outlets and some of the objective-C syntax was weird to me for some reason.
After a few false starts and some reading, I grokked it. Now I'm looking forward to using Cocoa in a bunch of upcoming projects.
I hope you like Object Orientation and don't hate LISP/SCHEME. Get used to [ and ]s.
The book on C by Kernighan and Ritchie, although information dense, is really excellent.
2:make. Once you have successfully built the software I suggest you examine the source code and get your hands dirty.
I say start from the basics with a text editor and gcc. Learn C. Every concept in C will be useful later, and if something isn't, at least you'll appreciate how much better that particular thing is done in some other language. Get a good C book and work with that. Kernighan and Ritchie is a good one, maybe a little on the slim side though.
When you know a good bit and have a "project", a simple multi-choice menu, a calculator, temperature converter, whatever, learn how to separate the logical elements in there into separate files, header files and source files, that you successfully compile into one executable program with gcc.
Then learn to do a simple makefile. make is a tool that automates the build process given instructions (in the form of a "makefile").
This is braindead simple after you can run gcc by hand to assemble more than one file.
After you have learned this you understand what the automatic compile process is about. XCode and other IDE's will not only automate the compile process, they will also automate the step equivalent to writing a makefile. However, I think you should understand it first, then use the automated version. Never accept that something works with "black magic". Instead know how it works.
Later on you want to read example code to see how things can be done. It's no use to jump into miscellaneous "real" code without learning the language first - you won't understand a thing and can become discouraged for no reason. People learn to drive in crappy cars or carts, not F1 racecars, even if they end up driving F1 later.
http://developer.apple.com/documenta...uid/TP30001111
If you just want to run through a Java programming book and do examples, then I'd suggest using the Eclipse IDE.
Originally posted by iShawn
I believe my father has a book on Java... so I might look at that first. What do you suggest for learning the programming in?
You can start with Java, no problem. Whatever language you go with, I again suggest using just a text editor to edit the code and compiling with gcc or javac from the command line. You don't even have to install XCode, javac is already in there waiting for you.
You can always go to Eclipse or XCode after doing things manually but the other way around is harder.
Originally posted by Gon
...just a text editor to edit the code and compiling with gcc or javac from the command line...
I saw that TextWrangler (What I already use for website editing) can do the different kinds of programming... so I'll go ahead and do it with that.
I don't understand the compiling part though through command line (I assume terminal), could you elaborate the steps?
Compiling file: javac [filename].java
Running program after compilation: java [classname]
So, for example. If you had a file named Foobar.java
1) javac Foobar.java
2) java Foobar
SubEthaEdit is another good option for a text editor.
class Foobar {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display some text.
}
}
You are definitely going to need a book though, ASAP. This is very unlike the web stuff no matter how similar it might look to Javascript. Best to work through it methodically.
I won't even bother to mention my editor preference but it starts with V.
Good Luck.
Then I did these steps in Terminal:
Powerbook-Thelonious:~ Shawn$ javac /Users/Shawn/Desktop/Foobar.java
Powerbook-Thelonious:~ Shawn$ java Foobar
Exception in thread "main" java.lang.NoClassDefFoundError: Foobar
Any tips or suggestions?
Originally posted by iShawn
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: Foobar
See where it says it does not find class? javac compiles Foobar.java into Foobar.class, which consists of Java bytecode. javac defaults to outputting the .class where .java was, so you should have the Foobar.class on your desktop after compiling. Now, you didn't give java a path where to look for the .class. Go to the desktop with
cd /Users/Shawn/Desktop
before you try to run the class file.
HTH.
edit: you might not need this right now, but can see what javac and java can do and how you must tell them to do it, by typing in "man java" and "man javac".
Last login: Sun Feb 13 20:53:20 on ttyp1
Welcome to Darwin!
Powerbook-Thelonious:~ Shawn$ cd /Users/Shawn/Desktop
Powerbook-Thelonious:~/Desktop Shawn$ javac Foobar.java
Powerbook-Thelonious:~/Desktop Shawn$ java Foobar
Hello World!
Powerbook-Thelonious:~/Desktop Shawn$
Good luck with it!
Cheers,
Martin.
As to the specific platforms and languages: look for books from O?Reilly Press. I strongly recomend diving into shell scripting
I'd like to use an IDE - plain text editors without syntax formating/highlighting become confusing with more complex projects. I am now on a Mac (still OS X 10.2) and would like to use XCode.
Are there any tutorials out there or a good book covering the XCode IDE and the Cocoa framework (maybe Objective-C as well)?
How is Eclipse on OS X? How can you tell OS X where to look for classes? What are the default paths?
Edit: Moderators, how about a "Programming for Mac OS X" forum?
Originally posted by Gon
First a dose of cool water: it takes time to do anything useful. Unless you're Applescripting.
Right, but then it just takes the script time to do anything useful.
Is there a way to see the source code to applications? How do you go about doing this?
And also only last thing...
I want to have little snippets of code that might make my applications run better for me and maybe for others... is there a way (or is it illegal) to take something like iTunes and add a little thing to it - this is my goal - that might make it work better for me... without having to applescript it (because from what I know you have to click on something to activate a script) and just having it install itself into the code. Is this considered illegal work? Or is this what developers do?
As always, thanks!