![]() |
Object Oriented Programming tutorial
1 Attachment(s)
Still a little rough, but I think it gets the ideas across for a mindset that is more adaptive to learning gs2.
Please feel free to modify/correct/edit and repost revisions to this as needed. It is for the newcomers to the gs2 community, and can be openly modified by those in the know. (scroll down for latest version) |
Put it on the GraalBible.
|
Quote:
|
Quote:
Other than that, looking interesting. |
Hmmm Prozac you forgot to put the cup down before leaving the washroom :)
It's a good start I think, although it's more a general programming introduction not only about object oriented programming |
Hmm.. I think your section on Constructors is a bit flawed. Should try looking up what a constructor is before writing about it :)
Quote:
|
Quote:
|
ya, thought I might forget some stuff on the first draft.
thanks for the feedback though. Will see what I can do - or, as mentioned, feel free to 'fluff out' the doc as you see fit and post updates of it on here. I may not get back to it for a while. |
Quote:
|
I hardly consider GS2 an OO language. It has some OO concepts yeah but it's not completley object-oriented.
While each NPC does act like a class you cant make relationships between them (either inheritance or association) you can 'inherit' the classes in the class list on the server (which are basically deferred classes). I can call functions on an NPC by using triggeraction but really I should be able to do npcname.functionname. I can't do this: object = new Class(); (Please correct me if i'm wrong) which means I cant pass objects around. Sure there's the player object which can always be accessed but sometimes it can be useful. (Admittedly not often given the usually small nature of scripts in graal.) While GS2 has some OO concepts its OO model is quite limiting. Though of course it is just a small scripting langage and not a full programming language and doesn't really need a sophisticated object model. Anyway, what you have there might be quite useful to non-programmers but some of the explanations might serve the opposite purpose you're using terms like code block without saying what a code block is also, i'd use GS2 only. Doesn't make sense to say "Here's some code but don't do it like this." it's like teaching java and saying "Heres an example GUI in AWT but you shouldn't use AWT you should use Swing or SWT." oh well just my $0.03 (Damn inflation.) |
Quote:
Quote:
PHP Code:
PHP Code:
Quote:
PHP Code:
Quote:
PHP Code:
|
Quote:
Quote:
PHP Code:
PHP Code:
|
| All times are GMT +2. The time now is 02:10 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.