DEV Community

On typical naming anti-pattern in Java

Alexey Voinov on August 02, 2018

I think one word summarises it all: OneEyedOneHornedFlyinPurplePeopleEater. Every time I see a typical javish 40+ character class name often compos...
Collapse
 
simonhaisz profile image
simonhaisz

class PeopleEater implements HasEyes, HasHorns, CanFly, HasColor {
...
}

Interfaces: not just for polymorphism.

A related beast is the method name that references it's parameters and/or class.

class Foo
// Why do this...
public void addBarToFoo(Bar bar);
// ...Instead of this?
public void add(Bar bar);
}

Collapse
 
voins profile image
Alexey Voinov

Exactly! :)