tag:blogger.com,1999:blog-4100091590694628472.post2002596297831185774..comments2023-05-29T02:47:58.176-04:00Comments on Apollo 13 - Tao Liu's blog: F# ≥ C# (Options)Taohttp://www.blogger.com/profile/10181624105046973883noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-4100091590694628472.post-17306342024699095082012-03-03T06:08:16.341-05:002012-03-03T06:08:16.341-05:00Hi!
Null value is a very bad practice
as it b...Hi! <br /><br /><br /><br />Null value is a very bad practice <br />as it breaks the <br />*Single responsibility principle*, <br />null has two responsibilites:<br /><br /><br />1) Be the unassigned state<br /><br />2) Be the Special Case -pattern (Fowler PoEAA)<br /><br /><br /><br />Option is just the Special Case.<br /><br />We don't even need the unassigned state.Thoriumhttps://www.blogger.com/profile/07447234803527434518noreply@blogger.comtag:blogger.com,1999:blog-4100091590694628472.post-39198363124990719372012-02-18T13:56:26.137-05:002012-02-18T13:56:26.137-05:00Yes, it is true we still need the match, but this ...Yes, it is true we still need the match, but this force to pay attention to the fact that this value can have None, in C#'s case NULL. Comparing to C#'s implicit NULL, I think this way is better and lead to less bug.Taohttps://www.blogger.com/profile/10181624105046973883noreply@blogger.comtag:blogger.com,1999:blog-4100091590694628472.post-67096878116263075692012-02-18T11:06:41.361-05:002012-02-18T11:06:41.361-05:00But you still has to check for None every time... ...But you still has to check for None every time... isn't it the same as checking for null? What's the difference?<br /><br />Just for the record. I love options and hate nulls... for me using options is more declarative and meaningful than using nulls.Dmitry Lobanovhttps://www.blogger.com/profile/06575892121371502942noreply@blogger.com