RetroMacCast

Where great old Macs live again!

Object Oriented Programming in Apple IIGS

Apple IIGS is a great platform for writing applications. There are many programming languages available, and the most famous set of programming languages came from a company named Byte Works. It has everything from assembler to Modula-2. But the one I like best, is the language called Orca/Pascal. This is because it has a little hidden gem - it supports the Apple Object Pascal extension. This makes it a great language for learning Object Oriented Programming!

Object Pascal has very simple object syntax. To define an object type (class), the codes look like this:

type
snow = object
x: integer;
y: integer;
procedure setup;
procedure move;
end;

To define a method, the codes look like this:

procedure snow.setup;
begin
x := randomInteger mod 320;
y := randomInteger mod 100;
end;

To access the object's properties and methods, Object Pascal uses the dot syntax like snow.x and snow.setup. If you are interested to know more, you can refer to this article (although it is written for Mac).

It is so simple that anybody can easily pick up the concept easily. In fact, my 8 years old son Ding Wen did just this. Today he has just written his first object oriented program called Snow.



You can read the source code for Snow here.

Ding Wen is now writing his first Object Pascal game called Invader War. If you are now running Firefox or Internet Explorer on a PC, you can test drive Invader War here.



I have also written a few Object Pascal demos. You can find some of them here:

- Stars
- Bouncing Balls
- Space Game

Programming is fun!

Views: 255

Comment

You need to be a member of RetroMacCast to add comments!

Join RetroMacCast

Badge

Loading…

© 2018   Created by James.   Powered by

Badges  |  Report an Issue  |  Terms of Service