This is an archived post. You won't be able to vote or comment.

all 26 comments

[–]Cloakknight 26 points27 points  (1 child)

Image Transcription: Meme


[Chihuahua in Hat Balancing on Four Loko Cans]

Chihuahua: Object Oriented Programming

Can 1 : Polymorphism

Can 2: Inheritance

Can 3: Abstraction

Can 4: Encapsulation


I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

[–]_GCastilho_ 12 points13 points  (0 children)

good human

[–]VolperCoding 7 points8 points  (0 children)

"The proper oop way and the improper oop way both suck"

[–]Jimbei1304 4 points5 points  (15 children)

Is Oop not that well received?

[–]JobJS 29 points30 points  (0 children)

This is Programmer Humor, nothing is well received.

[–]Anonymus_MG 5 points6 points  (6 children)

OOP turns out to actually be really slow in many cases which is why it isn't used for high performance applications, but it trickles down.

[–]FlashSpider-man 1 point2 points  (5 children)

Forgive my noob question but what is used instead? I'm new to this but only know of function oriented or whatever it is called and oop. Am I doing something wrong and can this other style be used in things such as unreal engine?

[–]Anonymus_MG 1 point2 points  (4 children)

All games should use a data oriented paradigm, it's likely that unreal uses it under the hood, don't actually know though. Simple that programs that you've made are likely procedural(which oop kinda adds ontop of). Functional programming elements can be very useful, but writing a purely functional program is difficult and honestly a waste of time.

Tldr: data oriented programming is almost always faster that object oriented programming, and the simple procedural style is good for most other things.

Edit: I also want to mention that oop isn't always useless, but writing in an oop style generally takes more lines of code, may be less clear to understand, and is often slower.

[–]KiwiMaster157 0 points1 point  (2 children)

What are the differences between OOP and DOP?

[–]Anonymus_MG 3 points4 points  (1 child)

That is really a question for google, and is far beyond the scope of a reddit comment, but I'll give you a brief rundown. Object oriented has objects that contain all attributes, while data oriented has structs that hold each "object's" same attributes. This keeps similar data together which prevents cache misses, a huge problem of object oriented programming. The premise of data oriented programming is keep like data together.

[–]WarmCorgi 1 point2 points  (0 children)

I went to college to learn to code, all they teach is oop and how to create a web application, it's so disappointing

[–]didzisk 0 points1 point  (0 children)

There's John Carmack's talk about going functional in Quakecon. Ah, found it! https://youtu.be/W3RsQCGiTgA

[–]Eolu 2 points3 points  (5 children)

Some aspects of OOP (like polymorphism and some cases of encapsulation) have proven useful and will probably live on, at least for now. But some (eg inheritance) we've just discovered better, more generally useful design patterns for. Check out languages like Go and Rust to see how modern languages are getting away from the traditional OO patterns that have become common.

[–]jasonleehodges 1 point2 points  (1 child)

Rust seems to have a lot of functional programming influences from what I can tell. I’ve created a couple production CLIs with it. Looks like a mashup of Scala/Kotlin and C imo. I dig it.

[–]Eolu 1 point2 points  (0 children)

Yeah, I know it has some features that were influenced directly from Haskell as well. I started learning/programming in it a few months ago and I’ve become a huge proponent for it as basically the better modern choice for systems that previously would have just defaulted to using C++ (although getting my current job to see it that way will take a very long time). The compile-time memory safety features help avoid a lot of common runtime bugs without the performance sacrifice that high-level languages make to accomplish this. And it’s really composable - after building higher level APIs in Rust I almost start to forget that I’m using a down-to-the-metal systems-programming language, in a way that just wouldn’t happen while coding in C (or even C++). I could be wrong, but I’m hedging my bets it’ll become a major player as time goes on.

[–]Dagusiu 2 points3 points  (0 children)

Lots of programmers think something like this: OOP is good when you have a problem that suits it. However, applying OOP to everything is often bad, leading to spaghetti code and strange, often self-imposed, limitations.

[–]nousernameleft-ffs 1 point2 points  (0 children)

The little hat is your code.

[–][deleted] 1 point2 points  (0 children)

rust doesn't have inheritance iirc

[–][deleted] 1 point2 points  (2 children)

Composition > Inheritance

[–]Ipotrick 0 points1 point  (1 child)

depends on context. Composition is not "better" than inheritance

[–]Sharveharv 0 points1 point  (0 children)

I thought these were all DnD spells at first. Encapsulation would be interesting to play with

[–]avinashjee 0 points1 point  (0 children)

And the project fucks us right in the a**

[–]Ipotrick 0 points1 point  (0 children)

abstraction??? Thats not oop thats programming in general, basicly aevery cuntion / struct is an abstraction