Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Creative Discussion > Programming and Game Development

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 08-31-2015, 11:07 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 127,506
Kyttias is on a distinguished road
Default

And yet, I can easily argue that OOP is overkill for small to medium projects and takes up more lines of code to put functions into classes that will only ever be called once and don't really need to be a function, anyway.

While "redundant" coding may be typing the same thing up multiple times, there's also the folly of putting non-redundant code into a class file and then forcing it to be loaded every time that class is called, even though it will literally never be used in relation to that class ever again.

So if the answer to "will I ever use this function again?" is no, then, no, it doesn't belong in a class file. It'll just bog down the load times of that file. Significantly? That's arguable.

I prefer KISS logic. "Keep it simple, stupid!"

OOP is great for keeping code organized, especially when working in teams. But... there is, actually, a performance hit. If you're the only one ever going to see the code, go ahead, stay procedural! Definitely! Well-commented code is just as important.

Undocumented object oriented code is twice as much of mess as a single file that I can at least use a search function on rather than having to cross-reference multiple other files to see what messed up where. I called a class? Did I call it with the right parameters in the right order? Inside that class I called a class? Inside that class I called another class? Good lord, just WHY? I could have done it in four lines of code and instead I just loaded multiple files and wasted seconds of processing time. I don't really care about readability or even copy-pasting if it means I understand it exactly where I'm using it. I don't have to chase an error down a mile away. I don't have to guess what the function I wrote in another file does exactly, because it's all right in front of me where I'm working on it.

I prefer to limit my classes to functions that interact directly with the database and other immediate functions that assist the ones that touch the database. I see classes as a necessary evil, and not a solution to every problem. Imagine it like how the English language uses contractions. We drop a vowel, we shove some words together. Now imagine if w't'lk'dl'k'th's (we talked like this) - let's just shove all the words together and remove the vowels. You're supposed to guess what's there. That's what happens to my brain when I view object oriented code. I have to guess what's there. It's counter-productive to my productivity, even though other programmers love it.

If you're using a class inside of a class inside of a class - just - don't.

The worst part is that in the defense of "organization" (which I feel it isn't), it stabs performance by loading code it won't even run. It thinks it might, it's in the file alongside the function you called, so the rest of its all there, too. It took time to load that chunk. According to studies, it may have taken 600% longer than if you'd just written it without the spiderwebbing into classes.

If you can do it without, do it without. If you can't do without it (it NEEDS to scale), don't do without it (use objects!). But know when to draw a line (does it REALLY need to scale?). Don't do it for everything (do you know what this word scaling even means?), it IS, in fact, counterproductive. In every way - both in terms of organization and compile time. "Half your code shouldn't be OOP baggage."

/end rant

tl;dr - Sick of people defending OoP blindly.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 09-01-2015 at 12:17 AM.
Reply With Quote
  #2  
Old 09-01-2015, 07:08 PM
Kesstryl's Avatar
Kesstryl Kesstryl is offline
Member
 
Join Date: Feb 2012
Posts: 125
Gender: Female
Credits: 25,066
Kesstryl is on a distinguished road
Default

Hall Of Famer Don't worry, I started this off by stating that this is not a poke at Mysidia. I understand that OOP does make pages of code easier for other (OOP) programmers to follow and contribute. I do think some things might be better, just like Kytias said with using classes for database calls, something you will use over and over and over again. I know the era of procedural code is pretty much over, except in beginner coding classes or books.

However, all the things that are argued as being pro-OOP, you can have with procedural code. I know of several MVC frameworks (albeit micro and not full on ones like Codeigniter) that use pure procedural code with not one class. You can have re-usable code with the use of functions. Heck I've even seen blocks of html echoed in functions (not classes, just plain and easy to understand functions) and then included on webpages to piece together the header, footer, and navbar with a main content page. Modular, MVC, re-usable, all can be done procedurally if the code is well organized (and yes I also love commented code, comments are A++). I think Kyttias hit every peeve I've been having with OOP. When overused it does make the code so much more complicated than it needs to be. I'll get there with learning it, but sometimes I want to throw my computer out the window with it.

Kyttias thanks for the link to that page, I knew there was a performance hit with OOP, but that's a lot more than the "minimal" hit I was led to believe.

Last edited by Kesstryl; 09-01-2015 at 07:10 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

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 -5. The time now is 02:51 PM.

Currently Active Users: 2251 (0 members and 2251 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636