Brent has some thoughts on strong and weakly typed programming languages. Starting point: a simple function that needs testing:
rgbToHex(red, green, blue) {
// …
}
Testing the result the function should return is easy. But what about edge cases?
What happens though if we pass doubles instead of integers? Or numbers outside of the allowed range? What about
null
? Or strings Or the wrong amount of arguments? Or a combination of the above?
Ah, the starting point for a nice article … (and no, requiring int
s is not a bulletproof solution)
🔥 Be sure to also check out Brent’s podcast Rant With Brent.