| View previous topic :: View next topic |
| OOP or functional? |
| Object Oriented Programming |
|
46% |
[ 6 ] |
| Functional Programming |
|
53% |
[ 7 ] |
|
| Total Votes : 13 |
|
| Author |
Message |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Thu Aug 23, 2007 7:40 pm Post subject: OOP vs Functional programmming |
|
|
A lot of books / tutorials I've read claim that OOP is structured more like real life, much better than functional, this and that..
I've found that it's a good theory on paper, but in practice it's totally useless. Does anyone agree with me? If not, I'd love to see the logic behind OOP.
Any opinions?
_________________
Don't laugh, I'm still learning photoshop! |
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Thu Aug 23, 2007 7:45 pm Post subject: |
|
|
Functional Programming for me, I never liked OOP.
_________________
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Thu Aug 23, 2007 7:48 pm Post subject: |
|
|
| UnLmtD wrote: | | Functional Programming for me, I never liked OOP. |
Me too.
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Thu Aug 23, 2007 7:51 pm Post subject: Re: OOP vs Functional programmming |
|
|
| TheSorc3r3r wrote: | | A lot of books / tutorials I've read claim that OOP is structured more like real life, |
First, you're reading C++ books. Second, it's not more like real life. So you give an example, a ball can be a class, but a ball is just material, so it can be a structure. But the ball can do actions, it can bounce, so wouldn't ball.bounce() be appropriate? well no, because the ball is not acting, you are acting on the ball, so drop(ball) is a better representation of the action. Ok, so you're saying its you acting on the ball so shouldn't it be name.drop(ball)? No, because it's not really your action, gravity is acting on you, so gravity_action(drop, ball). Better. OOP is convenient, because of its automatically taking care of constructors and all that but it's not logical and not easier.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25820 Location: The netherlands
|
Posted: Thu Aug 23, 2007 8:59 pm Post subject: |
|
|
OOP is easier to manage in projects. Since projects are usually designed ina modular way, so oop
Also, you can do object oriented programming in a functional language.
Just pass a self variable belonging to a struct
for those that don't know, cheat engine is mainly written in OOP except a few functions in cefuncproc.pas
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Thu Aug 23, 2007 10:11 pm Post subject: Re: OOP vs Functional programmming |
|
|
| appalsap wrote: | | OOP is [...] not logical and not easier. | Really depends on how you look at it.
| Quote: | | well no, because the ball is not acting, you are acting on the ball, so drop(ball) is a better representation of the action. | But what if there are different kinds of balls such as glass balls and rubber balls? A glass ball would shatter when dropped whereas a rubber ball would bounce. Using a universal drop() function would then involve a case checking for the different kinds of balls. Thus, every time a new ball is made, the drop() function would have to be rewritten and recompiled. In OOP, methods such as drop could be inherited from a universal ball class, then making refinements for each type of ball. When a new ball is discovered, old coding do not have to be touched; only new ones need to be added. This making expansion much easier.
| Quote: | | No, because it's not really your action, gravity is acting on you, so gravity_action(drop, ball). |
According to your logic, it's equally fine to use gravity.drop(ball).
OOP is a concept created to allow better and easier organization of source code. If anyone still uses a procedural-only language to create large applications, then that person is either a fool who loves to waste time and brain power on just organizing source code, or an old-time programmer who is just too used to the procedural ways to change.
_________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Thu Aug 23, 2007 10:38 pm Post subject: Re: OOP vs Functional programmming |
|
|
| DeltaFlyer wrote: | | But what if there are different kinds of balls such as glass balls and rubber balls? A glass ball would shatter when dropped whereas a rubber ball would bounce. Using a universal drop() function would then involve a case checking for the different kinds of balls... |
You would check the properties of the balls (passing a pointer to the ball structure) to determine shatter risk, not the type, so you don't have to expand that code.
| DeltaFlyer wrote: | | According to your logic, it's equally fine to use gravity.drop(ball). |
Well you can do that but it's silly because you're wrapping a perfectly find procedural method with objects for the sake of object orientation.
| DeltaFlyer wrote: | | OOP is a concept created to allow better and easier organization of source code. |
If you are made to think in that rigid, unnatural sort of way. I could teach people that organizing your source code by virtual spaghetti plates, and develop tools and languages for it! That doesn't mean everyone who doesn't conform is a fool.
| DeltaFlyer wrote: | | If anyone still uses a procedural-only language to create large applications, then that person is either a fool who loves to waste time and brain power on just organizing source code, or an old-time programmer who is just too used to the procedural ways to change. |
What do you have to say about people who develop operating systems? It's not a new way of doing things that supersedes the old way, it's a different way of thinking. More beginning programmers are being pushed through this mold, though, so some part of that is true.
|
|
| Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Thu Aug 23, 2007 10:53 pm Post subject: |
|
|
What fits the needs of the program your making.... functional is quick easy and dirty.... oop is nice for bit programs you need portable... though some people are saying it's like "real life"? thats bull... real life is 3d... coding is 2d and simplified... never have i ever had to buy my girl drinks while programming, never have i had to compete against an opponent in real life, or tried to set against one... that real life - completely different.. oop for big, function for small... all have uses - just exploit them for what they are best for
_________________
0x7A 0x61 0x72 0x74
TEAM RESURRECTiON |
|
| Back to top |
|
 |
assaf84 Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 238
|
Posted: Fri Aug 24, 2007 12:57 am Post subject: |
|
|
zart, coding is more like 1d, and I don't think that it's supposed to be like real life, I mean, it's still a computer and not a living human.
I usually use Functional programming, because I usually make only small projects, so starting classes and stuff will be useless. OOP can help only with some big projects (aka CE), when the code you write is longer than the code of the dlass itself. In this cases it might really help, but I don't see the point on using it with small projects. But thats only what I think
|
|
| Back to top |
|
 |
Icos Grandmaster Cheater
Reputation: 0
Joined: 12 May 2007 Posts: 524
|
Posted: Fri Aug 24, 2007 4:55 am Post subject: |
|
|
| UnLmtD wrote: | | Functional Programming for me, I never liked OOP. |
Same. Haven't spent much time in OOP.
|
|
| Back to top |
|
 |
the_undead Expert Cheater
Reputation: 1
Joined: 12 Nov 2006 Posts: 235 Location: Johannesburg, South Africa
|
Posted: Fri Aug 24, 2007 4:59 am Post subject: |
|
|
I went through a brief pro-OOP stage where I made heavy use of it, but in the end I found myself leaning back towards functional programming.
_________________
|
|
| Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Fri Aug 24, 2007 6:38 am Post subject: |
|
|
| assaf84 wrote: | zart, coding is more like 1d, and I don't think that it's supposed to be like real life, I mean, it's still a computer and not a living human.
I usually use Functional programming, because I usually make only small projects, so starting classes and stuff will be useless. OOP can help only with some big projects (aka CE), when the code you write is longer than the code of the dlass itself. In this cases it might really help, but I don't see the point on using it with small projects. But thats only what I think  |
1d? o_O
Think to yourself about what one dimension would look like... it wouldn't be programming... It has to be 2d (x,y).. If you still don't get it - read "flatlands" and you will
_________________
0x7A 0x61 0x72 0x74
TEAM RESURRECTiON |
|
| Back to top |
|
 |
assaf84 Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 238
|
Posted: Fri Aug 24, 2007 7:00 am Post subject: |
|
|
| Actually, all the stuff about computers are 1d, all the code you write is 1d, because its actually an array of chars. The memory is organized in a long "line" and stuff..
|
|
| Back to top |
|
 |
Icos Grandmaster Cheater
Reputation: 0
Joined: 12 May 2007 Posts: 524
|
Posted: Fri Aug 24, 2007 8:10 am Post subject: |
|
|
In mathematics,
1d = points
2d = lines
|
|
| Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
|
| Back to top |
|
 |
|