Primitive Obsession Obsession - The Code Whisperer

I hadn't thought about primitive *algorithms* here. In the realm of algorithms, I think Primitive Obsession equates to Not Invented Here Syndrome. Here, we have two competing arguments. I like to err on the side of reusing trustworthy libraries. Unless I have the explicit goal of learning from writing a library, I prefer to use an existing implementation. On the other hand, I have recently read comments like "Programmers shouldn't import 20,000 lines of code in order to avoid writing 10 lines of their own". Once again, this comment shows missing the underlying point: why do I have to import 20,000 lines of code in order to use 10? This is yet another cohesion problem. (Unrelated things are too close together.)

Regarding your specific examples, I at least prefer to work in languages (Ruby, Smalltalk, Python) where I don't have to write loops to implement those algorithms, and when I can't, I import those algorithms from a library that hides the details. Of course, I've done that for so long, that I have to make sure that it hasn't become Yet Another Ritual. :)