Timeline for Should an object's capabilities be identified exclusively by the interfaces it implements?
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 12, 2018 at 16:00 | vote | accept | TheCatWhisperer | ||
Dec 11, 2017 at 18:52 | comment | added | Berin Loritsch |
you could simplify the check like so: (account as IResettable)?.ResetPassword(); or var resettable = account as IResettable; if(resettable != null) {resettable.ResetPassword()} else {....}
|
|
Dec 11, 2017 at 18:45 | comment | added | TheCatWhisperer | I also very much prefer compositional typing. +1 for making me see that this particular example is not leveraging it properly. Although, I would say computational typing (like traditional inheritance) is more limited when capabilities vary widely (as opposed to how they are implemented). Hence the interfacing approach, which solves a different problem than either compositional typing or standard inheritance. | |
Dec 11, 2017 at 18:32 | history | answered | Alex | CC BY-SA 3.0 |