Monte Carlo Simulations and Fibonacci: Why Developers Still Need The Basics
blog.smartbear.com
blog.smartbear.com
If you have an algorithm that you understand and is not too complicated, then I'd argue that MCS are NOT the way to go (maybe in addition but NOT solely). The reason is that due to the law of large numbers it keeps simulating the nice cases instead of the edge cases. Unless you change your input distribution.
I really expected the article to conclude with a link or explanation to Quickcheck [1] since this is exactly what the author is trying to get to (Ie automatically check the edge cases and automatically minimize the input which fails it). Many languages have been porting these ideas. The Scala/Clojure ones are pretty nice.
[1] http://en.wikipedia.org/wiki/QuickCheck
Original paper of 2000:
http://www.eecs.northwestern.edu/~robby/courses/395-495-2009...
You can say that 'oh you should have caught that earlier' and yeah, ok, whatever.
That is, "random input" is not nearly as important as "likely input."
So, the question here would be if you could use a simulation to cover "likely bad" values. Specifically, based on values that have caused previous methods of similar types to fail. I would think certainly. This is, essentially, boundary value testing. (Or am I wrong?)
And yes, I realize there are plenty of libraries that help with this. ScalaCheck/QuickCheck and the like.
http://en.wikipedia.org/wiki/Fuzz_testing
Certainly it is not going to replace many other kinds of testing necessary for building reliable software, but it has its place I guess, this is an interesting case study:
I try arguing, "but all your libraries do at low level is math calculations, don't you want any control over that?"
The typical response is "no"... people are quite happy with the boundaries they feel their API's are setting for them.
You are correct about "why" libraries are created.
Since, I'm assuming you're talking about Open-source libraries: what happens when theres an issue you're having and wondering why the library isn't doing what you want?
There's a distinct difference between looking at something when it's broken for the sake of fixing it and implementing every library on your own because you don't want to use the abstractions created by the programmers who came before you.
Don't you want to know how your cpu works? What happens when you're having an issue and wonder why your code doesn't work as expected?
Depth of knowledge is good, but I think the rational choice is to know the most about the domain you're working in -- because the entire domain is already too big for any one person to fully grasp.
As an example SQL was black magic to me until I made a big tangent off into the functional programming world where name binding and capture is something almost first class, which made SQL almost obvious now that I have a better idea of what and how they could do underneath. It also leads to hacking opportunities otherwise I'd never be able to even think about it.