vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Is OOP overrated? (https://vborg.vbsupport.ru/showthread.php?t=106051)

harmor19 01-22-2006 11:39 PM

Is OOP overrated?
 
I just don't see why OOP is so nice.
I think it makes the script look "cooler" because it's more confusing to someone new to OOP.

For those who don't know OOP I'll make two scripts.

PHP Code:

<?php
//the non-OOP way
echo "Name: Andrew";
?>

PHP Code:

<?php
//the OOP way
class Person
{
  var 
$name;

  function 
name()
  {
    return 
$this->name;
   }
}

$person = new Person;
$person->name "Andrew";
echo 
"Name: ".$person->name()."";

?>

They should print
Name: Andrew

akanevsky 01-22-2006 11:46 PM

OOP is nice not because it makes the code look "nicer", but because it provides better encapsulation of the code as well as a way to easily implement reusable code that does not have multiple copies throughout multiple files. An example of how OOP can be used to create efficient code: vBulletin's data managers. When you need to alter the way a certain data is managed, you do not have to edit multiple files, but instead you just have to edit the code of that data manager.

AN-net 01-22-2006 11:50 PM

procedural and OOP do not differ much in speed when bottlenecks are removed and code is optimized. OOP is more useful when you have a large system of code where that code will be utilisized multiple throughout multiple files. with OOP you can easily reuse code and build off of existing code with no problem.

harmor19 01-23-2006 12:01 AM

I guess for database retrieval it's nice ($vbulletin->userinfo) but for what I did then it's pointless.

speaking of data managers, is there one to private message someone?

Edit:
nevermind, I looked for the class file.

Edit 2:
now I have to figure out how to use it. :ermm:

akanevsky 01-23-2006 12:34 AM

<a href="https://vborg.vbsupport.ru/showthread.php?t=82786" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=82786</a>

harmor19 01-23-2006 12:52 AM

thanks

Xenon 01-23-2006 01:04 PM

Well, oop is overated, but on the other hand it's also underestimated.

It's not that non-plus ultra some people tend to say, but it's also not bad.
same would be with aspect orientated programming languages.

every thing has pro's and contras.

My personal pov is that oop is very usefull in big projects with a real coding language like c++, but it's not that good that a script language like php goes more and more into oop.

but as said, that's just my pov.

filburt1 01-23-2006 06:00 PM

With respect to those who disagree, anybody who thinks OOP is overrated doesn't understand the massive benefits it introduces. Sure, you can get polymorphism, encapsulation, and inheritance, but you also get implied namespaces, grouping of objects, enforced code structure (abstract methods) which itself leads to polymorphism...

OOP may be confusing if you're only used to normal PHP, but once you write in something like Java, you realize how stupid half of PHP is (and how broken PHP's OO model still is).

Andreas 01-23-2006 06:38 PM

C (and I mean C, not C++, C# - just C) will never die ;)

Xenon 01-23-2006 07:41 PM

Quote:

Originally Posted by filburt1
OOP may be confusing if you're only used to normal PHP, but once you write in something like Java, you realize how stupid half of PHP is (and how broken PHP's OO model still is).

JAVA is not a good example, it's so inefficient ^^

[high]* Xenon remembers of the good old times when oop wasn't yet planned and everything was done in ASM, there you have had to know what you do ^^[/high]


All times are GMT. The time now is 02:06 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01139 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete