Newbie Developing

Discussion in 'Mac Programming' started by mh10190, Aug 9, 2005.

  1. mh10190 macrumors newbie

    Aug 9, 2005
    Hi everybody
    Im wondering
    Im starting out in programming
    im wonderng how would i go about learning programing in the
    cheapest way possible
    i want to make cross platform programs
    what i want to do is make basic and advanced
    business software
    and overall just see what i can do in the open source community

    i got a few online books and i downloaded Eclipse
    im thinkin i should start out with
    then slowly get into C/C+++
    all the while learning scripting languages

    what is the best solutuion for my problem
  2. adamjaskie macrumors member

    Java is a good language to start with because it does some of the lower level stuff (memory management) for you, and is pretty strict about the way you do things. It helps you learn to program well. I started with C++, myself, and I like it better than Java as a language, but Java is great for learning.

    As for scripting languages, don't learn Perl until you know Java or C++ really well. It will ruin your programming style otherwise, because it introduces lots of lazy habits ;) I don't know about Python and the like, though.

    If you are planning on going into this as a business, you will need to take some classes eventually. There are some things (not language things, theory things) that you can't easily learn from a book, as there is more to programming than just knowing the language really well. Knowing the language like the back of your hand HELPS, but you are eventually going to need to take some classes in algorithm design, data structures, databases, computer architecture, etc.
  3. HiRez macrumors 603


    Jan 6, 2004
    Western US
    Python is a great scripting language with an elegant and efficient syntax, unlike Perl which is torturous to read. I would definitely recommend Python for a beginner's scripting language. Java is a good choice for a first "real" language as well, although I wonder if ANSI C wouldn't be better. I had a hard time having to learn memory management and pointers going from Java to C when I never had to deal with them in Java. ANSI C will teach you so many low-level basics that you can and will use in almost any language, be it OO, procedural, or scripting (for/while loops, function calls, bit shifting and masking, primitive types, variable assignments, arrays, structs, operators and evaluation ordering, print statement formatting, basic file i/o, etc.).
  4. adamjaskie macrumors member

    Yeah, ANSI C might be a good choice. C++ though, is kinda only half object-oriented. It probably isn't a good first choice, although I managed to get through it as a first language. Java doesn't teach you memory management, but it does teach OOP, and it teaches it very well. OOP is what people want nowadays. Also, without learning pointers and memory management until he has some other programming experience under his belt, and perhaps learning C in a programming CLASS, rather than from a book, he is less likely to learn poor programming habits that will take a long time to un-learn.

    Straight C is limited enough that it will teach you a lot about computers, while Java is strict enough that it will teach you some good habits. Whichever one you decide to start with, once you know it well, learn the other one.

    Perl is great for whipping up quick little scripts, and if you spend some time writing it well, it is plenty readable. However, all the little ways it has in it for you to be lazy and save a few seconds of time when writing a script come back to haunt you when you try to figure out what that script does six months down the line. It is a good fifth or sixth language, though, and everyone really should learn it, especially if you are interested in system administration or web stuff.

    EDIT: Some hints no matter what language you choose:
    1. Use meaningful variable names. A few more keystrokes now when naming your variable takes a lot less time than scrolling around trying to find what you are using "n" for.

    2. COMMENT YOUR CODE! Any time you do something particularly complex, separate out that block of code with a bit of white space, and put a comment explaining what you are doing, and how you are doing it. At the very least, document what each function does, and toss in a short comment telling what all of your loops are doing. If you think a particular bit of code is a messy way of doing something, say so. You will thank me when you go back to your code in six months and can still understand what you were thinking.

    3. Break your program up into functions. If you have some bit of code you end up pasting in two or three times, it should be a separate function. If you have a function that takes up two or three screens, try to break it up into two or three functions (as long as that makes sense to do). Sure, function calls take a bit of time, and make your program (slightly) less efficient, but most compilers will optimise that out, and when you are first learning to program, that really isn't the time to be THAT worried about efficiency. Algorithm complexity, sure, but not the tiny amount of time lost on a function call.
  5. rinseout macrumors regular

    Jan 20, 2004
    Somebody said something similar on one of these boards a couple of weeks ago or so when they said made the claim that "C++ added in object-orientation as an afterthought." Both statements are ridiculous. I have the feeling that these kinds of things result from C++ being strongly-typed, or maybe it's that there's no built in "root class" in the hierarchy. Maybe it's because there are primitive data types. Maybe it's because of the way you need to handle memory.... I don't know.

    I keep reading these kinds of statements here, though, and the truth is that object-orientation in C++ was not an afterthought, but a design goal (and one that was met!)

    I have a feeling that the people who write these kinds of things actually mean something different than what they've written, because what they've written is completely wrong. C++ is difficult to learn, sure, but it's not half-baked OO. It's a different flavour of OO than, say, Obj-C, but it's still OO.
  6. adamjaskie macrumors member

    I like C++. In fact, I prefer it to Java. I do not mean that it is in any way "inferior" or "half-baked". What I mean is that it just isn't as... strict as Java. In C++, you can use it as a procedural language, like C. I like this. It adds flexibility. But it also makes it not a good beginning language (even though it was my beginning language).
  7. rinseout macrumors regular

    Jan 20, 2004
    I see what you mean... I thought you were saying that somehow C++ was not a fully fleshed-out OO language. Of course it is, but it also contains C which is procedural. I don't know any Java (anymore), but isn't it possible to write a procedural Java program if you wanted to?

    Anyway I like C++ too.
  8. adamjaskie macrumors member

    IIRC, to do a Hello World in Java, you have to do something like the following:

    class HelloWorld 
        public static void main(String[] args)
            System.out.println("Hello World");
    You have to have at least one class. Sure, you could write a procedural program enclosed in a class, but that wouldn't make much sense.

    In C++ you can specify an entire program made up of only global functions and variables. Java has no global functions or variables, so everything MUST be done through classes.
  9. ham_man macrumors 68020


    Jan 21, 2005
    ANSI C. The basis of most modern languages and very easy to learn...

Share This Page