Re:Why I often implement things from scratch (2006)
by smichel17 on Sunday March 08, 2020 @10:15PM
(#22522328)
Hey, you're me!'I would do this:
1. Add an "invert2x2Matrix(theMatrix)" function.
2. Implement the function myself (no library).
3. Add a comment at the top of the function to the effect of "if this ever ends up doing much more than what the name says, consider replacing it with a library."
I think there's a balance between rolling your own and using a lib, and it boils down to the domain of the problem being solved. If you're really just flipping a 2x2 matrix, the linear algebra lib will have way too much junk you don't need, and learning to use it would be more work than just solving a math problem. On the other hand, if you need a lot of common functionality (like multitouch events on the frontend), then why reinvent the wheel when there are a handful of great libraries for it.