I have seen quite a few catastrophically losing code in my professional career, no matter is it free or commercial software.
Programming language can learn (conditionally) anyone in a weekend or few, but the difference between pure and good programmer is to have algorithms in his little finger using appropriate for the task, have ability to make a suitable corrections in it if needed, perform appropriate optimization and finally, as a result, it will have optimal solution for the task.
Take for example mentioned sorting. Everybody know that original QSort is one of the fastest in-place sorting algorithms (except in worst case scenarios), however his recursive nature may be extremely dangerous. If there is maximally 100's of data to sort, the most optimal solution may be to use Shell or even Insertion...
Proper decision depends on precisely defined requirements, according to complete software design. Often is much more beneficial if CEO have no grasp about programming, instead to know a bit, combining with a "God complex", including as well working environment with junior software engineers. That is a nightmare for any skilled and experience programmer.