OOP vs procedural

For everything that's not in any way related to PureBasic. General chat etc...
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Re: OOP vs procedural

Post by thefool »

Mistrel wrote:What a bunch of fools. :wink:
+1

:P
Fred
Administrator
Administrator
Posts: 18352
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: OOP vs procedural

Post by Fred »

:lol:
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: OOP vs procedural

Post by Foz »

As amusing as the avatars are :lol: I thought I'd give my two pence:

OO programming allows organising into teams. With a procedural language, you have to have everything building together - it works perfectly for a one man team, and for a one man team, it is also faster to code as procedural - everything is done all at once.

However, as many people work in teams (businesses, open source software, etc), it is by far easier to split off everything into many small objects that all work independently, this way, many parts can be distributed to many people. This way, each person builds their object, and a small simple application that interfaces that object. Once that object is ticked off, another can be dealt with the same way.

The difference is that a lot more work is done with OOP, each object will have it's own tester application, whereas PP will (generally) build it all together, all at once.

With the ability to compartmentalise procedures in PB (include), it becomes a lot easier to duplicate the way to work (lots of small include files instead of objects), but it loses out on stuff like inheritance which saves you duplicating code - if you change one bit of code in one object that is inherited to many other classes, all the other classes automatically get it, with the many include files all instances of copied code have to be changed - and if you miss one... you're in for a world of pain later...

And that's about it from the top of my head.

Can I have a snazzy avatar too now? ;)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Re: OOP vs procedural

Post by thefool »

I still think its a good idea to learn an object oriented language even if you're only a one-man team. Its not always faster to code procedural, some problems are just hard to attack top-down. It depends on the problem that needs to be solved, no matter if you're 1 or 10. Except object oriented methods are often more suitable for teams due to a higher level of abstraction etc. so we agree on that point :)

My point is just that its not that black and white (where black and white means 1 man= procedural is best, 10 man = OOP is best).

I'm looking forward to a course in functional languages coming soon. Yet another way of solving problems :)
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: OOP vs procedural

Post by Foz »

Actually, I'm just wondering, but do any people here use the (limited) OO methods in PureBasic to handle windows, so each window is it's own object?

If so, is there some sort of common functionality behind it? Or could someone post an example of handling windows and interacting with it?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: OOP vs procedural

Post by Kaeru Gaman »

Foz wrote:Actually, I'm just wondering, but do any people here use the (limited) OO methods in PureBasic to handle windows, so each window is it's own object?

If so, is there some sort of common functionality behind it? Or could someone post an example of handling windows and interacting with it?
what do you mean? handling more than one window the procedural way?
or setting OOP on PureBasic?

there are examples howto branch you eventhandling for arbitrary many windows...
there are some OOP approaches for PureBasic...
oh... and have a nice day.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: OOP vs procedural

Post by Foz »

As in, a single window is one self contained object, so from a procedural point all you have to do is create a new instance of that window and then tell it to be shown.

But I'm thinking that it would be a perfect candidate for inheritance - so there is a common "ShowWindow" function, or "WindowDialogResult" property, etc.

So I was thinking, has anyone actually done this in PB? (A base window class, an inherited actual window class, and some base procedural code that interfaces with the class to retrieve the value or something like that)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: OOP vs procedural

Post by Kaeru Gaman »

how fluent is your German?

in the PureBasic Lounge there is a whole subforum with includes and libs for OOP in PB.
oh... and have a nice day.
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Re: OOP vs procedural

Post by Rings »

Kale wrote:IMHO, C# is the only thing microsoft has ever got right.
could not resist:
Reg: All right, but apart from the sanitation, medicine, education, wine, public order, irrigation, roads, the fresh water system and public health, what have the Romans ever done for us?
Attendee: Brought peace?
Reg: Oh, peace - shut up!
SPAMINATOR NR.1
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: OOP vs procedural

Post by Foz »

Kaeru Gaman wrote:how fluent is your German?
Non-existent? :lol:

Oh Babel Fish, Oh Babel Fish, how lovely thou art...
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Re: OOP vs procedural

Post by Kale »

Rings wrote:
Kale wrote:IMHO, C# is the only thing microsoft has ever got right.
could not resist:
Reg: All right, but apart from the sanitation, medicine, education, wine, public order, irrigation, roads, the fresh water system and public health, what have the Romans ever done for us?
Attendee: Brought peace?
Reg: Oh, peace - shut up!
Ha hahaa, lol!
but honestly, Apart from C#, what have they ever got right? :wink:
--Kale

Image
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: OOP vs procedural

Post by nco2k »

guys guys! you are getting way too off-topic.. can we focus on the avatars again? thanks. :wink:

@rings
wasnt that from the movie "life of brian"? :D

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Marlin
Enthusiast
Enthusiast
Posts: 406
Joined: Sun Sep 17, 2006 1:24 pm
Location: Germany

Re: OOP vs procedural

Post by Marlin »

I like OOP for the order it can bring...

but I do not want to stand on my head to use it,

also I am unwilling to sacrifice 90% of an apps performance for OOP. ;-)
User avatar
idle
Always Here
Always Here
Posts: 6044
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: OOP vs procedural

Post by idle »

Rings wrote: could not resist:
Reg: All right, but apart from the sanitation, medicine, education, wine, public order, irrigation, roads, the fresh water system and public health, what have the Romans ever done for us?
Attendee: Brought peace?
Reg: Oh, peace - shut up!
:lol: Best quote in the thread.

>dont want to stand on my head to use it :lol:
Try and solve that in UML

Both have their uses and places and sometimes oop is the right choice.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Re: OOP vs procedural

Post by Kale »

Marlin wrote:also I am unwilling to sacrifice 90% of an apps performance for OOP. ;-)
A little bit of an over exaggeration i think, lol!
--Kale

Image
Post Reply