Page 3 of 4
Posted: Wed May 31, 2006 4:36 pm
by fsw
thefool wrote:They can call it "easy object oriented programming" all they want. Its NOT efficient, nor easy and readable.
Again, it all depends how much oo you use.
But you are right saying that some oo code is NOT efficient, nor easy and readable.
Some people just think: "I'll make it more complex and all the others think I'm a genius..."
Which is nonsense.
The best approach is to use oo where it reduces the code size and it also makes it more readable, and skip all the other fancy oop stuff that makes it more complicated than it needs to be.
This said, it seems I prefer a Object-based coding model with Data Encapsulation and Class Inheritance.
Polymorphism can be ok to use, but if used too much it can be the beginning of chaos - instead of using it too much create a new class.
And I suppose most PureBasic users that ask for more oop just want a Object-based model.
Posted: Wed May 31, 2006 5:00 pm
by dracflamloc
mp303 wrote:dracflamloc wrote:Well the world is OO but computers are procedural. Thats why C++ OOP is so inefficient when compared to a well written C app.
Computers are no more procedural than they are object-oriented, that's all up to the programming language. Have you looked at machine code? See any procedures in there?
If your argument is, that a programming language should be as close to machine language as possible, then in fact, procedures should not even be allowed. We should all go back to using GOTO.
Computers most definitely are more procedural than they are OO.
Lets take a look at the following MIPS assembly:
addi $a0,$zero,5
addi $a1,$zero,-4
jal my_func_label
my_func_label:
add $v0, $a0, $a1
jr $ra
How is that not procedural? Sure it might be more like a "Gosub->Return" kind of thing, but essentially its the same thing as a procedure.
That is in no way like OO
Posted: Wed May 31, 2006 5:09 pm
by theNerd
I would love to see basic OOP in PureBasic similar to VBScript. I had previously posted a request for this several weeks ago.
VBScript's approach to OO is extremely easy to use and makes for much cleaner code.
Posted: Wed May 31, 2006 5:15 pm
by theNerd
thefool wrote:They can call it "easy object oriented programming" all they want. Its NOT efficient, nor easy and readable.
I disagree with you on this. It is FAR more readable.
Posted: Wed May 31, 2006 5:42 pm
by mp303
dracflamloc wrote:Computers most definitely are more procedural than they are OO.
how so? Your ASM example is not very good, as ASM itself is in fact a language ... have you ever tried to write actual machine code? no such thing as a procedure here, even if your assembler can do something procedural-like, that's a feature of the assembler language (which is a programming language) and not of the machine.
Posted: Wed May 31, 2006 5:44 pm
by Psychophanta
As i see, OOP is a simple protocol to make a source program.
And as i see, it is chaotic even not used too much. The chaos or not-chaos is of course a subjective point of view.
Posted: Wed May 31, 2006 5:47 pm
by mp303
fsw wrote:But you are right saying that some oo code is NOT efficient, nor easy and readable.
I agree. But the same thing is true for procedural code. In fact more so, most would agree.
I'm not riding an "everything must be OOP" flag... especially when it comes to games, OOP should be used with thought. It may be tempting to turn everything into objects, but may certainly not be efficient. For certain things though, it will leverage the work, make the code more readable, more flexible, and much easier to build upon. Most people who have ever done any major OOP will have to agree with this... The majority probably won't care much if a few people think that OOP is the devil's work.
Posted: Wed May 31, 2006 5:53 pm
by mp303
theNerd wrote:I would love to see basic OOP in PureBasic similar to VBScript. I had previously posted a request for this several weeks ago.
VBScript's approach to OO is extremely easy to use and makes for much cleaner code.
Yes, it is very easy to learn. I honestly believe it is much harder, and requires an anal degree of self-discipline, to write well-organized procedural code - something most beginners and hobby-level programmers can not pride themselves of. OOP was a very healthy addition to VBScript - it helps keeps amateurs on the right track, and enables professionals to do well-structured, reusable code.
Posted: Wed May 31, 2006 6:02 pm
by dracflamloc
mp303 wrote:dracflamloc wrote:Computers most definitely are more procedural than they are OO.
how so? Your ASM example is not very good, as ASM itself is in fact a language ... have you ever tried to write actual machine code? no such thing as a procedure here, even if your assembler can do something procedural-like, that's a feature of the assembler language (which is a programming language) and not of the machine.
The ASM I wrote in MIPS is translated directly to a specific bit pattern. Those bits are the machine code. My example uses no pseudo-asm or macros, just a label and registers. Replace the label with a memory address and you have the machine code.
Posted: Wed May 31, 2006 6:14 pm
by thefool
fsw wrote:thefool wrote:They can call it "easy object oriented programming" all they want. Its NOT efficient, nor easy and readable.
But you are right saying that some oo code is NOT efficient, nor easy and readable.

Yeah what i meant was, that if PB got it simple (classes, inheritance etc) it WOULD be efficient, easy and readable.
The way we have to do it now, is NOT easy. No matter how you twist it, its much more complex than having a procedure and much uncleaner. It needs to be done correctly, and it won't require a core rewrite of purebasic either.
Posted: Wed May 31, 2006 8:33 pm
by Paul

Currious why you ask all the same questions regarding OOP and PureBasic when you were already given an answer by the PureBasic team?
http://www.purebasic.fr/english/viewtop ... c&start=30
http://www.purebasic.fr/english/viewtop ... c&start=45
Posted: Wed May 31, 2006 8:42 pm
by theNerd
Because things can change.
I see two arguments on this board. If something about PureBasic is critized as not being similar to any other BASIC the common reply is "well, your first mistake is to consider it a BASIC language." If something is recommended that may not be considered part of the BASIC language (never mind that most BASIC languages do include classes now) the response is "this is a BASIC language and OOP doesn't belong in BASIC".
Posted: Wed May 31, 2006 9:02 pm
by dracflamloc
Because it can be added by a third party. And it already has somewhat.
People get fresh out of school thinking OOP is the bestest thing around because all they know is java. Its just how colleges are these days.
Posted: Wed May 31, 2006 9:16 pm
by mp303
In school, they taught us assember, then pascal, then some C++ with a little OOP. In that order. I picked up on OOP later - I have programmed larger web solutions such as custom CMS and shops, from the ground up, several times. The OOP versions were always far more extensible, more stable, and more maintainable than any of the procedural versions.
Just my experience with OOP. What can I say, it works for me. If it doesn't work for you for some reason, that's fine, but you don't have to rain on everyone else's parade, do you? I'm not forcing OOP on you. Why would it be so terrible if PB could be useful to you and me?
Posted: Wed May 31, 2006 11:40 pm
by thefool
theNerd wrote:
I see two arguments on this board. If something about PureBasic is critized as not being similar to any other BASIC the common reply is "well, your first mistake is to consider it a BASIC language." If something is recommended that may not be considered part of the BASIC language (never mind that most BASIC languages do include classes now) the response is "this is a BASIC language and OOP doesn't belong in BASIC".
This is a really great and TRUE argument!