benc on Nostr: #[0] I got an interesting question I’d like to hear your take on. Is there any ...
unclebobmartin (npub19mu…jnft) I got an interesting question I’d like to hear your take on.
Is there any wisdom when comparing the pros and cons of returning a value versus passing an interface?
// two options for handling a value.
class Foo {
int returnValue();
void passInterface(Handler);
}
interface Handler {
void handle(int);
}
Published at
2023-05-24 13:27:50Event JSON
{
"id": "a6c7bc078a43171033f4b0557fb6ccb4706740dcb2c1e0af80f13a4f1740173a",
"pubkey": "2c405fa031a9f4770a4aeec06b4959f92969d4560525e684bb596b57aa018370",
"created_at": 1684934870,
"kind": 1,
"tags": [
[
"p",
"2ef93f01cd2493e04235a6b87b10d3c4a74e2a7eb7c3caf168268f6af73314b5"
]
],
"content": "#[0] I got an interesting question I’d like to hear your take on. \n\nIs there any wisdom when comparing the pros and cons of returning a value versus passing an interface? \n\n// two options for handling a value. \nclass Foo {\n int returnValue();\n void passInterface(Handler);\n}\n\ninterface Handler {\n void handle(int);\n}",
"sig": "94d64d2686f2a080fe9a4a8ad6826f9f3ff2f57a8a7aded5c78ab7dd9fa233030c8b297f599440b58bf32fb3ad1c599ea6ba26c095d9bf4d04efdd4659f3a83e"
}