Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] java questions

Started by styrpe Mar 10, 2004 at 5:13 PM 5 replies 700+ views
Original Post
styrpe
styrpe
Can someone please help me find information about this topics? I''ve been looking but no results. 1.Factory classes in java 2.Calling convention in java 3.Multitasking in java 4.What are delegates in c#? Why does java doesn''t support them? 5.Any weak points you find in java. 6.Unique features in java Thanks for any help you can give me
Watamerigonsu
pinacolada
pinacolada
Here's a page that describes the answer to the only actual question that you wrote. Seems like a Delegate is a way of wrapping up the address of a member function, so that it can be stored & called.

Like, let's say you have two objects, Model and Display. You want the Display to call its repaint() function every time the Model changes itself. But you don't want the Model to assume that Display has a repaint function- you want to stay as OO and generic as possible. So maybe Model has a function called registerUpdateDelegate, and when Display is created (with a reference to a Model), the Display calls registerUpdateDelegate on the Model, using its repaint() as a parameter (wrapped up in a Delegate or whatever). The Model stores this guy, and then whenever the Model is changed, it calls all of the update delegates that it has stored. So when the Model changes, the Display gets repainted, and everyone's happy.

That site mentiones how you can do this stuff with inner classes, but that's not a great solution I think. Almost all Java code solves this problem by using interfaces, and that works fine.

[edited by - pinacolada on March 10, 2004 6:41:18 PM]
styrpe
styrpe
Thanks for the reply.Sorry about the question part.The last 2 topics is your opinion only.But I''m more interested in Factory classes ,calling conventions,multitasking in java.I need some info in what they are,how do they work.
Watamerigonsu
CaptainJester
CaptainJester
http://java.sun.com/



First make it work, then make it fast. --Brian Kernighan

The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities. We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)

Do not interrupt your enemy when he is making a mistake. - Napolean Bonaparte
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][
polly
polly
Why dont you just write them yourself? Some of these patterns are present in classes in the JDK, if you want an Object Factory or a Singleton or Delegate you just write it yourself..?

I''m not sure what you mean by calling convensions..

And by multitasking I assume you mean threads? Java has a Thread class which you inherit from to implement your own Threads.
Jon

In OOP no one can hear you scream..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.