fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

11K
active users

To async or not to async?

How would you define a library interface for a service that probably will be implemented with an in memory procedure - let's say returning a mapped value to a key you registered programmatically - and a user of your API might want to implement a decorator that needs a 'long running task' - for example you want to log a msg into your db or load additional mapping from a file?

Would you define the interface to return a Task<string> or just a string?

@Fandermill
"probably not async" means "potentially async"

So you're somewhat pushed into designed for "you might need it" not YAGNI, and making it Task-returning

Fandermill

@anthony_steele Wouldn't that make (almost) all public interface declarations to be Task-returning?
Because you never know what an API user is up to. Of course you have your own ideas about how it should be implemented, but I'm always thinking 'I could see the option to use a database for that'.