{"id":1047,"date":"2012-02-17T16:13:38","date_gmt":"2012-02-17T21:13:38","guid":{"rendered":"http:\/\/yuguangzhang.com\/blog\/?p=1047"},"modified":"2013-10-17T18:03:59","modified_gmt":"2013-10-17T22:03:59","slug":"designing-fiddle-code-storage","status":"publish","type":"post","link":"http:\/\/yuguangzhang.com\/blog\/designing-fiddle-code-storage\/","title":{"rendered":"Designing Fiddle Code Storage"},"content":{"rendered":"<p>I just had an aha! insight 5 minutes ago when working on the design to be implemented next month. The previous storage format used string splitting and joining. Everyone who&#8217;s worked with it recognizes the mistake immediately, though the solution didn&#8217;t come until I spent a bit of time designing the system.<\/p>\n<p>Previously, get_code and set_code belonged to the abstract factory. Looking at the way things are used, it may better facilitate the implementation of the local history feature if a code storage class was used. I took a snapshot when I got the idea for the JSON format, so things are still a bit disorganized:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1048\" title=\"Capture\" src=\"http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2012\/02\/Capture.png\" alt=\"\" width=\"439\" height=\"708\" srcset=\"http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2012\/02\/Capture.png 439w, http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2012\/02\/Capture-186x300.png 186w\" sizes=\"auto, (max-width: 439px) 100vw, 439px\" \/><\/p>\n<p>The realization is that this design doesn&#8217;t require the back-end to store all the different languages used in the fiddle. It allows both <a href=\"http:\/\/pythonfiddle.com\">PythonFiddle<\/a>, which stores only Python, and <a href=\"http:\/\/fiddlesalad.com\">FiddleSalad<\/a>, which mixes languages, to use the same storage backend. They already do, but I&#8217;m getting ready to go to the next stage. The <em>\/python\/<\/em> and <em>\/coffeescript\/<\/em> URL structure is still good for SEO and linking purposes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just had an aha! insight 5 minutes ago when working on the design to be implemented next month. The previous storage format used string splitting and joining. Everyone who&#8217;s worked with it recognizes the mistake immediately, though the solution didn&#8217;t come until I spent a bit of time designing the system. Previously, get_code and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[203,23,146],"tags":[162,161],"class_list":["post-1047","post","type-post","status-publish","format-standard","hentry","category-fiddle-salad","category-programming","category-pythonfiddle","tag-class-design","tag-seo"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts\/1047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/comments?post=1047"}],"version-history":[{"count":0,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts\/1047\/revisions"}],"wp:attachment":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/media?parent=1047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/categories?post=1047"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/tags?post=1047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}