Categories
mishaps Uncategorized

Another classic on Interfaces

What good is an interface if you implement it correctly, but …

instead of spelling out like

class MyH4X0rClass implements MyC00lInterface {
void interfaceMethod(){ ....

it looks more like this?

class MyStupidClass { /*forgets to implement MyC00lInterface*/
void interfaceMethod(){ ....

Next thing you know you are testing

if(f00 instanceof MyC00lInterface) .....

and nothing happens – ever. It took me about half a day of work to get that one caught.

And: No I didn’t read t00 much M3g4T0ky0, there is no such thing as t00 much …. it’s all Daniel‘s fault anyway.

So to avoid this. Never use an if without an else. You knew that already? Seems I didn’t :-/

By Yashima

Writer of code and stories

One reply on “Another classic on Interfaces”

Relax, we understand j00
There seems to be quite some hype going on about the Webcomicmanga Megatokyo. Daniel found it and told everybody about it, Sonja seems to be spending too much time on it, and I have to admit, I think I will…

Comments are closed.