These slides are from a short talk I gave at work for my coworkers and especially for our junior developers.
Overall, the slides are probably more of a conversation starter than they are useful in themselves.
How do you choose between using an existing library and coding it yourself? How do you evaluate whether someone else’s code is good or not?
There has never been more options for open source and other ready made components
Whether it’s RubyGems or React components or whatever, it seems like there’s an existing solution to almost every problem.
This makes it ever mnore important to exercise good judgement in choosing wisely.
Switching costs are very real and the bigger the surface area of the added dependency the greater the cost will be.
The first question to ask is whether to code it yourself or to add a 3rd party dependency.
Doing the work yourself will usually take more time but at the same time you maintain full control.
Secondly, what are the ready-made options out there? How well do they match your requirements?
Once your know what’s out there, you can evaluate the options…
- Is there good test coverage?
- Is the documentation good?
- Is it being used by others?
- Is it actively maintained?
- How much code is there?
- Read the code: does it look good?
If there’s very little code, it might be better to just vendor or copy it into your project. Make sure to include the license and attribution details with the code.
Remember that the fastest and most reliable code is no code. No code also has the fewest bugs and security issues.
Obviously we need some amount of code to accomplish what we want to do, but the less code we use to reach our goals the better.
Added code exacts a cost beyond the mere bytes transferred over the network or on disk.
Bytes code added can, arguably, be the most expensive bytes you can add to your project.
As a general rule, the less code you have the faster and more reliable it will be.
This doesn’t mean that you should just give up on writing code or using libraries. It just means that you should be cognizant of the cost.
Above all, be aware of the cost of adding code.
When adding 3rd party code, evaluate its quality. Is the library production quality? Is it being used by other people? Is it being maintained?
Find out what libraries other people are using… Check on Stack Overflow, Google, in tutorials, etc.
Also, Ruby Toolbox has recently been revitalized. And of couse searching on GitHub is a good tool as well.
And that’s it for these slides.