3 ms·
Yeah long time ago I noticed that if some concept/class can have more than 1 instance (i.e. it's not a singleton), eventually you will have to convert APIs to u
by kgeist 4y ago
Yeah long time ago I noticed that if some concept/class can have more than 1 instance (i.e. it's not a singleton), eventually you will have to convert APIs to use arrays anyway, for optimization purposes, when the complexity of your app increases. So now, when designing public APIs, I prefer, for example, methods like ListObjects(spec) instead of FindObject(spec). FindObject is then a simple wrapper around ListObjects for the cases when we know it will return only one object, just for convenience (which can be implemented by the client, without adding it to the public API).