Timeline for How far should 'var' and null coalescing operator '??' be entertained without hampering readability?
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 26, 2012 at 21:42 | review | Late answers | |||
| Sep 27, 2012 at 6:04 | |||||
| Aug 15, 2012 at 13:27 | comment | added | Muhammad Alkarouri | "Everybody "knows" that GetMeAnObject returns a MyFirstObject, so there's no point checking that." I can't actually think of a scenario in programming where I would actually depend on my memory of what GetMeAnObject if I am debugging. If I checked that PerformOperation is not there, I would have seen the code and no it is for another class. If in an IDE the class would pop up the instance I look at the type of the object. Actually, when the compiler tells me the error, it would say 'class MySecondObject has no operation PerformOperation'. How is that for everybody knows? | |
| Aug 15, 2012 at 11:31 | comment | added | Phoshi |
A co-worker made a breaking change in code not covered by tests, and you think the problem is var? The language cannot be expected to protect against that sort of behaviour--what if they'd modified MyFirstObject directly? It would still have broken, but no syntax could have saved you from that. I'd consider this a strength of var, even: what if instead of returning MySecondObject you were now returning IMyFirstObject instead?
|
|
| Aug 15, 2012 at 10:39 | history | answered | Hugh Phoenix-Hulme | CC BY-SA 3.0 |