Re: Unit tests and parameter validation
John Goodsen <[email protected]>
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CAKO2T+OjeNV+LiyuuF2M0EpWiu5o3VuWcJ7-ZiVjWGD8Zv0QaA@mail.gmail.com> |
On Tue, Oct 15, 2013 at 11:42 AM, Eb <[email protected]> wrote: > More to ponder.... I tend to program in a more functional style these days, so you can write much more concise, if-less code ... if you want your data in a collection to be "valid", for example, you flatMap over it and morph the data into a temporary shape that you need (e.g. add some fields, reject values meet some criteria, etc... ... which means I pretty much never have code that validates data anymore and I rarely have if statements in the code at all, because once the data looks like the code wants it to look like, you just let the code do it's thing- sometimes I'll throw in a check temporarily to debug some tests or when we're getting an API right, but then I'll remove those data checks once we're confident they aren't needed anymore... -- [email protected] Public PGP http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x05699A00B7AD03E4