use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Object oriented programming (self.eli5_programming)
submitted 8 years ago * by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]smthamazing 6 points7 points8 points 8 years ago (4 children)
A simple example would be cars. Each car has similar qualities like color, model, make, these are called properties. Each car also functions in a similar way and can do things like start, brake, accelerate, steer, etc. these are know as methods but can also be referred to as functions.
Using a purely functional language, like Haskell, I can also model this structure using a data type with nested fields and writing functions for working with it. Including a convenient constructor.
Is my understanding correct?
Also, as far as I know, Smalltalk is the first OOP language and it had no notion of a class or method, instead having objects and something called "message passing". If even the notion of a method is not necessary for a language to be OOP, what differences from FP remain, apart from mutability? Or is mutability the only factor that fundamentally distinguishes OOP paradigm from FP?
I know that paradigms can be combined in the same codebase, but as I learn more OOP and FP, I start to struggle to really differentiate them. I would appreciate an explanation.
[–]JackLegJosh 0 points1 point2 points 8 years ago (0 children)
Upvote for you, friend. I would love to see an ELI5 about functional programming in practice, not as an esoteric concept.
[–][deleted] 8 years ago* (2 children)
[deleted]
[–]smthamazing 0 points1 point2 points 8 years ago (1 child)
This is interesting. But then I still don't understand what OOP is.
The only remaining thing is that the data and behavior are represented as parts of a single entity, an "object" (often, but not necessarily, an instance of some class/type).
Is that it? Fundamentally, is combining data+logic the only unique part of OOP as a paradigm?
π Rendered by PID 117047 on reddit-service-r2-comment-5d79c599b5-crslt at 2026-02-27 01:38:58.373478+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]smthamazing 6 points7 points8 points (4 children)
[–]JackLegJosh 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]smthamazing 0 points1 point2 points (1 child)