2 ms·
Yeah, I second the preference for the latter approach. It encourages more reusable components - you get to use `format_user_data` in situations which don't requ
by yen223 9y ago
Yeah, I second the preference for the latter approach. It encourages more reusable components - you get to use `format_user_data` in situations which don't require data validation, for example.
The one downside is the second style of code is a little uglier in languages without a good function composition operator, like Python. I enjoy writing stuff like
user = data
|> format_user_data
|> validate_user_data
in languages that support the pipeline operator.