Thinking About Developing, Or Well, Programming

Posted:
in macOS edited January 2014
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!
«134

Comments

  • Reply 1 of 63
    wow, so many questions. well first, XCode is what we call an "Integrated Development Environment" (IDE). The idea is you have a text-editor, where you actually touch up the source files, and a compiler and linker, and some project management, and a few other things, in one big program. real programming (ie, not html/php/..) is similar, in a way, to the stuff you've done. one big difference between programming in a language like Objective-C, C, C++ or similars, compared to HTML or PHP and those, is with the formers, the source code is "compiled". The source text (human readable in often weird syntax) is changed into binary files (basically unreadable by humans, but u could decipher it if u really tried). I'll kind of stop there on the whole CS 101 bit.



    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).
  • Reply 2 of 63
    xoolxool Posts: 2,460member
    I wanted to touch on cocoa a bit more.



    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.
  • Reply 3 of 63
    I'd suggest starting with C, then moving on to objective C and Cocoa when you've got a bit of experience. Just be aware that C is much lower level than something like php and you'll actually have to start thinking a little about how you're interacting with the hardware.



    The book on C by Kernighan and Ritchie, although information dense, is really excellent.
  • Reply 4 of 63
    One of the best ways I know to get started is to download the source code to some utility you would like to use and go through the build process. Building most open source software is a two step process: 1: ./configure

    2:make. Once you have successfully built the software I suggest you examine the source code and get your hands dirty.
  • Reply 5 of 63
    gongon Posts: 2,437member
    First a dose of cool water: it takes time to do anything useful. Unless you're Applescripting.



    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.
  • Reply 6 of 63
    Okay. So it looks like C and Objective C are the first places to start. 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? Since XCode assumes you already know C... or can I work through the tutorials with that? Can I program in Java with XCode (I really hate downloading additional things that I'll only use a few times)?
  • Reply 7 of 63
    mcqmcq Posts: 1,543member
    You can do Cocoa Java programming, if you want... here's a intro tutorial/app:

    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.
  • Reply 8 of 63
    gongon Posts: 2,437member
    Quote:

    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.
  • Reply 9 of 63
    ishawnishawn Posts: 364member
    Quote:

    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?
  • Reply 10 of 63
    mcqmcq Posts: 1,543member
    For Java, from Terminal:

    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.
  • Reply 11 of 63
    gongon Posts: 2,437member
    MCQ nailed it. Here's a file you can use to try his instructions. Copy into text editor and save as Foobar.java.
    Code:


    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.
  • Reply 12 of 63
    dave k.dave k. Posts: 1,306member
    You ever considered REALbasic? It's real quick to learn and pretty powerful. It can be found here: http://www.realsoftware.com



    Good Luck.
  • Reply 13 of 63
    ishawnishawn Posts: 364member
    Well... I seem to get some sort of error (I completely copied the text into TextWranger and saved the file as : Foobar.java

    Then I did these steps in Terminal:

    Code:




    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?
  • Reply 14 of 63
    gongon Posts: 2,437member
    Quote:

    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
    Code:


    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".
  • Reply 15 of 63
    ishawnishawn Posts: 364member
    Well, thanks I got it to work!

    Code:




    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$





  • Reply 16 of 63
    I've also been looking around for something to start programming with - I have soem prior experience, but a long time ago. I've probably settled on RealBasic: http://www.realbasic.com which seems fairly quick to get into, while still being OO, and compiling binaries for MacOS, Windows, and Linux from the same source code.



    Good luck with it!



    Cheers,



    Martin.
  • Reply 17 of 63
    a_greera_greer Posts: 4,594member
    If you want to know about programming, I recommend taking a college class in programming logic and design, most any community college should offer this. These courses are generally platform independent, but you learn the basics that you need, as a beginner, having a prof to bounce questions off of is worth every bit the tuition costs, because once you know the basics, each new language that you learn is, essentially, just different syntax imho.



    As to the specific platforms and languages: look for books from O?Reilly Press. I strongly recomend diving into shell scripting
  • Reply 18 of 63
    Great thread! I am a beginning programmer as well - have to do it as part of my IS studies, but am personally interested as well - and have started doing some Java on a Windows PC using a SAM's "in 21 days" book, a text editor and the Javac compiler.



    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?
  • Reply 19 of 63
    Quote:

    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.
  • Reply 20 of 63
    I stole my father's book for a while since he said he wouldn't need it in the meantime and I've been messing around with it. I really enjoy it.



    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!
Sign In or Register to comment.