Thu 7 Sep 2006
Many times when writing code, a beginner will ask the language to perform an operation and receive an unusual result. While possible, it is highly unlikely that a beginner will find a bug in perl, JavaScript, etc. Programmers must be humble. The fault ususally lies with us.
Chances are we are asking the programming language to do what we mean instead of telling it what we really want to do. Some languages have logic builin that will try to guess when something might go either way, but we shouldn't depend on this.
Here's an example
-
$time = "10:10:00";
-
$other_time = "10:10:40";
No web programming language will return 40 seconds as the answer without extra work.
The programming language does what I want (DWIW), when I was hoping it would do what I mean (DWIM). The next time you don't get a desired result, make certain you are using DWIW.
Leave a Reply
You must be logged in to post a comment.