Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Along similar lines, a while back I took the time to migrate a bunch of Android code dealing with phone number strings in various levels of normalization into a handful of wrapper types that enforced it at the type level.

It didn't take long, identified several flaws in the process, and the instant feedback on misuse alone probably saved more time than it took to do the migration. And being able to implicitly get rid of the duplicate normalization we were doing probably ended up saving more CPU than we lost due to the increased indirection when doing this in Java. (phone number (re)normalization is really expensive, even compared to 1000s of other normal string operations).

I'm totally sold on wrapper types for this kind of thing.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: