Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2006, 11:39 PM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 01-22-2006, 11:46 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 01-22-2006, 11:50 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 01-23-2006, 12:01 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Reply With Quote
  #5  
Old 01-23-2006, 12:34 AM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=82786" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=82786</a>
Reply With Quote
  #6  
Old 01-23-2006, 12:52 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
Reply With Quote
  #7  
Old 01-23-2006, 01:04 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 01-23-2006, 06:00 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #9  
Old 01-23-2006, 06:38 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

C (and I mean C, not C++, C# - just C) will never die
Reply With Quote
  #10  
Old 01-23-2006, 07:41 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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]
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:37 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04446 seconds
  • Memory Usage 2,260KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete