{"id":20,"date":"2011-01-13T08:19:13","date_gmt":"2011-01-13T08:19:13","guid":{"rendered":"http:\/\/joose.it\/blog\/?p=20"},"modified":"2011-01-13T08:48:17","modified_gmt":"2011-01-13T08:48:17","slug":"why-joose-part-2-phylosophical","status":"publish","type":"post","link":"http:\/\/joose.it\/blog\/2011\/01\/13\/why-joose-part-2-phylosophical\/","title":{"rendered":"Why Joose? Part #2 (phylosophical)"},"content":{"rendered":"<div>\n<div>\n<div>\n<div>\n<p>If the the <a href=\"http:\/\/joose.it\/blog\/2011\/01\/12\/joose-why\/\">previous<\/a> (practical) answer on the question \u201cWhy Joose?\u201d doesn\u2019t sounds  convincing for you, here is the philosophical (aka meta-physical)  variant. Yes, we like the \u201cmeta\u201d word :)<\/p>\n<h2>Abstraction layers<\/h2>\n<p>Lets start with the following \u2013 why we all are programming anyway?  Obviously to solve some real-world tasks. And we solve them, by  translating the behavior of real-world systems into machine code. Such  translation can\u2019t be direct yet, as the computers are presently \u201cdumb\u201d  and it has to be performed in the <em>layered fashion<\/em>.<\/p>\n<p>That is, the first, outermost abstraction layer is the \u201cuser story\u201d, written in the natural human language by the end-users.<\/p>\n<p>The further level will probably be a technical specification, written  by software analyst, or (in the agile methodology) a set of tests,  representing the data-domain knowledge in the programmer\u2019s head.<\/p>\n<p>Yet another level will be the actual program, most probably written  in some high-level language like JavaScript, Perl or Java (we treat  everything except the assembler as high-level language here).<\/p>\n<p>There will be also a byte-code layer, etc, the chain ends at the actual bits dancing on the silicon chips.<\/p>\n<h2>Complexity<\/h2>\n<p>Ok, now lets take a look from another (quite abstract) side. That  real world task can be characterized by its \u201ccomplexity\u201d. This term is  somewhat close to the \u201centropy\u201d, may be its even a synonym.<\/p>\n<p>We can say that each abstraction layer, we\u2019ve used during translation, <em>absorbs some part<\/em> of that complexity. Like the sponge.<\/p>\n<p>To solve the task, it\u2019s <em>whole<\/em> complexity should be absorbed.  You can\u2019t leave some of it un-absorbed, as that will just means that  some aspects of the system weren\u2019t addressed.<\/p>\n<p>So, the whole point is that, if  you\u2019ll be used \u201cpoorly absorbing\u201d layers as tools, you\u2019ll have to absorb  the remaining complexity <strong><em>somewhere else<\/em><\/strong>, either in the code or in your head :)<\/p>\n<h2>Examples<\/h2>\n<p>Imagine you need to analyze some text file and extract repeating  patterns from it, using C\/C++ string manipulation capabilities. Compare  with the same task for Perl\/JavaScript style regular expressions.<\/p>\n<p>Imagine you need to write the image recognition program in assembler.<\/p>\n<p>Imagine you need to refactor the complex system and you don\u2019t have  the full and complete test suite (outer abstraction layer). Compare with  the same task, when you have it. This is an example of poorly absorbed  complexity.<\/p>\n<p>Compare the implementations of quicksort algorithm in C and Haskell: <a href=\"http:\/\/haskell.org\/haskellwiki\/Introduction\" target=\"_blank\">http:\/\/haskell.org\/haskellwiki\/Introduction<\/a> This is an example of layers with different absorbing capabilities.<\/p>\n<h2>Joose<\/h2>\n<p>So what\u2019s special about the Joose and complexity? Its that Joose has <em>meta-layer<\/em>, which allows you to modify the behavior of <em>your code<\/em> (not the system being modeled).<\/p>\n<p>And, modifying the behavior of the code, you can absorb any  boilerplate you usually had to write. Moreover, you don\u2019t just reduce  the number of lines, you free your mind from that boilerplate. For  example, consider this common pattern:<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">getSomething : function () {\r\n    if (typeof this.something == 'undefined') {\r\n        this.something == \/\/something calculation\r\n    }\r\n    return this.something\r\n}<\/pre>\n<p>How you\u2019ll read this code? \u201cIf we have that `something` undefined,  then we calculate it, and store, we always return `something`\u201d Lots of  words isn\u2019t it? And the nature of `something` is still unclear..<\/p>\n<p>In Joose land, you can just say that `something` <em>is a lazy attribute<\/em>:<\/p>\n<pre><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">has : {\r\n    something : {\r\n        is      : 'rw',\r\n        lazy    : function () {\r\n            return \/\/something calculation\r\n        }\r\n    }\r\n}<\/pre>\n<p>As you can see, the complexity of that pattern was absorbed by Joose and don\u2019t pollute the code and programmer\u2019s mind.<\/p>\n<h2>Conclusion<\/h2>\n<p>Enough of vacant advocacy. In the next post we\u2019ll demonstrate, what  all these words means in practice, and how Joose makes your code simpler  and more robust.<\/p>\n<p>Stay tuned!<\/p>\n<h2>P.S.<\/h2>\n<p>Oh, and we forgot to answer on one very important meta-physical question \u2013 \u201cDoes Joose works with NodeJS?\u201d It does: <a href=\"http:\/\/samuraijack.github.com\/Task-Joose-NodeJS\/\">http:\/\/samuraijack.github.com\/Task-Joose-NodeJS\/<\/a><\/p>\n<p>:D<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If the the previous (practical) answer on the question \u201cWhy Joose?\u201d doesn\u2019t sounds convincing for you, here is the philosophical (aka meta-physical) variant. Yes, we like the \u201cmeta\u201d word :) Abstraction layers Lets start with the following \u2013 why we all are programming anyway? Obviously to solve some real-world tasks. And we solve them, by [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[4],"tags":[6,15],"_links":{"self":[{"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/posts\/20"}],"collection":[{"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":7,"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":38,"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/posts\/20\/revisions\/38"}],"wp:attachment":[{"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/joose.it\/blog\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}