{"id":411,"date":"2017-08-02T10:19:44","date_gmt":"2017-08-02T08:19:44","guid":{"rendered":"http:\/\/webposible.com\/xposible\/?p=411"},"modified":"2017-08-02T10:23:35","modified_gmt":"2017-08-02T08:23:35","slug":"dom-vs-todo-lo-demas","status":"publish","type":"post","link":"http:\/\/webposible.com\/xposible\/2017\/dom-vs-todo-lo-demas\/","title":{"rendered":"DOM vs. todo lo dem\u00e1s"},"content":{"rendered":"<p>Como ya he comentado alguna vez, no estoy precisamente a la \u00faltima en las nuevas tendencias de desarrollo web (\u00bf?). Cuando empec\u00e9 en esto, <span lang=\"en\">Netscape<\/span> 4 era mayoritario, y empezaba a manifestarse una guerra de navegadores frente a Internet Explorer.<br \/>\nObviamente todo ha cambiado mucho: ordenadores, navegadores, pantallas, soporte de est\u00e1ndares, velocidad de conexi\u00f3n, las librer\u00edas de <span lang=\"en\">javascript<\/span>, los <span lang=\"en\">frameworks<\/span> web, los m\u00f3viles, y ese mundo inabarcable en el que se est\u00e1 convirtiendo todo lo relacionado con el desarrollo web: <abbr title=\"node package manager\">npm<\/abbr> anuncia 475.000 <span lang=\"en\">building blocks ahora mismo.<br \/>\nLo raro es no tener fatiga de desarrollo <span lang=\"en\">web<\/span> y <span lang=\"en\">javascript<\/span>. Lo normal es sufrir ansiedad porque es imposible estar al d\u00eda.<\/span><\/p>\n<p>Terminado el inciso pseudohist\u00f3rico y de salud mental, y antes de la cita del 2015 que quer\u00eda incluir, me gustar\u00eda dejar apuntadas algunas reflexiones no muy elaboradas, pero que merecen tenerse en cuenta:<\/p>\n<ol>\n<li>Cada bloque de c\u00f3digo y fichero que se incluye en una p\u00e1gina web, implica un aumento del tiempo de carga: ya sea una imagen, o una hoja de estilos. Cada <span lang=\"en\">kilobyte<\/span> cuenta.<\/li>\n<li>Cada nodo que se a\u00f1ade al <abbr lang=\"en\" title=\"Document Object Model\">DOM<\/abbr>, es un elemento m\u00e1s a tener en cuenta para el motor de renderizado del navegador.<\/li>\n<li>Cuando usamos una librer\u00eda que trabaja con el <abbr lang=\"en\" title=\"Document Object Model\">DOM<\/abbr> o una abstracci\u00f3n del mismo, implica que se incrementa el n\u00famero de eventos que est\u00e1n a la espera aunque no se utilice. Afecta al rendimiento (tiempo de carga, uso de memoria,\u2026). <em>Yo desde hace a\u00f1os tengo la imagen mental de un frasco lleno de avispas nerviosas \ud83d\ude42<\/em><\/li>\n<li>Cada nueva librer\u00eda, <span lang=\"en\">plugin<\/span>,&#8230; a\u00f1ade complejidad y posibles problemas de compatibilidad.<\/li>\n<li>La dependencia en el desarrollo de wadus-script junto un equipo de desarrollo con m\u00e1s o menos conocimiento espec\u00edfico, puede tener un alto coste si hay que reemplazarlo.<\/li>\n<\/ol>\n<p>Claro, que tambi\u00e9n se puede ver desde el siguiente punto de vista:<\/p>\n<ol>\n<li>Hay c\u00f3digo y ficheros de una p\u00e1gina web, que valen su peso en oro.<\/li>\n<li>Algunos elementos extra de HTML, identificadores o clases pueden ser muy \u00fatiles (aunque todav\u00eda no lo sepamos).<\/li>\n<li>Hay librer\u00edas que simplifican mucho el tiempo y la eficiencia en el desarrollo.<\/li>\n<li>Al igual que en el punto anterior, hay librer\u00edas que pueden simplificar el desarrollo e incluso solucionar problemas de compatibiliad (como <a title=\"The HTML5 Shiv enables use of HTML5 sectioning elements in legacy Internet Explorer and provides basic HTML5 styling for Internet Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.\" href=\"https:\/\/github.com\/aFarkas\/html5shiv\" hreflang=\"en\">html5shiv<\/a> o <a title=\"ECMAScript 5 compatibility shims for legacy (and modern) JavaScript engines\" href=\"https:\/\/github.com\/es-shims\/es5-shim\" hreflang=\"en\">es5-shim<\/a>).<\/li>\n<li>El uso del wadus-script de turno por un equipo competente, puede tener resultados brillantes.<\/li>\n<\/ol>\n<p>Por lo tanto, <strong>depende<\/strong> es una palabra clave ante estas cuestiones. Al final el factor determinante deber\u00eda ser el proyecto a desarrollar y el rendimiento (en tiempo de carga, tiempo hasta que se puede interactuar, tiempo de desarrollo, calidad de c\u00f3digo y facilidad de mantenimiento,&#8230;).<\/p>\n<p>La teor\u00eda, en ocasiones es sencilla \ud83d\ude42<\/p>\n<p>Y ahora, la cita en cuesti\u00f3n.<\/p>\n<blockquote lang=\"en\" cite=\"http:\/\/webreflection.blogspot.co.uk\/2015\/04\/the-dom-is-not-slow-your-abstraction-is.html\">\n<h3 id=\"the-dom-is-just-fine\">The DOM Is Just Fine<\/h3>\n<p>It puzzles me that developers seem to create themselves a problem and then they point the finger around to search and blame the cause: no, the DOM is not your problem, the fact you brought an over-engineered abstraction on top of a deadly simple task, like a table that needs some quick update, is the real problem you don&#8217;t want to see.<br \/>\nIt scares me that developers behind frameworks seem to be often incapable of getting some fresh air and think out of the cell they put themselves in: learning and using only that framework, ignoring everything else &#8230; sometimes forgetting even common sense, probably shadowed by the framework approach.<br \/>\nLet&#8217;s do ourselves a favor, let&#8217;s stop being religious about any sort of framework and learn what the native world has to offer, what other frameworks have to offer too, and what&#8217;s the best solution for <strong>that<\/strong> specific problem, which is never every problem we have!<br \/>\nEvery framework was born to solve a very specific problem &#8230; have you asked yourself if that is really the same problem you have and the one you need to solve?<br \/>\nMoreover, there will always be a faster, ad-hoc, way to do this or that and your framework cannot cover all the cases &#8230; it&#8217;s actually the opposite: the more cases it will cover, the slower it will be. So let&#8217;s please stop moaning about the DOM and start doing things in a different way &#8230; shall we?<br \/>\nWe&#8217;ll be those with most benefits, after all, so please think about it.<\/p><\/blockquote>\n<p><cite><a lang=\"en\" href=\"http:\/\/webreflection.blogspot.co.uk\/2015\/04\/the-dom-is-not-slow-your-abstraction-is.html\" hreflang=\"en\">The DOM Is NOT Slow, Your Abstraction Is<\/a><\/cite> <span lang=\"it\">Andrea Giammarchi<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Como ya he comentado alguna vez, no estoy precisamente a la \u00faltima en las nuevas tendencias de desarrollo web (\u00bf?). Cuando empec\u00e9 en esto, Netscape 4 era mayoritario, y empezaba a manifestarse una guerra de navegadores frente a Internet Explorer. Obviamente todo ha cambiado mucho: ordenadores, navegadores, pantallas, soporte de est\u00e1ndares, velocidad de conexi\u00f3n, las [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27,62,69],"tags":[],"_links":{"self":[{"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/posts\/411"}],"collection":[{"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/comments?post=411"}],"version-history":[{"count":5,"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/posts\/411\/revisions"}],"predecessor-version":[{"id":416,"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/posts\/411\/revisions\/416"}],"wp:attachment":[{"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/media?parent=411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/categories?post=411"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/webposible.com\/xposible\/wp-json\/wp\/v2\/tags?post=411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}