Tag Info

New answers tagged

1

One technique (using Event-Based Systems with a Mediator): I take advantage of the Mediator Pattern quite a bit -- one way to control event-flow is to instantiate different Mediator objects per-module, and pass only a specific Mediator to each module (as a, or in a sandbox) -- this will allow each module to only communicate through that specific medium, ...


2

First and foremost, you should be consistent with the framework convention. Java is a big world to be sure. I use Java for Android, and here the convention is rather permissive. For example, setOnClickListener allows you to pass in null - this is a crude but nonambiguous way of removing the listener. From Android source code: public class View implements ...


2

Good question. I believe that such methods don't require its own check simply because: NullPointerException is thrown should the event occur, so assuming you tested that case at least once, you would know if null were passed. If you begin adding checks for addListener or removeListener, then you really would have to perform basic checks on every method in ...



Top 50 recent answers are included