Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java invoker

Name: Anonymous 2012-12-01 19:13

In Java, is it possible to get the invoker of a class? I am trying to create two classes simultaneously but I want them to reference each other, preferably upon creation(constructors) if possible. I know I can sort of do it by returning the stack trace, but this doesn't exactly seem... proper. Any ideas /prog/?

Name: Anonymous 2012-12-01 19:45

>>11
No problem.

I just don't want to see you [i]over[\i] apply the OOP paradigm to solving your problem.

It's not entirely your fault, because in Java, it's shoved down your throat.

First, without seeing your program, I'm trying to encourage a mindset. I want you to think of how you can use the tools to solve your problem, and not do everything your tools make you think you should do. People who don't are dumb and suck at programming. You don't seem dumb, so please, don't suck at programming.

Now, for the concrete part:

Right, at the low level, you want the Model to "know" about the instantiated View object, and vice versa. You also want to know if you can do that on creation, easily and automatically, right? I completely understand why you'd want to do that.

However, I think it's much better for solving the problem if you ignore cramming everything in the object. I'm saying the part where you want to two classes to correspond to each other, or know about each other at all, should be handled in logic inside of a function, and not be something intrinsic to the classes themselves. It's a lot cleaner.

You're not a pain, and if I'm still not clear, let me know.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List