Jump to content

OOP Question...


dual_alliance

Recommended Posts

My friends and l are going to be making an online game, and l will be doing the PHP coding side of it.  I am thinking about using OOP so l typed it up on google to find some tutorials on it however l came accross this site [url=http://www.webmasterstop.com/56.html]http://www.webmasterstop.com/56.html[/url].  I am hoping for a high number of players to play this game and if l make the site using OOP would this slow it down?  What are your thoughts about using OOP?

Thanks,

dual_alliance
Link to comment
Share on other sites

these line from the article sum it up nicely:
[quote]
From this test case, we can see that using classes for simple tasks end up being very inefficient...
But just because it is slower, does not mean we should stop writing OOP code all together...
[/quote]

if you're doing simple calculation and/or processing, [b]do not[/b] use classes, however, when you're writing a management system to obtain database information and do multiple calculations at the load of a page, you almost have to use OOP. remember that programming for web is quite different than programming for applications. if you get into it, you'll see that almost all high-end game engines are written linearly in C. why is this? well, because it runs faster. however, while the engine and renderers to many games are written linearly, when you start to delve into structure of RPGs and other more massive games, they are pulled together with OOP.

especially when it comes to writing code in PHP for webpages, i am under the understanding that the page will most likely be changing repeatedly over time. i need to write my page in such a way as to offer myself the quickest update time later. we're talking about milliseconds in processing time in most cases, and with web, many people's internet connection will take longer than the server processing time to load the page anyway. there are many things to consider, but when it comes down to it, i just write anything that is complex and repetative in nature in an OOP way.
Link to comment
Share on other sites

The purpose of OOP is to simply eliminate redundant code.  If you can find common grounds among multiple procedural scripts, you are likely a good candidate for OOP.  With the many design patterns in place, you can find a fit for almost any situation.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.