Delegate vs Callback in Java

前端 未结 3 1407
广开言路
广开言路 2021-02-01 06:37

I have some misunderstanding about terms of delegates and callbacks in Java.

class MyDriver {

    public static void main(String[] argv){
        MyObject myOb         


        
3条回答
  •  悲哀的现实
    2021-02-01 07:32

    What you want to achieve is bidirectional communication between the original caller and a service while avoiding the service to depend on the client. The pattern you use for that goal often depends on the restrictions of your language. You use function pointers, closures or, if you have none of these, callback objects (which might also be seen as closures).

    And then there are often lots of different names for the same or a very similar pattern.

提交回复
热议问题