Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 24, 2012, 11:41:20 AM

Pages: [1]   Go Down
  Print  
Author Topic: advantages of using object-oriented programming?  (Read 847 times)
qoiiuarw
Pong! (the videogame) Master
*****
Offline Offline

Posts: 21


WWW
« on: December 27, 2011, 10:43:59 PM »

Object-oriented programming, or OOP, takes things further by storing both the data structures, and the functions that work on the data, in a single entity known as an object. Rather than passing data around in function calls. Can you introduce some advantages of using object-oriented programming?

Thanks for your introduction.
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5215



« Reply #1 on: December 28, 2011, 03:09:20 PM »

You don't use objects for everything, especially if there is a legitimate need for many places to access simple data items. However, for data which can be thought of as a distinct unit, it can be advantageous to hide (encapsulate) the data in an object. If no one else has any business looking at or acting on the data directly (not via its methods), an object is good for hiding the data. Examples might include lists, queues, buffers, stacks, and trees. With objects, you retain the right to change the internal data types and layouts, and since no other code knows anything about the object's innards, they don't require any updating upon a change. Besides the listed data groups, there are other things which lend themselves well to objects, such as windows, groups and elements within windows (e.g., a radio button group or a pull-down list), and other access methods (e.g., an interface to a piece of hardware).

An added advantage to an object is that you don't have to explicitly pass around multiple separate pieces of data to functions that operate on it. Also, classes can be set up to inherit data and methods from a parent, which can be an advantage if done in a reasonable manner.
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
scanman20
Senior Moderator
Über Jedi
*****
Offline Offline

Posts: 1524



WWW
« Reply #2 on: December 31, 2011, 09:26:22 AM »

MrPhil I'm 99% positive that qoiiuarw is a spambot. While I see no links in its posts, all of them are inane, general questions covering a range of topics with no follow up or answers. This board seems to be slowly deteriorating as more and more bits are slipping in. Too bad Mitch isn't still around to clean things up.
Logged

Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5215



« Reply #3 on: December 31, 2011, 03:50:10 PM »

I'm not sure what the point of doing "spam" like this would be if there are no links to other sites, and while the point of many such questions is puzzling, I have been having mercy upon such posters and giving them the benefit of the doubt. Maybe they are just newbies (or non-English speakers) who just don't know how to frame a reasonable question, and end up asking something that sounds stupid to comp sci pros. Anyway, if he/she/it doesn't follow up, I'll have to agree that they're not doing anything useful and can be ignored.

Incidentally, I do report spam to the moderator(s) on an almost daily basis, and sometimes it's removed.
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
scanman20
Senior Moderator
Über Jedi
*****
Offline Offline

Posts: 1524



WWW
« Reply #4 on: January 02, 2012, 08:07:02 AM »

I did too, but it began to feel like I was doing the jobs of the mods.
Logged

Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5215



« Reply #5 on: January 02, 2012, 09:36:15 AM »

I got a nice PM from MichaelT telling me that they do pay attention to spam reports, but are sometimes too busy to get to them right away. They apparently don't have any staff dedicated to moderating the forum, but the help desk/sysadmins chip in on a time-available basis. In that case, the best we can do is report spam as we see it and be patient. I try to wait a few days before reporting obvious spam a second time, or if it could be considered a borderline case, accept that they didn't see it as spam (at least, bad enough to remove or edit it).
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5215



« Reply #6 on: January 03, 2012, 10:58:03 AM »

Ah, I got it! "quoiiuarw" is obviously a college student who is looking for us to answer questions on a take-home exam. I'll keep that in mind next time someone blasts a whole bunch of questions at once. It's a different kind of spam...
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
Pages: [1]   Go Up
  Print  
 
Jump to: