Best Way for 14-year old to learn Object Pascal?

My 14-year old son thinks the Castle Engine looks really cool when he sees me trying to play with it. He’s been learning the-ever-popular Python programming language for the last few years and has coded a few simple 2D games using PyGame. And he knows enough Lua to modify Roblox. I myself only know enough Pascal to be dangerous. What material or source would you recommend directing a youngster in order to learn Object Pascal in a fun way that would then prepare him/her for game programming in the Castle Engine? I’m thinking of something along the lines of this friendly QB64 Game tutorial

Good question! I also don’t know the answer but I’m eager to learn it. If anyone has good resources to answer this question, I would be happy to read them and spread the word about them.

My only contribution to teaching Pascal so far was the Modern Object Pascal Introduction for Programmers | Castle Game Engine book. But this is not directed at people who just start learning to code, on the contrary – it is directed at people who already know how to code (though maybe in different language than Pascal, or maybe they only know Turbo Pascal from old days without OOP) and want to pick up modern Pascal.

My now-5-year old daughter looks with fascination when I develop Castle Game Engine and we’ve been playing a lot in editor duplicating / moving funny animated 3D objects :slight_smile: But she’s not yet at a level to pick up coding, or just writing. But she will be, soon, I know – I need to figure out some way to explain to her all this “stuff that daddy spends his life on” :slight_smile:

My current best resources I can recommend to young people are not about Pascal, but still worth listing:

None of the above is about Pascal – Python is a leading theme. (A pity, but in the end I think learning concepts and precise thinking is crucial, and the actual programming language is secondary, programming language is just a tool. If someone comes with good understanding of objects in Python, then my Modern Object Pascal Introduction for Programmers | Castle Game Engine can maybe be good enough to teach them Pascal syntax.)

1 Like

I wonder if your son has any interest in “industrial archeology”.

Maybe it would make sense (maybe not, very personal) to give him original “Pascal report” of 1974 and then some brief overview of later Wirth’s works (Modula2/Oberon/Component Pascal), and also differences of “American” and “English” language designs.

In particular i did not know that now ubiquitous “else” keywords was invented by Germans who did not command native English (even, due to it). But i remember when i started learning English in school i was very puzzled with how rare “else” word in real English texts meets. Also, it retroactively explains the “asymetric” syntax the “else” has in C and C-derived languages lacking “then” (even Python).

Now, it is highly subjective, but for me learning Pascal and C history gives explanations to language quirks, and makes those quirks reasonable and expected, that otherwise would be anomalies that i would have to memoize again and again every week or two. Also, the history of computers is fascinating itself, like one of any other industry in the span of its post-birth neck-breaking development.

Of course, if your son’s goal is to “get to business” ASAP, then this savouring of the things long obsolete would be nothing but time waste. But i always abhored memoisation, i am almost incapable of it anyway.

1 Like

Pascal - a great choice for learning how to program, for Niklaus Wirth conceived it as an educational. So the basic concepts of structured and OOP (as Object Pascal) programming can be learned. However, it is compilable, which will also allow you to learn how to manage memory. But unfortunately it is not a system programming language (like C, C++, D, Rust, etc), so you can’t write OS drivers and kernels on it.
As for Castle Game Engine, read the above introduction from the creator of the engine, take apart the examples of the engine and go ahead. This is how I make a clone of Eye of the Beholder.

1 Like

Pascal can be used to write OS kernels, or Linux kernel modules (drivers). People do it :slight_smile:

1 Like

I apologize for the delayed response everyone (work, big side projects, vacation, etc…). Thank you for input everyone. @Arioch, yes my son is fascinated with linguistics and enjoys lectures by the linguist John McWhorter about proto-European, proto-Germanic languages. Very interesting about the formation of the word ‘else’. @michalis thank you for all the references. I’m sure your daughter will be excelling at programming soon! :slight_smile: I believe I’ve found some Object Pascal-specific material that may work for my son. One of the more approachable books on Object Pascal I’ve found is by Howard Page-Clark, ‘Learning Lazarus’. And the pascal video series by Swinburne University is friendly enough for my son to comprehend. I contacted Andrew Cain, one of the Swinburne University instructors and he was so kind as to give me a copy of his book “Programming Arcana” which covers both Object Pascal and C++. @sthox you should check out Infinite Mac where you can pretend like its 1991. I found some example Pascal code within. So very cool!

2 Likes

Very awesome, what more can I say

1 Like

“Programming Arcana” book - hmmmm, interesting, but I don’t see any other information about this book except for the document on Scribd and the source files on github, it’s strange.

1 Like

Yes, the 678-page book has no ISBN from what I can tell. And it appears it’s used ‘in-house’ at Swinburne University. I asked professor Andrew Cain if I could share the material for his video course and he said ‘Sure thing.’ So, for those that may be interested. The Swinburne University video course makes use of a graphics library, but has since changed to a newer graphics library called SplashKit written mainly by Andrew Cain.
If you follow along with the video tutorials then you will need to include this Unit file named ‘TerminalUserInput.pas’ which offers some basic IO:

unit TerminalUserInput;

interface

///
/// Displays a prompt to the user, and reads in the string
/// they reply with. The string entered is then returned.
///
function ReadString(prompt: String): String;

///
/// Displays a prompt to the user, and reads in the number (whole)
/// they reply with. The function ensures that the user's entry
/// is a valid Integer. The Integer entered is then returned.
///
function ReadInteger(prompt: String): Integer;

///
/// Displays a prompt to the user, and reads in the number (real)
/// they reply with. The function ensures that the user's entry
/// is a valid Double. The Double entered is then returned.
///
function ReadDouble(prompt: String): Double;


implementation
uses SysUtils;

function ReadString(prompt: String): String;
begin
	Write(prompt);
	ReadLn(result);
end;

function ReadInteger(prompt: String): Integer;
var
	line: String;
begin
	line := ReadString(prompt);
	while not TryStrToInt(line, result) do
	begin
		WriteLn(line, ' is not an integer.');
		line := ReadString(prompt);
	end;
end;

function ReadDouble(prompt: String): Double;
var
	line: String;
begin
	line := ReadString(prompt);
	while not TryStrToFloat(line, result) do
	begin
		WriteLn(line, ' is not a double.');
		line := ReadString(prompt);
	end;
end;

end.

And last but not least, here’s a link to the Programming Arcana book. :mage:

2 Likes

Wow, many thanks for that and the explanation, now I have something to read tonight

1 Like

Cheers! :beers:

Thank you for the links, I’m now browsing

They both seem like fantastic resources, they go into explaining basics which are really the hard parts to learn (because you need to “start thinking like a programmer – everything is precise instructions / types”) from what I can see. Amazing, thank you for sharing. I will think how to link to it from Modern Object Pascal Introduction for Programmers | Castle Game Engine (a link on sidebar to additional resources, like these ones, would be good I think).

Note: This forum is public and indexed by search engines. So note that the book PDF can be found now by general public. I understand this is OK.

1 Like

I created a page on our website to collect links to various valuable Pascal resources: More Resources to Learn Pascal | Castle Game Engine . In particular I linked there Swinburne University videos and “Programming Arcana” mentioned in this thread.

Over time I collected a lot of links to Pascal resources, I hope this will be useful to everyone :slight_smile:

3 Likes