Hacker News new | past | comments | ask | show | jobs | submit login
Why you should make sure that your function params are extensible ? (ashu1461.com)
1 point by ashu1461 11 months ago | hide | past | favorite | 3 comments



In general, passing objects around is a seeming workaround for "passing too many arguments in", but really, you still are (passing many arguments in).

Which means that your code sucks and is badly structured.

As for readability argument, I can't not ask why are not all languages using Python's approach by now?

If you dislike everything else about Python, I am sure you can't dislike the fact you can do

  create_user(id=generate_uuid(), name='Lucky Luke')
instead of or in addition to

  create_user(generate_uuid(), 'Lucky Luke')


Well I get your perspective, but I don't think it is universally true

  track_activity(customerId: string, eventId: string, pageId: string, pageName: string, sessionDuration: number)
This can always be refactored into

  track_activity(event: Event)


And then Event grows some other properties for non-tracking purposes which are not used in this function and you realize you now need to construct values you don't need to be able to call this function ;)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: