{"id":113,"date":"2013-12-12T14:12:36","date_gmt":"2013-12-12T13:12:36","guid":{"rendered":"http:\/\/www.flamingpenguin.co.uk\/blog\/?p=113"},"modified":"2013-12-12T14:17:56","modified_gmt":"2013-12-12T13:17:56","slug":"language-design-things-not-to-do-2","status":"publish","type":"post","link":"https:\/\/www.flamingpenguin.co.uk\/blog\/2013\/12\/12\/language-design-things-not-to-do-2\/","title":{"rendered":"Language Design &#8211; things not to do 2"},"content":{"rendered":"<p>Don&#8217;t make the behaviour of your strings depend on the system time! (Java String hashCodes I&#8217;m looking at you).<\/p>\n<p>It seems like this is<a href=\"http:\/\/vaskoz.wordpress.com\/2013\/04\/06\/java-7-hashing-drastically-better-than-java-6\/\" title=\"java 7 hashing\"> new in Java7<\/a>, and is for security reasons (mostly to stop DOS attacks on hashmaps). So perhaps it could have been abstracted? Instead of putting the code into String.class, call a native method for the string hash seed, and let the JVM control the String hashCode policy? It is yet another source of non-detrminism in the core language.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Don&#8217;t make the behaviour of your strings depend on the system time! (Java String hashCodes I&#8217;m looking at you). It seems like this is new in Java7, and is for security reasons (mostly to stop DOS attacks on hashmaps). So &hellip; <a href=\"https:\/\/www.flamingpenguin.co.uk\/blog\/2013\/12\/12\/language-design-things-not-to-do-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":0,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}