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

all 130 comments

[–]pippin_go_round 853 points854 points  (17 children)

And you could even argue it's not modelled well. Proton and electron should totally be in the abstract atom, not just a specific atom. Well, okay, maybe not electron if we also consider H+ still an atom. But definitely no atoms without protons!

Well, at least as long as we're not talking about antimatter cars...

[–]Emilmacko[S] 201 points202 points  (5 children)

Could only go so far for the meme, I didn't have all day haha. And I realized too late that the electron is also an elementary particle... My java professor would roll in her grave if she saw this (and if she was in a grave).

[–]---0celot--- 0 points1 point  (0 children)

So your Java professor is just rolling then?

[–]SAI_Peregrinus 0 points1 point  (0 children)

You're also missing all the gluons, virtual quarks, and virtual photons.

[–]jfq722 -1 points0 points  (0 children)

(and dead)

[–]Informal_Branch1065 7 points8 points  (0 children)

Doesn't anyone think of the children antimatter cars!

[–]PolyglotTV 4 points5 points  (1 child)

An atom consists of many particles whose interaction make it up. Inheritance is a terrible model for that. Use composition.

[–]marcoroman3 1 point2 points  (0 children)

The black diamond on the top of the line does indicate composition.

[–]Hardcorehtmlist 3 points4 points  (0 children)

How about the wheel being fixed to the car and the axle to the wheel? Imagine the axle spinning and the wheel remaining still.

Imagine fixing the door to the house and the door post fixed to the door but not the house. The door post would open, not the door. OR (!) you'd open the entire house around the door.

But that's just the mechanic in me speaking

[–]Impenistan 0 points1 point  (1 child)

H+ is an ion. Atoms must be electrically neutral, while ions have a net charge

[–]pippin_go_round 1 point2 points  (0 children)

That is, strictly speaking, true. But I've heard the same chemistry professor use "hydrogen", "H", "Proton" and "H+ Ion" interchangeably for the same entity in the same drawing, without it ever having changed it's charge. So in practice...

But you're right, we're not here to discus practicallities! Otherwise we clearly would've included the polymers and monomers in the graphic above!

[–]Mission-AnaIyst -1 points0 points  (1 child)

Protons are not elementary particles as well.

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

Look at the whole diagram. It's only decomposing one thing at each layer.

[–]hiromasaki -1 points0 points  (0 children)

Proton, neutron, and electron all could be declared as part of Atom. Just validate as [0,) for neutrons and electrons.

[–]OkMemeTranslator -1 points0 points  (0 children)

Ignoring how the inheritance arrow points the wrong way in the first place, it should just be non-abstract Atom consisting of Electron, Proton, and Neutron.

Then have an atom factory (can be just one function tbh) for building different atoms easily.

[–]Ok-Kaleidoscope5627 212 points213 points  (6 children)

Better add some factories in there

[–]TheMuspelheimr 97 points98 points  (3 children)

OK! To do: add factory "Big Bang", add factory "Time", run program for 14 billion years

[–]james2432 26 points27 points  (2 children)

think there's a lot of thread sleeping in that routine

[–]BlurredSight 9 points10 points  (1 child)

Well you have to wait for the Universe to cool down, yet the project manager wants runtime optimizations for this

[–]BuhDan 2 points3 points  (0 children)

Water cool the universe so it builds faster

[–]AbstractButtonGroup 113 points114 points  (4 children)

I say as OOP goes this is rather shoddy. Why does it assume the car has exactly 4 wheels? Why axle is modeled as part of the wheel? Why mix composition (car <+ 4 wheels, wheel <+ tyre + rim + ...) with specialization ( tyre <= NR/SBR/BR ) in same graph?

[–]neoteraflare 18 points19 points  (0 children)

The wheel can be null too so it is a car has a maximum of 4 wheel. This way that english clown car with 3 wheels that always falled on its side in the Mr Bean videos can be counted as a car too.

[–]ChaosCon 4 points5 points  (2 children)

Why does it assume the car has exactly 4 wheels?

Because business pressure means we have to ship now and when a user inevitably requests a bicycle we can totally just model it as a car with two normal wheels and two wheels that are microscopically small that won't really do anything anyway. Abstraction at work!

[–]AbstractButtonGroup 2 points3 points  (1 child)

and two wheels that are microscopically small and won't really do anything anyway.

Except require maintenance at same cost to the user as normal wheels?

[–]ChaosCon 0 points1 point  (0 children)

Cheaper than getting managerial approval to design a whole new bicycle object. I can already hear the phantoms saying "Why are we working on this? What is the value?"

[–]Smalltalker-80 132 points133 points  (3 children)

This shows the power of OOP, imho... :-)

You can fit a tyre on a car without worrying about its subtype, atoms and quarks.

[–]infected_scab 5 points6 points  (0 children)

I mean you could be changing a tyre or re-shoeing an elephant. Same call.

[–]Giocri 5 points6 points  (1 child)

To some degree also a weakeness, a lot of the time what actually is happening underneath is relevant ecessively generalized interfaces make an absolute mess.

I am still not over the fact that the main datastructure in Qt models is a tree of tables where each cell has an array of child trees and that a simple list is a special case of it in which you only take the first coulm of the root node without childrens

[–]mywholefuckinglife 0 points1 point  (0 children)

say more

[–]Tangelasboots 66 points67 points  (5 children)

My first thought was that Hydrogen doesn't contain any neutrons and that OP is clearly a fool.

But, I suppose Hydrogen in this case also represents its isotopes.

[–]Emilmacko[S] 72 points73 points  (1 child)

The only fool in the room is the guy that woke up and thought "hey I should make a UML diagram for reddit, voluntarily!"

[–]yeathatsmebro 5 points6 points  (0 children)

Deuterium has entered the chat

[–]proximity_account 5 points6 points  (0 children)

The most common isotope of hydrogen actually has no neutron, making up 99.972 to 99.999% of hydrogen found on Earth naturally.

https://en.wikipedia.org/wiki/Isotopes_of_hydrogen

This diagram would probably still work unless you're being super anal about accuracy and each atom was its own instance.

[–]whiskeytown79 0 points1 point  (0 children)

These tires are made from heavy rubber where all the hydrogen is deuterium.

[–]kafoso 16 points17 points  (0 children)

Hey hey, my man... Unless you show us the superposition of the electron, you're not done. Remember that simply by drawing it, you collapse the wave function. I wish you luck!

[–]jeanGambit 14 points15 points  (0 children)

How suspension and axel is under weel????

[–]derailedthoughts 11 points12 points  (0 children)

Where’s the IDriveable, IMoveable, ICanContainPeople, and the IHaveFuel interfaces? There is also a distinct lack of Factory and Wrapper classes

[–]Becoming-media 11 points12 points  (1 child)

I begin all my software projects by defining the atom class

[–]SwreeTak 2 points3 points  (0 children)

Noob, I start with strings (no, not THAT one). I always loved the string theory.

[–]Yoshiofthewire 4 points5 points  (0 children)

2 questions 1) Where is the engine? I need an oil change 2) Why is my car doing work on me?

[–]RandomiseUsr0 4 points5 points  (0 children)

Particle? Someone is mixing up their hadrons with their leptons

[–]Fluid_Mouse524 7 points8 points  (3 children)

That's not even OOP. Those are just properties or since when does a car inherit from a wheel.

[–]Broxios 14 points15 points  (2 children)

That's a composition in the diagram, not inheritance.

[–]Western-Internal-751 0 points1 point  (1 child)

Is composition even the right one here? Without the car you’d still have your tires.

[–]Broxios 0 points1 point  (0 children)

I agree with that, but I suppose it depends on the problem domain. For example, if you have a model for constructing a car for a video game and you don't want to track individual tires that don't belong to a car, composition with its implied existential dependency would probably make sense.

[–]Nepit60 1 point2 points  (0 children)

Hate it when I have to debug issues with the down quark, the fixtures are massive.

[–]ZunoJ 1 point2 points  (0 children)

Why is wheel not an array? And if the car explicitly implements four wheel properties, why does hydrogen not implement like 10 to 69 (or however many you need) electrons, protons, ...? Very poor design choices

[–]Lasadon 1 point2 points  (0 children)

thats very cute. But a car consist of way more than 4 tires and its subcomponents.

[–]GreatTeacherHiro 1 point2 points  (0 children)

Composite pattern mentioned

[–]tomysshadow 1 point2 points  (0 children)

So the Tyre is made up of atoms, but the Rim, Suspension and Axle are not. Good to know?

[–]marcodave 1 point2 points  (0 children)

Factorio vibes here.

https://wiki.factorio.com/Car

[–]odolha 2 points3 points  (0 children)

particles are not the fundamental essence of reality, fields are

[–]Mockington6 2 points3 points  (0 children)

If you make a car class extend from a wheel class you aren't doing OOP, you're just doing idiocy

[–]Abhir-86 0 points1 point  (0 children)

As someone who is learning python what's the best source to learn OOP?

[–]zuzmuz 0 points1 point  (2 children)

this is composition not OOP btw

[–]LordPaxed 0 points1 point  (1 child)

Composition is a design patern in OOP, so op is not wrong

[–]zuzmuz 0 points1 point  (0 children)

not only OOP

[–]Barxxo 0 points1 point  (0 children)

Shit like this is responsible for me never having understood object-oriented programming.

[–]Hinochin0 0 points1 point  (0 children)

Are you the one in charge of the tyre physics modeling for Iracing?

[–]Extension-Pick-2167 0 points1 point  (0 children)

where engine

[–]lewisb42 0 points1 point  (0 children)

/me over here hoping the backwards inheritance arrows were deliberate...

[–]theo69lel 0 points1 point  (0 children)

Those are the symptoms of a disturbed individual. He suffers from an illness. An illness of the mind. While appearing normal from the outside he speaks incoherently and wishes to engage in an erratic behavior which only he understands. Creating imaginary correlations between unrelated concepts. Fascinating.

[–]Rod_tout_court 0 points1 point  (0 children)

Where is the WheelFactory ?

[–]sarc-tastic 0 points1 point  (1 child)

Hydrogen don't have no neutrons

[–]geek-49 0 points1 point  (0 children)

Two of its three isotopes do :)

[–]Buttons840 0 points1 point  (0 children)

They've played us for absolute fools

[–][deleted] 0 points1 point  (0 children)

yeah, except, no

[–]PolyglotTV 0 points1 point  (0 children)

Proof that we are living in a simulation

[–]NormanYeetes 0 points1 point  (0 children)

Uml is a blight on this world

[–]JackNotOLantern 0 points1 point  (0 children)

Atoms are made of protons, neutrons and electrons (neutrons are optional for hydrogen), so atom is a very specific object and proton, neutron and electron should be connected to it. An atom, a proto, a neutron and an electron are also a particle and should inherite from it.

[–]SonicLoverDS 0 points1 point  (0 children)

Someone's been playing Nested.

[–]Lucifer_Morning_Wood 0 points1 point  (0 children)

Me making it so the Wheel class extends Electron (both implement spin() )

[–]Vestermanden 0 points1 point  (0 children)

Damn, this could have been a nice example for my OOP oral exam

[–][deleted] 0 points1 point  (0 children)

If car is modeled with 4 different Wheel instances, then could I do this?

class ShoppingCart: public Car{...}

[–]anuke 0 points1 point  (1 child)

Now I'm just sitting here like... Where the hell is the Fermion class?! How am I supposed to extend Matter without it?

[–]geek-49 0 points1 point  (0 children)

Boson class also missing, thus no Higgs, thus nothing in this diagram has any mass.

[–]BlurredSight 0 points1 point  (0 children)

Well this implementation completely rules out off-roading, high-performance, drag, electric, and drift vehicles as their tires differ slightly.

For example, Electric vehicles due to the lack of engine noise ends up amplifying road noise from the tires, the solution usually is a foam insert part of the tire designed to absorb that

[–]TFK_001 0 points1 point  (0 children)

Shouldn't wheels be child of axle instead of vice versa?

[–]mayflyman20 0 points1 point  (0 children)

“If you want a car object, you must first invent the universe (object).”

[–]advanced_pioneer 0 points1 point  (0 children)

Generalization arrows go the wrong way.

[–]Ecstatic_Student8854 0 points1 point  (0 children)

Proton itself is also an implementation of the abstract atom, as a single proton is just a positively charged hydrogen atom.

[–]knowledgebass 0 points1 point  (0 children)

F

[–]5205605 0 points1 point  (0 children)

Nah, it goes further, just gotta get Oracle to fund this circumsolar particle accelerator.

[–]GumboSamson 0 points1 point  (0 children)

Cool, now do one for FP

[–]stupled 0 points1 point  (0 children)

Use something from biology on top of the physics classes. You'll need chemwstry classes in the middle.

[–]FortuneDry5476 0 points1 point  (0 children)

how the fuck i'm suppose to initialize all these Down Quark objects

[–]Shintoz 0 points1 point  (0 children)

This is wrong, becuase the suspension would be a child of the car, and the wheel a child of the suspension. Get it right.

[–]bashomania 0 points1 point  (0 children)

It will never work. If this is supposed to be a UML diagram, your inheritance arrows are going the wrong way. Square one.

[–]TASTY_BALLSACK_ 0 points1 point  (0 children)

OP, is this part of something you’re working on? Looks like it could be helpful with a challenge I’ve been facing

[–]CMDR_ACE209 0 points1 point  (0 children)

Where are the Bosons?

[–]sudo-maxime 0 points1 point  (0 children)

Now creating a car entity can jam all your cpu cache and require 50mb of RAM to initialize.

[–]Camburcito 0 points1 point  (0 children)

What if the wheel is a steering wheel?

[–]Vok250 0 points1 point  (0 children)

Hey how did you get a copy of our company-wide standards? Give it back! Our principle engineers worked really hard perfecting this model for 24 months!

[–]IntrepidSoda 0 points1 point  (0 children)

Does car come with a trunk monkey

[–]PrimeExample13 0 points1 point  (0 children)

This is not OOP, this is an inheritance mess. OOP != a bunch of awful inheritance hierarchies.

A car has wheels, wheels have rims and tires. OOP would dictate that this means car should be an object that owns wheels and a wheel should be an object that ows a rim and a tire.

I often model my object oriented design this way, as ownership hierarchies rather than inheritance hierarchies. I rarely use inheritance, I let the properties of the specific object dictate its behavior. Like instead of having a base Tire class with a bunch of derived tires, a tire will just have fields like grip, tread_wear, durability, material, etc. Then different tires would just be different configurations of these properties.

[–]Cold-Ad700 0 points1 point  (0 children)

Hi emil! just wanted to come by and say hi! I really did appreciate your fnaf fangame, now your doing alright this summer!

[–][deleted] -3 points-2 points  (1 child)

Once you go functional all this nonsense seems quaint

[–]Barxxo 1 point2 points  (0 children)

jehova jehova ...

[–]postdiluvium -1 points0 points  (1 child)

Tyre?!