# Newbie request



## Mac Osxtopus (May 19, 2002)

I want to learn how to program stuff, but i don't know where to start! could anyone help me with some basics on something for me to learn? applescript, anything?  Sometime I want to build my own game, a basic one like 3 level tetris or something for mac os x.


----------



## Trip (May 19, 2002)

Hey! Welcome to the world of programming! It's fun and easy at sometimes...but like they say: what goes up, must come down. So it can be frustrating, time consuming, and really hard at sometimes!

Anyway, it is a great thing. If you are starting off as a new programming I'd suggest REAlbasic. You can download a trial version of it from that website, it's easy and fun! If you need help just let me know! (It comes with tutorials).

Again, welcome.


----------



## iconara (May 20, 2002)

Why not start in the right end and learn a real language like Java? There are plenty of resources available, and you can use the language for just about anything, anywhere. Once you know Java, C/C++/Objective-C/Insert-your-language-here is no match.

Another good language to start with is Python (www.python.org), it's a interpreted (as opposed to compiled) object-oriented language with a nice syntax. You can do pretty much anything in Python as well, and with Jython, the Java version, it's brilliant.

I'd stay away from REALBasic, learn something else first, don't start there, you'll learn many bad habits you will regret having later on. The same with Perl and PHP, it's a good thing to know, but one should not start there.

My favourite language is JavaScript, that's what I started with. It has a nice syntax and interesting object-orientedness which is as far from Java as any C-resembling language is. It has, however, a rather limited scope, there are few platforms save for web browsers.


Theo


----------



## dricci (May 20, 2002)

I started with REALBasic. It just seems to be the only environment and language that is human enough to make sense. Of course it is out of my price range so I gave it up.

REALBasic is plenty for some people, but you may need more power, so if you plan on programming for a living or doing a lot of it, stick with C or Java.


----------



## Trip (May 20, 2002)

Well, that's something I forgot to mention.
In programming their is an never-ending dual. Between all of the programming languages out there, all 'programmers' have their personal opinions. It really depends on what YOU are interested in programming.

You stated that you wanted a simple tetris like game, so I suggested REALbasic. If you want to build more advanced things (like Watson) then try AppleScript Studio (Apple's Developer Tools). If you want something even more advanced (Quake 3, Carracho) then try C/C++ (Apple's Developer Tools).


----------



## symphonix (May 20, 2002)

If you're looking at Java, might I suggest BlueJ. It is a very simple development environment which makes it very easy for the programmer to try out ideas and experiment with code. We use it at school as the perfect starting point for learning OO programming. (And, not to mention, it is free software)

If you don't already have the developers' tools CD, get your hands on one (its probably worth just waiting until the next release now, since 10.2 will almost certainly mean another update of the dev-tools) and take the time to look through the source code.


----------



## Mac Osxtopus (May 25, 2002)

I downloaded  BlueJ, realbasic, but not python since there were so many versions i wasnt sure which one was for os x. BlueJ downright admitted that this app isn't meant for complete newbies. The only thing CLOSE to java or programming (to me, at least) is applescript(which i always can't seem to get my scripts to work), and terminal(which i know little). Could someone give me a littel bit of basics or something for me to start on?


----------



## iconara (May 25, 2002)

This is Java-hello-world:

put this in a text file called HelloWorld.java:


```
public class HelloWorld {

	public HelloWorld( ) {

		System.out.println("Hello World!");

	}

	public static void main( String[] argv ) {

		new HelloWorld();

	}

}
```


Then you use the terminal to compile it (">" is the prompt):

> cd the/directory/where/you/put/the/file/
> javac HelloWorld.java
> java HelloWorld

notice that the last line says "java HelloWorld" not "java HelloWorld.class" or "java HelloWorld.java".

homework before next post: find out what this does.



MacPython is probably the best start for a newbie python programmer: http://www.cwi.nl/~jack/macpython.html

HelloWorld in python:


```
print "Hello World"
```


This is an example of how different languages are made for different things. In Java, the Hello World example is quite long, and in Python it's really short. If we make an example where we want a window with a message text saying "Hello World", then Java will probably be the shorter example.


theo


----------



## Mac Osxtopus (May 25, 2002)

I went into terminal and did all the stuff up to java helloworld, and i got this:
Exception in thread "main" java.lang.NoClassDefFoundError: Helloworld (wrong name: HelloWorld)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
And i don't know what you meant to use ">"


----------



## nkuvu (May 25, 2002)

Check your syntax.  HelloWorld is not the same as Helloworld.  Java's  case sensitive, IIRC.


----------



## Mac Osxtopus (May 25, 2002)

Well it must be case sensitive even for spacing, because once I changed it from "Hello World!" to "HelloWorld" in what to print it said HelloWorld! in Terminal.


----------



## symphonix (May 25, 2002)

Congratulations! You are now a Java programmer. Put that on your resume.  

Have you got the developer tools CD from Apple? Get your hands on an up-to-date copy and have a look through the java examples. Java is actually really good for certain types of game-programming. It's simple object-oriented format means it works well where a game is made up of many different objects that behave in certain ways, such as tanks and soldiers in a strategy game, or people and monsters in an RPG.

I pointed out BlueJ to you as it is an excellent "test-bench" for learning Java because you can get around all the command-line stuff. That is, you can create a JAVA file, which defines an object, and compile it by point-and-click into a CLASS file.
Then, you can create INSTANCES of the object on an "object-bench" by right-clicking and selecting "new". These will each appear as little blocks on the bench area, and you can call their routines directly and examine how they react and what is going on inside the code.

Apple has a really good example program on their developer tools CD (I think its called BlastApp) that shows how a game might be made with Java. It goes something like:
- It defines an object called gamepiece.
- Good-guys and bad-guys are all an extension of game-piece.
- enemy base is an extension of bad-guys, but with the ability added to launch missiles (yet another object of type gamepiece)
- enemy tank is an extension of enemy base, but with routines added to allow it to move around.

... and so on. The idea is, you don't have to re-type code. If you want an enemy helicopter, you could just extend the enemy tank class but add a routine for making it move up and down. That way, once you've got something working you can build on it without having to re-invent the wheel.

I also recommend mucking around in RealBasic. I've not used it much, but you can make programs quickly and effectively and compile for Mac and Windows.

Anyhow, once you've found a language and an environment that suits your tastes, it'll be just a matter of patience to learn it. Keep experimenting and hunting around. Good luck!


----------



## Mac Osxtopus (May 25, 2002)

well all i found close to the words blastapp were "Bombapp" which was this stupid thing in the developer's CD in where this window came up with a picture of a bomb and a fuse with the button "light  it!" when i clicked it, it played the animation of the bomb lighting...then blowing up, then static tv picture....then it unexpectadly quits =p....erm..update! i found it =p i just hate indexing 26 thousand something files in the developers folder.


----------



## Mac Osxtopus (May 25, 2002)

i built it to try out the game...man thats hard...plus the demo looks fake..how the hell does the copter move that fast? Thats somewhat of a good example, except for one thing...thats not just java.....its cocoa.................so i dont know which part is cocoa or java.


----------



## kainjow (May 30, 2002)

I learned REALbasic first, and I basically mastered it. You can complex things like Watson on their pretty easily if you think. But now, I'm getting bored with the language and so I'm learning Cocoa (doing pretty good so far!). That's what I would do, learn REALbasic first because it's easy to understand, then master it and move on. You won't be able to find a job using REALbasic, it's just for fun and shareware/freeware developers.


----------



## Kris (May 30, 2002)

> _Originally posted by iconara _
> *I'd stay away from REALBasic, learn something else first, don't start there, you'll learn many bad habits you will regret having later on. The same with Perl and PHP, it's a good thing to know, but one should not start there.*


Correct me if I'm wrong here, but why sholdn't one start with PHP or Perl? PHP is object-oriented, right?, and uses some of the same concepts as i.e. Java. I was once told programming PHP would give you the same concepts of OOP as Java. Isn't that correct?

Back to the ogininal topic: Mac Osxtopus: I would recommend Java. Java is relative simple, and (as iconara already has shown) it gets you started in a minute. Your knowledge will increase fast. Good luck, -programming is fun! 


Kris


----------



## Mac Osxtopus (May 30, 2002)

I'm taking lessons on C (C++ i'll learn over the summer and in school next year) to get ahead for the next year. so far I've made an adding/subtracting calculator and a calculator that lists farenheit and celsius. I'm using project builder( apple developer tools) to write the C and terminal to compile them.


----------



## benpoole (May 30, 2002)

If you want to muck around with Java, and gaming, why not try Robocode? I've been playing with Java for a while, and this has kick-started me into REALLY playing with Java:

http://robocode.alphaworks.ibm.com/


----------



## Mac Osxtopus (May 30, 2002)

I'll check out that site a bit later, but i got a big paper due today, so i'll check it this evening.


----------

