tag:blogger.com,1999:blog-5483979277160872058.post5622790876587710839..comments2023-06-25T01:04:54.584+10:00Comments on Rob Smyth: Specific Data Types Avoid Primitives ConfusionRob Smythhttp://www.blogger.com/profile/11185396487990038093noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5483979277160872058.post-37905144939335819062008-07-01T19:58:00.000+10:002008-07-01T19:58:00.000+10:00Hi James,The thing is that I think it is reasonabl...Hi James,<BR/><BR/>The thing is that I think it is reasonable for some to consider 0.1 as 10% while others may interpret it as 0.1%. So a constructor taking a decimal or double not (alone) seem useful.<BR/><BR/>But, your suggestion of an exception would have worked in this case. 0.05 did result in 0.05% which, within the context was unreasonably low. Hmmm ... I want an oportunity to try it out.<BR/><BR/>RobRob Smythhttps://www.blogger.com/profile/11185396487990038093noreply@blogger.comtag:blogger.com,1999:blog-5483979277160872058.post-55380235276879175902008-06-30T11:55:00.000+10:002008-06-30T11:55:00.000+10:00Clarity on construction of an object is interestin...Clarity on construction of an object is interesting area because at first and often as a discussion topic it seems so easy.<BR/><BR/>I was reading the .NET Framework book recently and they had and interesting point on not passing in booleans to set the state of a class. Instead suggesting enums can be more clear.<BR/><BR/>http://msdn.microsoft.com/en-us/library/ms229039.aspx<BR/><BR/>For example <BR/>string.Compare("Dave", "dave", true)<BR/><BR/>This would be better.<BR/><BR/>string.Compare("Dave", "dave", Compare.CaseSensitive)<BR/><BR/>So in dragging this back to your example would a named constructor or even an exception in the constructor of the class that through on an unlikely decimal value have been useful?Greghttps://www.blogger.com/profile/17731003368429757827noreply@blogger.com