Skip to content

Comment on Ask HN: Examples of bad open-source code to learn what to avoid?

Comments

Here's some old code of mine:

https://github.com/vatt849/LibMinecraft/blob/master/LibMinec...

The whole library is a trip if you want to read a bunch of bad C#. Highlights:

- Generated documentation

- Giant switch/case instead of a more organized dispatch map

- Large swaths of commented code instead of using version control

- try...catch statements that just eat the errors

- Inconsistent code style

- This thing:

https://github.com/vatt849/LibMinecraft/blob/master/LibMinec...

I've written something similar from scratch since, which I'm still not entirely satisfied with, but is much better for reference:

https://github.com/ddevault/TrueCraft

The client-side networking code lives here:

https://github.com/ddevault/TrueCraft/blob/master/TrueCraft....

https://github.com/ddevault/TrueCraft/blob/master/TrueCraft....

https://github.com/ddevault/TrueCraft/tree/master/TrueCraft....

Notable improvements:

- Handwritten docs only where necessary

- Uses a stream implementation for decoding this particular wire format

- Has a different and better abstraction for reading packets out

Still has bad error handling though.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.