{"id":635,"date":"2012-05-24T23:05:57","date_gmt":"2012-05-24T23:05:57","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=635"},"modified":"2012-05-24T23:05:57","modified_gmt":"2012-05-24T23:05:57","slug":"binary-base-2-benefits","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/binary-base-2-benefits\/","title":{"rendered":"Where have all the binaries gone?"},"content":{"rendered":"<p>When I say &quot;binaries&quot;, I&#39;m not referring to a binary file, but rather a programmer who is familiar with, and uses base 2 in practice. I&#39;ve come to know quite a few excellent programmers, but found that they all share one fault (in my opinion) &#8211; they live and breathe in base 10.<\/p>\n<p>This is understandable, after all, we are developing in high level languages which already do quite a bit of work for us, why not let them deal with extra space requirements needed by base 10.<\/p>\n<p>Simply put, it&#39;s easier all the way down the stack (front-end of application down to the CPU itself) for the PC to work with base 2. So, why not lean that direction yourself.<\/p>\n<p>One of the biggest culprits that I find is database field lengths.<\/p>\n<p>I see a lot of:<\/p>\n<p><code>CREATE TABLE mytable (<br \/>\n\t&nbsp; id INT AUTO_INCREMENT,<br \/>\n\t&nbsp; name VARCHAR(30),<br \/>\n\t&nbsp; address VARCHAR(75)<br \/>\n\t)<br \/>\n\t<\/code><\/p>\n<p>\n\tWhile those are nice &quot;round&quot; numbers in our eyes, I&#39;d have to imagine that the database engine would be just a bit happier to see:<\/p>\n<p><code>CREATE TABLE mytable (<br \/>\n\t&nbsp; id INT AUTO_INCREMENT,<br \/>\n\t&nbsp; name VARCHAR(32),<br \/>\n\t&nbsp; address VARCHAR(64)<br \/>\n\t)<\/p>\n<p>\t<\/code><\/p>\n<p>A browser might prefer:<\/p>\n<p><code>&lt;input type=&quot;text&quot; name=&quot;myfield&quot; maxlength=&quot;64&quot; \/&gt;<br \/>\n\t<\/code><\/p>\n<p>Instead of<\/p>\n<p><code>&lt;input type=&quot;text&quot; name=&quot;myfield&quot; maxlength=&quot;50&quot; \/&gt;<br \/>\n\t<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Of course, these things have to line up with your business logic, but they only serve as examples of possible ways you can improve your code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I say &quot;binaries&quot;, I&#39;m not referring to a binary file, but rather a programmer who is familiar with, and uses base 2 in practice.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[14,41,13],"tags":[167],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/635"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=635"}],"version-history":[{"count":1,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/635\/revisions"}],"predecessor-version":[{"id":636,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/635\/revisions\/636"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}