Page 4 of 6
Posted: Sat Feb 18, 2006 4:25 am
by Dare2
OK, so apart from being something I wagged in school, classes are what? A way to allow multiple, um, declarations (or whatever term) of an object, as in fsw's linked list? Creating several instances of the object?
I'm missing something, but what difference between an object definition and a class? Surely you can define multiple instances of the object without classing it? It Class just a sexy way to say that?
So we have an object (definition).
We have an instance (usable entity).
We have a class. (Which sounds classier than creating an instance)
And a subclass is then what - tacking an object definition to another object definition? But in a cool way?
* takes a headache tablet *
Also, is there a way, via interfaces, to dynamically access one of the procedures in the datalist? Without actually referring to it by name?
For example, using
CallFunctionFast(?procedures + (n * 4)) will access the n
th procedure in the list. Can something like this be done using the interface/oop-ish approach being explored here?
Or are we stuck with (the still usable but now deprecated) callfunctionfast?
Posted: Sat Feb 18, 2006 5:35 am
by netmaestro
Class: Homo Sapiens (main, or super class)
Subclassed object: Male Human being (inherits some of the methods & properties of Homo Sapiens)
Subclassed object: Female Human being (warning - yours might react badly to being called a subclassed object)
Instance: Dick Cheney, with his own unique subset:
Method: Grab_Oil()
Method: Hunt_Quail()
Property: Height
Property: Weight
Property: Aiming Ability
Object Oriented Programming is merely an attempt to mimic the behaviours and relationships found in real life in a software program. The concepts, as you can see, are really not obscure or difficult. How far you choose to take the concept in your programs is entirely a personal choice. For myself, I don't plan on getting too carried away. Like any good thing, a little goes a long way and too much can land you in trouble.
Posted: Sat Feb 18, 2006 11:47 am
by Psychophanta
netmaestro wrote:Object Oriented Programming is merely an attempt to mimic the behaviours and relationships found in real life in a software program. The concepts, as you can see, are really not obscure or difficult. How far you choose to take the concept in your programs is entirely a personal choice. For myself, I don't plan on getting too carried away. Like any good thing, a little goes a long way and too much can land you in trouble.
Agree with that.
Moreover, OOP is no useful for some kinds of aplications, like simulations or general scientific oriented programs, which is my case.
Posted: Sat Feb 18, 2006 2:16 pm
by Kale
Psychophanta wrote:netmaestro wrote:Object Oriented Programming is merely an attempt to mimic the behaviours and relationships found in real life in a software program. The concepts, as you can see, are really not obscure or difficult. How far you choose to take the concept in your programs is entirely a personal choice. For myself, I don't plan on getting too carried away. Like any good thing, a little goes a long way and too much can land you in trouble.
Agree with that.
Moreover, OOP is no useful for some kinds of aplications, like simulations or general scientific oriented programs, which is my case.
Agreed! OOP can be very useful to solve complicated problems but IMHO can make code slow and bloated if over used. For example i have seen programs attempting code re-use by re-using a class which didn't really do what was needed. A subclass was made from this superclass and then more properties and methods were added. This was then used in the code but only a fraction of the superclass's methods was used. So we have lots of stuff defined but never used in the current program. In these situations i think it's better to code a new class or maybe it can be done cleaner without OOP.
Posted: Sat Feb 18, 2006 3:16 pm
by Dare2
@netmaestro
Love your examples.

But quail a bit about having Cheney in the Homo Sapiens class.
Actually I got all excited here on two fronts, first being the possibility of (more) easily using C++ and other OOP libs. Second, more important to me right now, was a way to create a jumptable without using CallFunctionFast (as, at bottom, OOP is a glorified jumptable with attitude).
Unfortunately I can't see how to use this for either. Not saying it can't be done, just saying I can't see how it can be done. I can follow the code you guys are posting, I can even see some resemblences to oop, but I can't quite see the way it can be meshed with an Oop. And I can't see a way to do dynamic (via jumptable) calls either. C'est la vie.
But this hijacks the thread a bit, so I'll leave off as the subject is very interesting and getting some decent coverage here.
Posted: Sat Feb 18, 2006 7:30 pm
by Straker
netmaestro wrote:
Instance: Dick Cheney, with his own unique subset:
Method: Grab_Oil()
Method: Hunt_Quail()
Property: Height
Property: Weight
Property: Aiming Ability
Nice example netmaestro, but just to clarify for others - Height and Weight are not unique to the Dick Cheney subset, but are subclassed from some pre-Homo Sapien object.
Man, I feel like a total geek right now after I wrote that.
Posted: Mon Feb 20, 2006 4:26 am
by NoahPhense
I'm getting into this OOP ..
Can we do some OOP for Dummies.. like me..
I rewrote your whole dog thing.. into a human thing.. just to start
wrapping my head around it.
How about a few small examples using the Interface.. as that I have
never made much use of it.. but after working with it in these examples,
I don't know how I've lived without it.
Some simple examples please.. if possible.. A lot of people can only
benefit from this..
- np
Posted: Tue Feb 21, 2006 6:00 pm
by Straker
Posted: Tue Feb 21, 2006 6:40 pm
by Bonne_den_kule
This one is old and for the 3.xx.
Posted: Tue Feb 21, 2006 8:05 pm
by Straker
Bonne_den_kule wrote:
This one is old and for the 3.xx.
But it covers concepts well that can be used in any language. Besides, are you sure that the code doesn't work in 4.x (which is still beta btw)?
Like all matters of learning, glean from it what you can, apply what works for you, and ignore the rest.
IMO, it is still a valid tutorial.
Posted: Tue Feb 21, 2006 10:52 pm
by Bonne_den_kule
Your right, but isent OOP easyer and cleaner in pb4?
Posted: Tue Feb 21, 2006 11:04 pm
by Psychophanta
Hi Straker, that is excellent doc. Who is the author?
Posted: Tue Feb 21, 2006 11:09 pm
by Flype
Seems it's Dräc.
Posted: Wed Feb 22, 2006 12:37 am
by Straker
Bonne_den_kule wrote:
Your right, but isent OOP easyer and cleaner in pb4?
I don't know yet. From what I have seen so far, yes, however, these new techniques are still in flux because it is still beta. I am waiting for 4.0 to be released before I expect to see a concrete methodology.
Flype wrote:
Seems it's Dräc.
yes.
Posted: Wed Feb 22, 2006 10:41 am
by hellhound66
Removed.