DEV Community

Discussion on: Refactoring the Worst Code I’ve Ever Written

Collapse
 
simonhaisz profile image
simonhaisz

Would you consider it highjacking your post if we used the comments to share "hold my beer" examples of our own terrible old code? I'm currently thinking of some ridiculously bloated and complicated Java code I wrote in years past when inheritance and generics were my solution to all problems.

Collapse
 
jnschrag profile image
Jacque Schrag

Not at all! Share away. :D

Collapse
 
simonhaisz profile image
simonhaisz • Edited

"Hold my <E extends Beer>"

public abstract class EntityManager <E extends Entity,F extends EntityMetaData,G extends EntityMetaDataCollection<F>,H extends EntityWebService> {

  protected abstract EntityDialog<E,F,G,H,EntityManager<E,F,G,H>> createEntityDialog(F entityMetaData);

}

I once thought the above was good code and was proud of how I had ensured type-safety 😭

Thread Thread
 
markbojesen profile image
Mark Bojesen

As a Java dev, this is just amazing! 😂