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

things have different costs.

Types limit you from making some mistakes, but it also impacts your extensibility. Imagine an enum with 4 values and you want to add 1 because 10 level deep one of the services need new value. How does it usually go with strongly typed languages? You go and update all services until new value is properly propagated to lowest level who actually needs that value.

Now imagine doing same with strings, you can validate at the lowest level, upper levels just pass value as it is. If upper layers have conditionals based on value, they still can limit their logic to those values



Why would you need to update code that isn't matching on the value? It just knows it has an X and passes it to a function that needs an X.


if you don't update the code in intermediate layers, some automated validation based on enum values will fail, which also drops the request


You only need to update the parser and the places that are using it. Depending on language, the parser might update itself (Scala generally works this way). Everyone else has an already parsed value that they're just passing around. That's the point: only run your validation at the outer layer of your application.




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

Search: