3 ms·
Why you should make sure that your function params are extensible ?
- deleted 2y ago[deleted]
- necovek 2y agoIn 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')
- ashu1461 2y agoWell 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)
- necovek 2y agoAnd 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 ;)