Showing posts with label html5. Show all posts
Showing posts with label html5. Show all posts

Friday, September 14, 2012

js Templating Engines



Before we even discuss templating engines, I believe it's worth pointing out the advantages of client-side markup generation:

Because your markup generator is cacheable and your templates too,
  • you save A LOT of bandwidth
  • the ONLY thing a returning user will transfer is the new data, i.e. the strict minimum you can transfer to create the page - considering you transport the data in an efficient format like gzipped json
  • you save A LOT of processing power on the server-side (string manipulation is always expensive), spending a bit more on the client-side (not an issue, even 800mhz ARM is much too fast for such tasks)

To take advantage of that kind of stuff, just create js that will echo your html markup, with the parameters it got from json (you can put your json in a non-cacheable include js file, or get it via ajax), and make sure everything but the data is cached.


The only way to improve on that is to make the templating engine faster, and the unique data smaller (think about how much you can cache really -- like normalized data ;) ).


Lastly, I don't use any kind of templating engine, but all my client side except html,head,body,script is js-generated, and it's extremely fast, even on my phone.



On the other hand, I write web applications, not websites, so that might be why I don't care about that kind of crap  - web apps are best built with modules like in flex, which by definition handle the view and thus templating internally.

Monday, September 10, 2012

Mobile Development : HTML5 vs Native



That guy seems to think native is better because the web is slow, and while he clearly has a point for games (even chrome is not there yet), he's dead wrong on applications, and here's why.


  1. most applications do not use 3D
  2. the only "slow" thing in the [html5/css3/js] combo is js-loop-type visual effects (like fadeIn and that type of crap)
  3. v8 is more than decently fast for js processing, firefox is meh-but-ok
  4. most android phones today are powerful quad cores
  5. those 100% CPU web apps have very low quality code, and that has nothing to do with the technology


Every application that is not a game can be implemented just fine in html5, and will be plenty fast in most browsers.

Now for the points that "native" does not address:

More than being limited to one OS, native is limited to a few versions of  an OS.

An HTML5/CSS3/JS solution (coded to standards) works -
on a phone
on a computer
on a smart TV
on a tablet
on google glasses

So sure, while some actually design games, and some others can totally afford developing a dozen versions of each application, with a dozen platform specialists to leverage all the platform-specific goodies, the simplest approach remains our good (but evil) friend, chrome.