3 ms·
> Using primitives is a good discipline, specifically because your default programming techniques should be clean, simple, efficient. The point isn’t that you s
by stcredzero 14y ago
> Using primitives is a good discipline, specifically because your default programming techniques should be clean, simple, efficient. The point isn’t that you should be prematurely optimizing your code, but rather that when given a choice between two nearly identical approaches, you shouldn’t irrationally choose the less performant option without a good reason.
By the same token, you shouldn't arbitrarily pick the non-object solution without considering the other code interacted with.
> If your language’s standard libraries included both quicksort and bubblesort, you should never choose the latter.
Not entirely true. If you know n <= 8 or some small number, you might want to.
- dancast 14y agoNo - bubble sort is pretty much always the wrong answer. All modern quicksort implementations switch to insertion sort when N is small enough.
- stcredzero 14y agoIn that case, it's pretty disingenuous of him to have bubble sort as analogous to Objects in his analogy.
- seanmcdirmid 14y ago...or if your list is almost already sorted, but in that case better to use insertion sort instead.