9 points

I guess you could call this an OOPsie

permalink
report
reply
2 points

😆

permalink
report
parent
reply
11 points

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

permalink
report
reply
1 point
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
1 point

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

permalink
report
parent
reply
8 points
*

blasphemy!

void main(int argc, char ** argv, char ** envp)
permalink
report
parent
reply
6 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
8 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
10 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
5 points

Does external logging not happen outside of OOP?

If so, why not?

permalink
report
reply
2 points

It does, hence why it breaks the paradigm.

permalink
report
parent
reply
19 points

I misread Exceptioncatcher as Exceptionhatcher and I think it still fits

permalink
report
reply
4 points

I believe the lifecycle goes ExceptionLayer, ExceptionIncubator, ExceptionHatcher

It’s critical you don’t throw your exceptions too early, they need to learn to fly first 🤣

permalink
report
parent
reply
1 point

I thought that’s why you throw them?

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.4K

    Monthly active users

  • 887

    Posts

  • 9K

    Comments

Community moderators