Fuel for you OOP non-believers...

For everything that's not in any way related to PureBasic. General chat etc...
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Code: Select all

If Me.Idiot() And You.Idiot()
  Me.Marry(You)
  You.ThrowPotAt(Me)
  Me.Buy(WidescreenTV)
  If Me.GetMarriageStatus()=Typical
    You.Divorce(Me)
    You.Marry(SomeSexyOtherDudeWithLotsOfMoneyFromPyramidScheme)
  Endif
  Me.Suicide()
Endif
Console.Print(Life.Dump())
End
Ah... the OOL... Object Oriented Lifestyle
Last edited by dracflamloc on Wed Apr 05, 2006 10:36 pm, edited 1 time in total.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

:D
I may look like a mule, but I'm not a complete ass.
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Code: Select all

If IsIdiot(Me) And IsIdiot(You)
  Marry(Me,You)
  ThrowPot(You,Me)
  Buy(Me,WidescreenTV)
  If GetMarriageStatus(Me,You)=Typical
    Divorce(Me,You)
    Marry(SomeSexyOtherDudeWithLotsOfMoneyFromPyramidScheme,You)
  Endif
  Suicide(Me)
Endif
Print(Dump(Life))
End
Procedural Lifestyle
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

The way I view OOP vs Procedural:

They are like two languages. Sorta like French vs English. You have OOP which works in a form of:

Source - Action - Target

And then theres Procedural:

Action - Source - Target


In the end it really doesnt matter much, except that in the computer world theres less overhead to manage code in the Action, source, target method.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

:lol:
@}--`--,-- A rose by any other name ..
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

And of course "OOP" spelt backwards is... :P
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

OOPs! POO!
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

LOL.

+10
@}--`--,-- A rose by any other name ..
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

OOPs, or rather eew, have a look at this:
Stroustrup: Well, it's been long enough, now, and I believe most people have figured out for themselves that C++ is a waste of time but, I must say, it's taken them a lot longer than I thought it would..

Interviewer: So how exactly did you do it?

Stroustrup: It was only supposed to be a joke, I never thought people would take the book seriously. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient..

Interviewer: What?

Stroustrup: And as for 're-useable code' - when did you ever hear of a company re-using its code?

Check it out. Is this for real ?? http://www.nsbasic.com/desktop/info/interview.shtml :shock:

Priceless..... :wink:

http://public.research.att.com/~bs/ieee_interview.html
u9
User
User
Posts: 55
Joined: Tue May 09, 2006 8:43 pm
Location: Faroe Islands
Contact:

My 5 cents

Post by u9 »

USCode has posted an interesting link regarding OOP here... I thought I'd give my comments. I have many years experience using procedural, functional and object-oriented languages and I have a BSc in software engineering.

Let me start by saying that "OOP models the real world better" is a fact. Research has actually shown that children are much faster to learn programming using OOP techniques than procedural, precisely because it represents the real world better. It is much easier to abstract as software classes can coincide with real world objects. (Sorry I don't have a reference, as I don't remember what university did this research)

It is also a fact that OOP scales better. OOP is a virtually necessity for large projects, as both GedB and USCode also stated. But it needs good design and modeling. Just using objects doesn’t make sense without some form of design process with artifacts such as sequence-, system- and class-diagrams. That said, it is easy to see that OOP does create overhead on small single-person projects.

Still, for small projects, things such as inheritance and polymorphism are excellent concepts to use even for small programs. The idea is that data, and the functions that work on that data should stay together. The fact that pure basic doesn't support OOP is a great shame, however I think it is possible to add functions to structures in effect creating a class (though not with encapsulation... I haven't tried this though. I'm new to PureBasic)

Wikipedia also has some interesting critique, though it seems more objective then USCode’s link.

The reason for my reply here is that I think many of you will think "great, I don't have to learn OOP" when reading that post. I assure you, OOP is a VERY important skill if you want to work as a software engineer.
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents. (Nathaniel Borenstein)
http://www.wirednerd.com
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: My 5 cents

Post by Trond »

u9 wrote:It is also a fact that OOP scales better. OOP is a virtually necessity for large projects, as both GedB and USCode also stated.
How funny it is that you're probably using Windows or Linux to write this. How object oriented is the Linux kernel? Is it not a large project? Does it not scale well?
u9 wrote:The idea is that data, and the functions that work on that data should stay together.
Which is also fundamental in procedural programming. Ever heard of units? That's how pascal does it. It's not object oriented. It has data hiding.
That said, it is easy to see that OOP does create overhead on small single-person projects.
...
Still, for small projects, things such as inheritance and polymorphism are excellent concepts to use even for small programs.
Yeah, it's excellent to indtroduce overhead, right? That being said, inheritance and polymorphism are not exclusive to object oriented programming, it's just another way of thinking of the same things. When I look at wikipedia it lists a few key points of object oriented programming and no point but the objects themselves are exclusive to object oriented programming.
Let me start by saying that "OOP models the real world better" is a fact.
It is a fact that inside my computer there is no "car" that can car.drive. There is a collection of numbers that looks like a car. I don't know if you call my computer unreal, but I think it's pretty heavy, and there's no car.drive inside it, only data, which is why procedural programming that manipulates data models the real world better. (Now I'm not saying whether that is a good thing or not.)
Last edited by Trond on Sat May 13, 2006 4:36 pm, edited 3 times in total.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Re: My 5 cents

Post by Dare2 »

u9's sig wrote:The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents. (Nathaniel Borenstein)
:lol:

I like it.
@}--`--,-- A rose by any other name ..
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

The .NET bloat...don't forget the .NET bloat! :)
u9
User
User
Posts: 55
Joined: Tue May 09, 2006 8:43 pm
Location: Faroe Islands
Contact:

Re: My 5 cents

Post by u9 »

Trond wrote:...
It is a fact that inside my computer there is no "car" that can car.drive. There is a collection of numbers that looks like a car. I don't know if you call my computer unreal, but I think it's pretty heavy, and there's no car.drive inside it, only data, which is why procedural programming that manipulates data models the real world better. (Now I'm not saying whether that is a good thing or not.)
This is exactly what OOP is about. abstraction ! Abstracting from the data inside your poor computer. I didn't say the real world was inside your computer. I said it models the real world, the real world of e.g. cars which, yes, can drive(). You don't think of your data as a bunch of semi-conductive material powered by electron flow do you? You don't think of your data as small latches set to one of two possible positions do you? You don't generally think of your data as a long row of ones and zeros do you? You abstract from this fact (i hope) :)

I just wrote here, because I thought that a beginner might read this thread and consider OOP obsolete or useless. I just want to say it is considered very important by many employers.
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents. (Nathaniel Borenstein)
http://www.wirednerd.com
Post Reply