3 ms·
Passing the wrong type in in a dynamic language doesn't matter -unless it leads to the wrong behavior-. If you aren't testing the behavior, dynamic or static la
by lostcolony 6y ago
Passing the wrong type in in a dynamic language doesn't matter -unless it leads to the wrong behavior-. If you aren't testing the behavior, dynamic or static language, you're missing a test case. If you ARE testing the behavior, then dynamic or static doesn't matter; the function works when passed that type of data.
- FridgeSeal 6y ago> Passing the wrong type in in a dynamic language doesn't matter -unless it leads to the wrong behavior. At which point, it really matters and then you spend more time and effort checking and fixing incorrect types. My application crashing because some deep dependency wanted an integer instead of a string, and neglected to tell me is an annoying experience that slows me down, and having to write messy code to validate everything ends up getting in the way of actual business logic. Wildly sending variables into functions and just hoping it won't crash or behave incorrectly and then relying on devs writing comprehensive-enough tests to cover everything produces fragile code in my opinion. Writing and maintaining boilerplate tests just to ensure basic behaviour (before we even get to testing the actual functionality) instead of relying on a type system to simply prevent those issues from ever occurring in the first place seems like a mistake to me.