Programming for Mac?

Posted:
in General Discussion edited January 2014
I have dabbled a bit in REALbasic in the past, making some pretty average shareware programs. I was thinking about buying a RB licence again and doing some work. This also got me thinking - what is THE programming environment for OSX? I am quite keen to learn something a little more challenging and see what I can do.



Any hints as to languages and tutorials gratefully received. Thanks.

Comments

  • Reply 1 of 20
    slewisslewis Posts: 2,080member
    Quote:
    Originally Posted by G_Warren View Post


    I have dabbled a bit in REALbasic in the past, making some pretty average shareware programs. I was thinking about buying a RB licence again and doing some work. This also got me thinking - what is THE programming environment for OSX? I am quite keen to learn something a little more challenging and see what I can do.



    Any hints as to languages and tutorials gratefully received. Thanks.



    Xcode is the official "Environment" for OS X. It comes free on every Tiger Install Disc that comes with Macs. Objective-C is the official Programming Language for OS X, and I believe Ruby and Python are going to be supported in Leopard.



    Unfortunately I can't give much more advice then that because I'm new to programming myself. I just bought a book on Objective-C, but a friend recommended learning C first to get the basic ideas of programming because he said the book I bought was a good introduction to Objective-C but not programming in general.



    Sebastian
  • Reply 2 of 20
    hirohiro Posts: 2,663member
    Python is already installed in OS X, although only the basic language packages. It works just fine and can even be used with they Python-ObjC bridge for a native GUI. If it gets wrapped into a Leopard Xcode it will only be that much easier to make native apps.



    I would actually suggest spending a week or two with Python to get into the feel of an imperative language, start with this online book: Think Like a Computer Scientist. Once you work through Ch8 of 20 you should be ready to transition to C. I like O'reilly's Practical C, but others may have more up to date suggestions. Practical C is good as long as you ignore the compiler/IDE specific stuff early on, it was written in the late 80's/early 90's so is a bit dated in that part, but it covers the language well and has good gouge on program design/style. When transitioning, just take the concepts you learned in the week with Python and wrap those in C's slightly different syntax.



    Eventually you can transition to Obj-C, I would work through the Python book ch9-20 first to get the object related concepts then jump to the Obj-C syntax. I don't have a great book for that, I made the jump blind based on a couple other languages worth of experience and the Hillegass Cocoa book.



    Some won't like using Python as a stepping stone, but the syntax is less fru-fru'y and you can try stuff in the interpreter, both of which make it less of a hassle to learn the underlying concept rather than (concept + (anally-retentive-compiled-only-syntax) ) at the same time
  • Reply 3 of 20
    slewisslewis Posts: 2,080member
    Quote:
    Originally Posted by Hiro View Post


    Python is already installed in OS X, although only the basic language packages. It works just fine and can even be used with they Python-ObjC bridge for a native GUI. If it gets wrapped into a Leopard Xcode it will only be that much easier to make native apps.



    I would actually suggest spending a week or two with Python to get into the feel of an imperative language, start with this online book: Think Like a Computer Scientist. Once you work through Ch8 of 20 you should be ready to transition to C. I like O'reilly's Practical C, but others may have more up to date suggestions. Practical C is good as long as you ignore the compiler/IDE specific stuff early on, it was written in the late 80's/early 90's so is a bit dated in that part, but it covers the language well and has good gouge on program design/style. When transitioning, just take the concepts you learned in the week with Python and wrap those in C's slightly different syntax.



    Eventually you can transition to Obj-C, I would work through the Python book ch9-20 first to get the object related concepts then jump to the Obj-C syntax. I don't have a great book for that, I made the jump blind based on a couple other languages worth of experience and the Hillegass Cocoa book.



    Some won't like using Python as a stepping stone, but the syntax is less fru-fru'y and you can try stuff in the interpreter, both of which make it less of a hassle to learn the underlying concept rather than (concept + (anally-retentive-compiled-only-syntax) ) at the same time



    Someone suggested "C Primer Plus" for C. would that be a more up to date alternative that is just as good?

    Thanks



    Sebastian
  • Reply 4 of 20
    newnew Posts: 3,244member
    Ruby is way cool.
  • Reply 5 of 20
    Ok dokey, thanks for the help guys. So the general consesus is that I should read the 8 chapters, dabble in Python, and then figure out Objective C?



    Having never used xCode before - it looks a bit daunting now that I have just installed a 2Gb folder onto my HD - am I best to just type python into the terminal and work in there?
  • Reply 6 of 20
    hirohiro Posts: 2,663member
    Easiest is to go to python.org and download the Python 2.5 package. It comes with the Python IDE IDLE, which also doubles as the Python shell. [forgot to mention that earlier] The default OS X version is still something like 2.3.5 with no IDLE. IDLE is far simpler for beginners.



    Go to Xcode when you want to start tackling C, use a C book to transition the Python things you learned into C syntax and learn how to get multiple file C stuff compiled in Xcode (understanding header files). Make sure you have a clue there before you go back and push into the object-oriented part of the Python book, get thru that, then straight into Obj-C. Cutting out a step may sound faster, but I guarantee you that you will have fewer head banging problems and progress faster in Obj-C if you drink the flavor of Kool-Aid I'm suggesting.



    Good Luck!
  • Reply 7 of 20
    Quote:
    Originally Posted by G_Warren View Post


    what is THE programming environment for OSX? I am quite keen to learn something a little more challenging and see what I can do.



    If you want to write mac apps, then don't waste your time with Python. Use Xcode. Python has its own pros and cons, but ultimately you'll do yourself more good by learning to write C and/or objC-based apps using the well-documented Mac APIs.



    You might also do yourself good by learning POSIX C. It's simple, and ports easily into Mac, Linux, and other POSIX OSes. It doesn't contain the pretty bits, like display layers, windowing, and other high level things like that, but it provides a very robust and portable skeleton that you can [potentially] run on anything from a sub-$99 electronic device to a giant server farm.
  • Reply 8 of 20
    As others have stated, if you want to do Mac programming, you really want to learn Cocoa and the Xcode IDE. I started learning Cocoa a while back, although because of my computer science course requiring java knowledge, I haven't made as much progress as I had hoped I would by now. Hopefully I'll be getting my first app out in 2007...



    Either way, I highly recommend Cocoa Programming for Mac OS X by Aaron Hillegass. It's pretty much the ultimate beginners guide to Cocoa and will teach you the fundamentals of object-oriented programming along the way. I personally didn't go through learning C to get here, I just jumped straight into Objective-C. As far as I was made aware by others advice, learning C just to get on to learn Objective-C would be like learning to drive an automatic car before learning to drive a manual; you pick up different habits that may not help when you want to transition to object-oriented programming.



    I also bought Objective-C Pocket Reference by Andrew Duncan, although this hasn't been as much help as reading the documentation by Apple, which is pretty darned extensive. From my point of view though, it is very daunting to look at them to learn, I found it easier to be guided through a couple of chapters of Hillegass' book then go off on my own to discover.



    As well as the Apple documentation, CocoaDev and Cocoa Dev Central are both invaluable places to look if you have a specific problem. Every time I have a problem, a solution (if it exists) can usually be found at one of the two. Also I found there are a fair amount of programmers here of various levels that are willing to help. Enjoy whatever you decide on!
  • Reply 9 of 20
    Thanks for all of the replies guys. Thus far I have been reading the how to think like a programmer using python guide. Whilst I don't intend to really learn python, it is a useful reminder I guess.



    So in short, I should be using XCode to make Cocoa apps written in Obj-C? Is that the general consensus?
  • Reply 10 of 20
    hirohiro Posts: 2,663member
    Quote:
    Originally Posted by G_Warren View Post


    Thanks for all of the replies guys. Thus far I have been reading the how to think like a programmer using python guide. Whilst I don't intend to really learn python, it is a useful reminder I guess.



    So in short, I should be using XCode to make Cocoa apps written in Obj-C? Is that the general consensus?



    That is your nirvana. The rest is to just get you there the fastest way possible. Not a reminder, but a far more productive way to learn the concepts inherent in ALL object-oriented imperative programming languages. Do more than just read the book, do the in text examples and exercises, your retention and understanding will be far better and sliding into C afterwards will be relatively painless compared to trying to start with C in the beginning.
  • Reply 11 of 20
    hirohiro Posts: 2,663member
    Quote:
    Originally Posted by Splinemodel View Post


    If you want to write mac apps, then don't waste your time with Python. Use Xcode. Python has its own pros and cons, but ultimately you'll do yourself more good by learning to write C and/or objC-based apps using the well-documented Mac APIs.



    You might also do yourself good by learning POSIX C. It's simple, and ports easily into Mac, Linux, and other POSIX OSes. It doesn't contain the pretty bits, like display layers, windowing, and other high level things like that, but it provides a very robust and portable skeleton that you can [potentially] run on anything from a sub-$99 electronic device to a giant server farm.



    You want a newbie to wrest with what is considered the hardest language to start with--C--on his own??? That's a recipe for discouragement and leaving programming behind.



    I agree that Python isn't the best language to use for writing native Cocoa apps, but it's usefulness as a learning acceleration tool before transitioning into C is excellent. Too many folks wash out of programming because they never "get it", where "it" is the basics of boolean logic, basic program organization and how to leverage that logic and organization against sequence, selection and repetition.



    Toying with a clean interpreted language is a big help in learning how the logic interacts with the controls structures, and the ability to cut/paste those snippets into a script is a nice scaffold to learn program organization from. After you have those in your personal toolset, any language in the C family becomes pretty trivial to pick up. And a newbie doesn't even have to "learn" Python to get to that point, just use it as the tool to test concepts against. The specifics of Python syntax are safely flushable once the concepts are in hand.



    It's more or less like going in the unlocked back door [Python], rather than trying to struggle with the locked front door [C], to get your keys that are right inside that front door [Obj-C+Cocoa].
  • Reply 12 of 20
    hirohiro Posts: 2,663member
    Quote:
    Originally Posted by danielctull View Post


    As far as I was made aware by others advice, learning C just to get on to learn Objective-C would be like learning to drive an automatic car before learning to drive a manual; you pick up different habits that may not help when you want to transition to object-oriented programming.



    Not really, every method call is just another C function, resolved in a slightly different way under the hood. The guts of every function and method call are just a series of procedural imperative statements. And to continue the horrible oversimplification of things, Classes can be looked at as just another form of scope.



    When learning programming in the beginning there isn't enough time to learn the "bad habits" of procedural programming that often get in the experienced programmers way of learning how to properly use an OO language. And it is impossible to write any Obj-C code without understanding the basics of C [the basics is well short of malloc'ing memory or in depth C I/O]. Jumbling up the order of learning concepts at the beginning has very little bearing on the eventual outcome other that adjusting the pain level of assimilating those concepts.



    In your particular case, Java is just another C family language once you mentally separate the libraries (which are not part of the language itself) from the keywords and operators (which are the language). So there was no need to pick up C specifically because you already understood 90%+ of the C syntax before you ever picked up the Hillegass book without even knowing it. Unfortunately the not realizing what you already knew part has somewhat got in the way and you have probably been trying to learn things over again which you could have much more easily mapped laterally.



    One of the beauties, and curses, of programming is that there are MANY ways to do the same thing or get to the same "place".
  • Reply 13 of 20
    Quote:
    Originally Posted by Hiro View Post


    You want a newbie to wrest with what is considered the hardest language to start with--C--on his own??? That's a recipe for discouragement and leaving programming behind . . . Too many folks wash out of programming because they never "get it", where "it" is the basics of boolean logic, basic program organization and how to leverage that logic and organization against sequence, selection and repetition.

    . . . Toying with a clean interpreted language is a big help in learning how the logic interacts with the controls structures, . . . It's more or less like going in the unlocked back door [Python], rather than trying to struggle with the locked front door [C], to get your keys that are right inside that front door [Obj-C+Cocoa].



    Why does everyone always have some axe to grind in these programming threads? Python is fine, albeit a little bit of a maverick syntactically. But if you want to write awesome mac apps, you're going to have to eventually use C, or at least objC.



    For the record, I fiddled with scripting languages for a little bit, and ultimately it didn't amount to much help when I finally needed to write more complex programs in lower-level languages (i.e. C). I see no reason not to go directly to C. Who cares if too many folks wash out of programming? It's not like it's the greatest thing ever.
  • Reply 14 of 20
    hirohiro Posts: 2,663member
    Quote:
    Originally Posted by Splinemodel View Post


    Why does everyone always have some axe to grind in these programming threads? Python is fine, albeit a little bit of a maverick syntactically. But if you want to write awesome mac apps, you're going to have to eventually use C, or at least objC.



    For the record, I fiddled with scripting languages for a little bit, and ultimately it didn't amount to much help when I finally needed to write more complex programs in lower-level languages (i.e. C). I see no reason not to go directly to C. Who cares if too many folks wash out of programming? It's not like it's the greatest thing ever.



    I invite you to answer your own first question. You seen hell bent against doing anything other that wading straight into Obj-C in the old fashioned sink-or-swim mentality. I have agreed several times that Obj-C/Cocoa is the way to go for writing Mac apps, but that doesn't make Obj-C a very good choice for learning how to program.



    I happen to care that there is too much crap software in the world written by cowboy geeks that want to keep programming safely secluded behind some mythical green curtain. One of the ways that is perpetuated is through making programming a rite-of-passage barrier and making that barrier as hard to pass as possible. Flat out, I think that's a load of crap way to handle the situation.



    So how do I personally try to address that? I work to find a better way to teach more folks basic programming. "Getting" the basics will at least let a potential programmer decide if they like programming and want to continue. Getting more programmers to "want" continue will eventually mitigate against the cowboy's who don't face near enough competition to clean their own personal programming act up.



    Did you know that 90% of failed government procurement contracts fail because of crap software, and that 80% of ALL software contracts over 100K lines, government and commercial, fail? Can you conceive of how much wasted money that is? And on post-mortem it is abhorrent that most of those failures are driven by unmaintainable code written by a couple cowboys on the team. Then someone else starts over because the functionality is still needed.



    My axe that's grinding here has to do with learning paradigms, not programming languages themselves. Python is a wonderful learning tool to open up the basics behind ALL programming languages. I don't use it for anything other than that although many others use it a lot.



    It is impossible to beat the immediate feedback of a shell session when you are trying to learn how to write boolean conditionals, and that feedback enables a whole different group to understand programming concepts than the group that inherently understands code in a write-compile-run paradigm. It even allows the folks who have the ability to understand write-compile-run right off the bat to accelerate their learning of future languages because they got the concept first, rather than a single language's syntax that eventually becomes an abstracted concept once they fight their way through learning an additional language. And the second language is something WAY TOO FEW programmers do. I advocate squashing that fear and difficulty before a budding programmer even finishes with the first language, it's completely artificial.

    </rant>
  • Reply 15 of 20
    g_warreng_warren Posts: 713member
    Thanks for the help. I've read a couple of chapters of the python stuff, and got the Programming in Cocoa for OSX book, which looks quite good.



    Just wondering though - I would be quiet interested in making a dashboard widget - does this really mean learning Java too, or is it possible to write widget with Obj-C? Thanks!
  • Reply 16 of 20
    sunilramansunilraman Posts: 8,133member
    Dashboard Widgets: http://developer.apple.com/macosx/dashboard.html



    Based on Web Kit technologies, Dashboard Widgets are created using a mix of HTML, JavaScript, and CSS. This extends the ability to develop Widgets to a very wide audience. If you know how to create a web page, then you know how to create a capable Widget. But Widgets aren't limited by their use of web-based technologies. They can tap into the immense power of Mac OS X. Better yet, you can create great Widgets in hours or days, instead of months or years.



    With Tiger, Xcode 2.0 includes the information and examples you need to get you started. The documentation for Dashboard is located in the ADC Reference Library (under the Apple Applications) and will help you learn more about the technologies covered in this article




    XCode XCode Xcode. Word.
  • Reply 17 of 20
    Quote:
    Originally Posted by Hiro View Post


    I invite you to answer your own first question. You seen hell bent against doing anything other that wading straight into Obj-C in the old fashioned sink-or-swim mentality.

    . . .

    </rant>



    Huh? The only thing I'm hell-bent on is good software. It's to the degree that I'd rather have no software at all than bad software. Unfortunately, most software developers I know don't really get this. They are focused on upholding various programatic practices, most of which were conceived with good intentions, but at the end of the day suffer from their attempt to satisfy all metrics all the time. This cannot usually be done well.



    What are these metrics? How about: runtime speed, memory efficiency, stability, maintainability, and portability. It's my belief (and experience) that people who have more experience with lower-level languages -- and who have basic understanding of how computers work -- will always do a better job with the first three metrics. Right away, that gets a lot of problems out of the way, especially since there are such a tremendous amount of resources available for dealing with the latter two.
  • Reply 18 of 20
    Quote:
    Originally Posted by sunilraman View Post


    But Widgets aren't limited by their use of web-based technologies. They can tap into the immense power of Mac OS X.



    This means you can call Cocoa commands. You could actually build a full app as a widget, but it's not recommended!
  • Reply 19 of 20
    hirohiro Posts: 2,663member
    Quote:
    Originally Posted by Splinemodel View Post


    Huh? The only thing I'm hell-bent on is good software. It's to the degree that I'd rather have no software at all than bad software. Unfortunately, most software developers I know don't really get this. They are focused on upholding various programatic practices, most of which were conceived with good intentions, but at the end of the day suffer from their attempt to satisfy all metrics all the time. This cannot usually be done well.



    What are these metrics? How about: runtime speed, memory efficiency, stability, maintainability, and portability. It's my belief (and experience) that people who have more experience with lower-level languages -- and who have basic understanding of how computers work -- will always do a better job with the first three metrics. Right away, that gets a lot of problems out of the way, especially since there are such a tremendous amount of resources available for dealing with the latter two.



    That's true. But trying to learn that low level stuff first just doesn't work except with extremely gifted individuals. Much better to get a coding clue and then delve deeper, otherwise you get clean low level code that doesn't do anything particularly interesting.



    My bottom lime is that there is a difference between what is best for initial learning and what is best for advanced best practices. Good basic learning sets the foundation, it's not the end state, you have to keep learning. But at least with a sane intro it is more likely that we will keep more programmers willing to keep going and then we can get them thinking in line with us. The universe of good software creation is largely a numbers game looking for well above average programmers. Unfortunately, the field is losing right now.
  • Reply 20 of 20
    Quote:
    Originally Posted by Hiro View Post


    That's true. But trying to learn that low level stuff first just doesn't work except with extremely gifted individuals.



    Possibly, but I'm not so sure. Honestly, I think the most natural kind of programming language to learn is a simple assembly, like MSP430 -- you put in an instruction, and you get out a result. With MSP430, you can also get real results with a $20 USB dongle, which is slick. So what if you're not "gifted." . . you have to find out sometime. Better to find out early on.
Sign In or Register to comment.