In code if something is wrong or not working right you know it can be fixed. Sometimes the fix is not easy, and requires lots of work, and research, and testing but after nearly ten years of coding experience I know that if something is wrong I can fix it. There is no problem in code which can't be solved. (Obviously excluding some things like the traveling salesman problem, etc.)
Real life isn't like that, because many factors are out of your control. You can not debug a relationship, or undo a mistake like you can roll back a code update.
At times I find myself retreating to the dependable, stable world of coding, in which changes can be implemented easily and quickly, and where mistakes are easily discovered and corrected. That's isn't necessarily a healthy thing though.
The science is pretty clear that a combination of medication and professionally-guided CBT has the most effective rates for treating depression, and that some specific treatments specifically don't work at all for some people.
http://therapists.psychologytoday.com/rms/content/therapy_me...
Which one is "most effective" (by what measure?) is very debatable.
Here's a Jungian critique of CBT ("Psychology's New God") :
http://hbmag.com/jungian-psychology-series-psychology’s-new-...
Still, though, there are severe forms of depression that can become invulnerable to all the self-help approaches.