13 points

I guess you could call this an OOPsie

permalink
report
reply
1 point

Nice

permalink
report
parent
reply
2 points

😆

permalink
report
parent
reply
8 points
*

I straight up never got a nice answer from StackOverflow on this. Say you have 5 classes, each requiring access to the data members/functions of the others. What’s a nice way to solve this problem? I’ve thought of only two nice shit methods:

  • Pass pointers/shared-pointers etc to each class, but not through the constructor but a setter function
  • Pass lambdas or std::function everywhere. Yuck! Still doesn’t put each object in a valid state in the constructor.
permalink
report
reply
11 points

The. real question is whether this problem needs to be modelled using classes in the first place. The alternative is to just have a set of composable functions that take a piece of data and return a modified version that can be passed to a different function.

permalink
report
parent
reply
11 points

Well, what problems are you trying to solve by having the classes all access each other’s data members? Why is that necessary?

permalink
report
parent
reply
13 points

Repeat after me: public static void main(String[] args)

permalink
report
reply
3 points
public static void main(String[] args)
public static void main(String[] args)
public static void main(String[] args)

Am I summoning the flying spaghetti monster?

permalink
report
parent
reply
2 points

The object man appears behind you while you’re coding and inserts a null reference that takes you a day to find.

permalink
report
parent
reply
2 points

I’m sorry, but the only spaghetti you get is a 17 levels deep if clause.

permalink
report
parent
reply
9 points
*

blasphemy!

void main(int argc, char ** argv, char ** envp)
permalink
report
parent
reply
5 points

Does external logging not happen outside of OOP?

If so, why not?

permalink
report
reply
3 points

It does, hence why it breaks the paradigm.

permalink
report
parent
reply
8 points

Feeling attacked with Leggable and Fleable. I’ve been known to write a concern or two in Ruby on Rails but what can I say? I like my code DRY.

permalink
report
reply
3 points

My biggest problem with it is that those aren’t verbs. You might have LegCount -> Countable and FleaCount -> Countable though.

permalink
report
parent
reply
1 point

Yeah, that’s pretty annoying.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 5.3K

    Monthly active users

  • 884

    Posts

  • 8.9K

    Comments

Community moderators