Skip to content

Comment on How to design an API function that creates something

Comments

I think something that he has missed is the design of passing functions as params for success and failures. Of course these are generally used when there are external API calls which are async, but nowadays those kind of API calls are quite common.

void createSomething(bool param1,int param2, Something something, success: function (something) {}, error: function (error){});

Of course this would be in those languages that support passing of functions as params.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.