tag:blogger.com,1999:blog-7850692473012665527.post4840817395524745440..comments2023-10-18T05:07:16.474-04:00Comments on the "How Can Renee Make This Code Better?" blog: Class definition to represent playing cardsHello, I'm Renee.http://www.blogger.com/profile/02081872116763616695noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-7850692473012665527.post-90771462501932678852021-12-03T04:05:23.706-05:002021-12-03T04:05:23.706-05:00This one had an extra wrench thrown in because we ...This one had an extra wrench thrown in because we needed to associate integers with suit or facecard values. I completed the class definition and I get now that the benefit of having the named constants is that, even though the constructor method is expecting integers for the suit and number values, you can pass the constants instead so it's a bit more human-readable.<br /><a href="http://www.thecollectionmarts.com/product-category/bedding/" rel="nofollow">brushed cotton sheets</a> , <br /><a href="http://www.thecollectionmarts.com/product-category/bedding/" rel="nofollow">cotton bedsheets online</a> , bridal sets under 200http://www.thecollectionmarts.com/product-category/high-quality-bedsheets/noreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-63789076045210303172013-02-16T08:48:03.614-05:002013-02-16T08:48:03.614-05:00A cleaner way is to start with our 52 Standard Ame...A cleaner way is to start with our 52 Standard American card faces as vector files. You can easily modify these graphics with any vector graphics design tool like the free Inkscape or the not free and not so cheap Adobe Illustrator.twenty four seven toyshttp://www.247toys.co.uknoreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-81259481629846908922011-10-18T21:44:10.490-04:002011-10-18T21:44:10.490-04:00Apparently, it was common practice to use this pat...Apparently, it was common practice to use this pattern (pre java-5) .. take a look at this: http://download.oracle.com/javase/1,5.0/docs/guide/language/enums.html<br /><br />I think the point of using enums of fast validation, memory overhead separating your interface from your implementation and increased type safety.<br /><br />For instance, if you used strings and mis-typed "spades" as "sapdes", this error would not be caught until run-time. However, by relying on constants (final static ints) mistyping Card.SAPDES will cause your program to not even compile. But, as that link above notes, there are problems with this approach as well.joshbuddyhttps://www.blogger.com/profile/11656977341619188833noreply@blogger.comtag:blogger.com,1999:blog-7850692473012665527.post-57449855980979936592011-10-16T22:10:45.021-04:002011-10-16T22:10:45.021-04:003. I don't think its the string comparison, bu...3. I don't think its the string comparison, but later you may need to calculate the rank of a card, for example an ace of spades it a higher card than an ace of hearts. You'd be doing the transition from string to numeric representation to make this calculation more memory efficient. <br /><br />You can compare cases easily using: compareString.equalsIgnoreCase(String string)gpapilionhttps://www.blogger.com/profile/07563851410208121720noreply@blogger.com