wiki:CodeReuse

How to reuse existing code

The tempting way is to use ready-made open source packages, because someone else is doing maintenance, bug fixes and even occasionally add some improvements.

In reality, however, packages will quickly become bloated, messed up with controversial implementations, etc.

The hard way

One takes only the code you need (and fully understand) and repackages this code into your own packages for the project.

The canonical example is cats package for Scala. No one need the whole of it, especially when we understand how and why it has been made (to show-off, "because I can", "look at me!", etc).

No one needs Monads in a strict (Applicative Order) language. Period. However, occasionally, it might be useful to have some monadic code.

So, take the code (types and functions), re-package it, and re-use. When you need more - do it again. Take only what you use. Same goes for parsing, networking, actually everything.

Last modified 17 months ago Last modified on Nov 2, 2018, 3:06:08 AM
Note: See TracWiki for help on using the wiki.