Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When, where, and why should I use OOP over other methods?

Asked by
Griffi0n 315 Moderation Voter
5 years ago
Edited 5 years ago

I don't really need an explanation on OOP but it seems as though most advanced scripters use OOP. Now usually when I write code I organize it into modules to keep the game neat and tidy (along with other helpful uses) however I have only found one situation where I should've used OOP. So is it really true that most advanced scripters use OOP or am I just deceiving myself. Also should I always be using OOP?

Adding on:

I don't feel like making an unnecessary class for every single module I make. Unless I need to do something like Job.new() or Enemy.new() which I completely understand why I should use OOP there instead of another method.

2
In languages such as PHP, I use a class for every type of method that I'll need. For example, if I'm working on rendering something, then I put it in a "Render" class. The idea of classes is just to put everything together. Have functions inside the Render class for what you need it for. But results may vary. JamesLWalker 297 — 5y
0
Not sure why you would render on the server but whatever. Griffi0n 315 — 5y
0
I understand that having a table of methods (or object) is pretty useful and use it in my games however I still don't quite understand why to use OOP in these scenarios. Griffi0n 315 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

If you don't need it don't use it. It is as simple as that. Maybe better developers do use it. So what? If they do, it is to suit their particular situation. When you need it, use it. Otherwise don't bother overmuch about it.

Ad

Answer this question