Programming as a Hobby

Discussion in 'Mac Programming' started by marco114, Dec 27, 2006.

  1. macrumors regular

    marco114

    Joined:
    Jul 17, 2001
    Location:
    North Carolina
    #1
    I want to learn a little programming and I'm not sure where to start. I'm 36, and I've been into computers all my life. I do a lot of web programming already in Lasso for about 8 years (see www.omnipilot.com) w/ MySQL databases, e-commerce, etc.

    I have never programmed applications. I'd really like to start building some applications that interact with MySQL. I've heard that Real Basic is good but others have told me XCode is also good (and free). Real Basic seems like it has the advantage of compiling in multiple OS (Windows, Mac Linux) which seems attractive, but not totally 100% necessary.

    Can anyone shed some light on where to start and if there are any books I should get. I've programmed in BASIC back in the Apple // days, but that's been a LONG TIME ago!

    10 PRINT "HELLO!"
    20 GOTO 10

    RUN


    :) Marc
     
  2. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #2
    well for cross platform look at Java, otherwise Cocoa is very very nice and makes making a GUI app very easy.

    A good book for Cocoa is Cocoa: Programming for OS X by Aaron Hillegass.
     
  3. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #3
    You'll want to learn Objective-C as well - Objective-C Programming by Steve Kochan is an awesome book.

    That program that you typed in basic, here's what it looks like in C, C++, and Objective-C
    Code:
    /* C */
    #include <stdio.h>
    
    int main()
    {
     printf("Hello world!");
     return 0;
    }
    
    Code:
    //C++
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
     cout << "Hello World!";
     return 0;
    }
    
    Code:
    //Objective-C
    #import <Foundation/Foundation.h>
    
    int main()
    {
     NSLog(@"Hello World");
     return 0;
    }
    
    Learn Objective-C it's easy, way easy. If you need to program for both Windows and Mac OS X - learn C++, Objective-C, and Cocoa.
     
  4. macrumors 68000

    tominated

    Joined:
    Jul 7, 2006
    Location:
    Queensland, Australia
    #4
    learn objective-c. if you know even the basics you can sort of understand it. Apps in xcode can end up being really good.
     
  5. macrumors 6502

    blaster_boy

    Joined:
    Jan 31, 2004
    Location:
    Belgium
    #5
    Depends

    It all depends how much time you can allocate to your programming. I've decided for myself on a scripting language like python :

    - human readable even after 6 months or longer of not having programmed
    - lots of functions available that touch on the web
    - gentle introduction curve

    It's also cross-platform !
     
  6. Wes
    macrumors 68020

    Wes

    Joined:
    Jun 22, 2001
    Location:
    London
    #6
    Surely you mean:

    Code:
    /* C */
    #include <stdio.h>
    
    int main()
    {
        while (1==1) {
            printf("Hello world!");
       }
        return 0;
    }
    
    And similarly for the others ;).
     
  7. macrumors regular

    Joined:
    Nov 23, 2006
    #7
    I'm pretty sure he doesn't ;)
    That will print it forever, going down a line each time. In command line (terminal) printing it once would be fine, as terminal won't close until it you tell it to. And even if you wanted to print it forever, it would be better to do:
    Code:
    /* C */
    #include <stdio.h>
    
    int main()
    {
        while (1) {
            printf("Hello world!");
       }
        return 0;
    
    Or, even better
    Code:
    /* C */
    #include <stdio.h>
    
    int main()
    {
        for(;;) {
            printf("Hello world!");
       }
        return 0;
    }
    But most modern compiler will optimize the while(1) {}, though for(;;) {} is better programming practice ;)

    I just picked up python yesterday, and I absolutely love it! Slices seem like an amazing feature, and the built in function foreach object (EVERYTHING in Python is an object) leaves a great amount of power, and ease.
    Acourse, it will never be as powerful as C, C++, or Objective-C. But it may be as powerful as Java since they are both compiled into bytecode... But Java may have a leg up, not sure...
     
  8. macrumors 6502a

    #8
    I would also second Python as the best option, given no further information to work on. The thread header says hobby and I think it is hard to justify suggesting something like C to someone who very likely has limited hours in which to work. Python will have a faster and shorter learning curve and simply be more rewarding and fun.

    For example:

    I would actually say that something like Python is much MORE powerful than C / C++ as much more can be achieved for significantly less effort (although this is always going to vary with your interpretation of powerful, of course)

    Sure, there are things that cannot be implemented in Python, but these form a small subset of most programmes / functionality and are often not the subject of hobbyist programming (or perhaps better phrased as not the domain of a hobbyist programmer asking where to start learning programming).

    In the case of MySQL that the OP asks about, this can be done interactively and in only three or four lines of code and something a technically competent beginner could likely achieve in their first few days. How long is the same thing going to take for someone starting from scratch with C?
     
  9. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #9
    The original basic code was an endless loop as well. I guess if you were translating it directly he would indeed mean that.
     
  10. Wes
    macrumors 68020

    Wes

    Joined:
    Jun 22, 2001
    Location:
    London
    #10
    I don't see a newline character in there, don't believe it's going to go down a line at a time, and the original code did repeat forever too, if we're getting picky. ;)
     
  11. macrumors member

    Joined:
    Sep 19, 2004
    Location:
    Bay Area, CA
    #11
    If you want to develop web application with MySQL - PHP is a good starting point. Another way is Rails - web framework based on Ruby programming language.
    In case you are looking for good general purpose language - both Python or Ruby are great. With Python you can use cgi module for simple web applications and Django web framework for complex web apps.
    PHP, Python and Ruby have implementations for all major platforms.
    Objective-C with Cocoa is your ticket for MacOSX application development. Do not even consider C/C++/ObjC/Java for lightweight web development.
    There are tons of books that cover basics and web development for PHP/Python/Ruby - check corresponding web sites and amazon.
    Good luck!
     
  12. macrumors 6502a

    mac-convert

    Joined:
    Nov 2, 2006
    Location:
    Are we there yet?
    #12
    And here is Hello, World in about any programming language that you care to pick!
     
  13. macrumors 6502

    blaster_boy

    Joined:
    Jan 31, 2004
    Location:
    Belgium
    #13
    I agree with you - it isn't for everything, especially if you need speed. But it's fine for those of us who only program from time to time, and if you don't know any C variants or Java it's a very good language in which to get things done with a minimum of fuss.

    I'm always surprised at how short my programs are and the result I can get. Often I have more comments in there than actual code (but maybe that's me) !:D
     
  14. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #14
    I'd say powerful programming is programming where you have finite control like with C, C++, Objective-C, Java, etc.
    I would rate them, in order of power, in this order:
    C
    Java
    C++
    Objective-C

    C being the most powerful language, and Objective-C being 4 most powerful language. That's just how I interpret it.

    EDIT: Uh lets change that, sinces objects make a programming language more powerful how about:
    1 - Java - versatile, has tons of features, simple, but still has finite control, compatible with tons of OSes
    3 - C++ - versatile, has tons of features, easy to use, but can be confusing, has finite control, compatible with lots of OSes
    2 - Objective-C - Very very easy to use, very secure, when it comes to classes, compiles even with programming errors, step it up with C++ features and sdks, etc.
    4 - C - do I need to say why? most hackers and virus programmers use C so yeah.

    there we go, C is the 4th most powerful, and java is the most powerful.

    EDIT: Said why one is better than the other
     
  15. macrumors regular

    Joined:
    Nov 23, 2006
    #15
    Um, no. You can't just list them a certain way just because you feel like it.

    This is how it is (from my interpretation over my learnings)

    1.) C++
    2.) Objective-C
    3.) C
    4.) Java
     
  16. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #16
    Personal opinion, yes I can, absolute, no.
     
  17. macrumors 6502

    Joined:
    Jul 25, 2006
    #17
    I like Flash. Here's your little program in Actionscript.

    trace("Hello World")

    :p
     
  18. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #18
    Or batch:

    echo "Hello World"
     
  19. macrumors regular

    Joined:
    Nov 23, 2006
    #19
    Um, no you can't. I'm not tryin to argue, but the power of a language doesn't change by your opinion. Your preference can change all it want. But C++ is the most powerful. It is the most raw, so arguably is the easiest to get into trouble with :)p). Java is the least because its translated into Bytecode, so it HAS to be slower, and Objective-C is faster then C because it IS C but with MORE features and strong points.

    Sorry, but because you feel better or think one is stronger then the other from day does not make it true. Please don't post misleading information.
     
  20. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #20
    My opinion is my opinion, and facts are facts. My opinion stands, but the truth may be different. I can have my own opinions I'm entitled to them so there =P. hehe
     
  21. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #21
    I think you can easily argue that "power" is subjective. Does it mean the fastest? The ability to do the most low-level tasks? Ability to do things using the least amount of code? The most features or largest API? The power to get more done in a given amount of time? You can justify just about anything you want.
     
  22. macrumors regular

    Joined:
    Nov 23, 2006
    #22
    3/5 of those do describe C++ (out of the above fore mentioned Languages)
    So I think it's safe to say C++ is the most powerful :p
     
  23. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #23
    I change my vote:
    Objective-C is the best in my opinion, cause it gives me the simplicity and power I need to make my own programs. There I said it =P
     
  24. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #24
    Hi Marc,

    Out of C, C++, Objective C and RealBasic, I think RealBasic would be the quickest to learn and to be productive in. It is very easy to use and you can be creating applications with user interfaces in next to no time. It's definitely worth spending a couple of hours playing around with it to see if it's what you want.

    b e n
     

Share This Page