Welcome to Incels.is - Involuntary Celibate Forum

Welcome! This is a forum for involuntary celibates: people who lack a significant other. Are you lonely and wish you had someone in your life? You're not alone! Join our forum and talk to people just like you.

Tip #2: A Short but Useful Explanation of Object Orientation Relationships for CodeCels.

Knajjd

Knajjd

Commander
★★
Joined
Sep 2, 2021
Posts
3,125
Online time
9h 44m
As we know, these are the Dark Times and the War Times on the path to nowhere but this doesn't mean we can't understand basic OO concepts a little better when we copy and pasta our code. In return for learning about the Blackpill, NoFap and NoPorn I want to say thank you and I hope this series of tips will be of some use to someone.

The real world has objects and the real world has relationships between these objects. If our code mirrors the real world then the code is easier to understand and maintain (bug fix and add features). Such was the promise of OO. As we all know most code is so unreadable programmers are prone to mild psychosis but here is an explanation of OO relationships.

1. HasA - an aeroplane HasA wing. Models a tightly coupled relationship. An aeroplane does not exist without a wing.

class Aeroplane {
Wing wing = new Wing(); # This is an instance variable.

method1();
method2();
}

2. UsesA - A person UsesA hat. Models a loosely coupled relation. If a person loses his hat, the person remains.

class Person {
method1(Hat hat) { # The hat reference is passed as an argument to the tip method.
hat.tip();
}

3. IsA - A foid is a robot.

class Foid extends Robot { # Prefer HasA relationships over IsA
}

4. LikeA - A lamp behaves like a switch

class Lamp interface Switch {
onLamp();
}
 
Okay but this is really not the place :lul:
 
As we know, these are the Dark Times and the War Times on the path to nowhere
you put this cringe shit in both of your post.
Is this a reference to something?
 
I've been a programmer professionally for 15 years and I don't understand what you were trying to say other than you don't have anything better to do on a Saturday evening.
 
I've been a programmer professionally for 15 years and I don't understand what you were trying to say other than you don't have anything better to do on a Saturday evening.
In my experience OO code does not reflect the problem domain. The tip is an attempt to explain how to code relations between real world objects to help codecels. I too have spent a lifetime working as a programmer, mostly fixing bugs in code no one else would touch. Incels always get the worst jobs. Sorry if I caused offense.
 
polymorphs me
 
can you hack?
looks very impressive
but I dont understand altough I learned while and for loops in my cs bachelor course
but your pro tips are awesome
 

Users who are viewing this thread

shape1
shape2
shape3
shape4
shape5
shape6
Back
Top