Some stuff about Web and .NET development
RSS icon Email icon Home icon
  • Book review : DOM Scripting

    Posted on January 2nd, 2010 Thibaut 1 comment
    DOM Scripting This excellent book, which primarily targets a web designer audience, teaches you how to manipulate the DOM effectively but also other essential topics used in web development. Prior to reading this book, I already had a good knowledge of the DOM, so the technical aspect wasn’t what I learned the most from this book. And it’s also because the book won’t dig deep into technical aspects as the targetted audience is web designers (and not necessarily developers). An interesting consequence of this is that the author did an outstanding teaching work to make it easily understandable. But what you’ll learn is, according to me, way more useful than pure technical stuff : mastering concepts such as usable javascript, unobtrusive javascript and graceful degradation.

    Pros

    • Very well written and explained : technical concepts are vulgarised and examples are very relevant (mini websites using all the concepts that were teached).
    • Excellent course about the DOM and web development practices using Javascript.

    Cons

    • As the book was written primarily for web designers, it might leave some developers thirsty for more. But anyway, the more important stuff is in the book so that makes the deal. Just keep in mind that you won’t go in deep technical details in this book.

    Conclusion

    Another instant-classic book that will not only teach you the DOM very well, but also essential concepts such as usable javascript, unobtrusive javascript and graceful degradation. If you’re working in the web and those concepts are not familiar to you, this book is a must-have on your bookshelf ! But if you already have an advanced knowledge of these things, you might prefer to pick up another, more advanced book.

    Share/Save/Bookmark

  • What’s wrong with innerHTML ?

    Posted on April 24th, 2009 Thibaut 1 comment

    Every javascript developer knows innerHTML, that famous DOM property that allows you to set or get the HTML markup string of an element. It’s easy, it’s fast but it also kinda sucks. Here’s why :

    • It’s not a standard (it was originally introduced by Microsoft some time ago)
    • innerHTML is only a string with no structure. On the contrary, the DOM is a structured tree that allows to manipulate elements in a way cleaner manner. And you can put plenty of errors into that string without even getting a single warning from the Javascript
    • Maintenance is way much complicated if you have to dig into a complex HTML string than just inserting your line between the right CreateElement() methods of the DOM

    // Note how it’s easy with innerHTML to introduce errors

    // In this case, the div tag is not properly closed

    document.body.innerHTML = “<div>Some text</div”;

     

    // Now with the DOM, in a cleaner and more secure way

    var elt = document.createElement(“div”);

    var txt = document.createTextNode(“Some text”);

    elt.appendChild(txt);

    document.body.appendChild(elt);

    But… innerHTML isn’t completely bad though. In fact, it’s way faster than the DOM and is pretty well supported by browsers. So what should you do then ? There are loads of discussions on that topic on the web. In my opinion, you should always strive to respect the standards, which are primordial when you’re working for the web, but this must not slow down productivity either (by making some libraries or helpers for example). Now the big question : What are my alternatives to working with innerHTML ? This very interesting article will perfectly answer to that.

    Share/Save/Bookmark

  • AJAX tête la première

    Posted on March 4th, 2009 Thibaut 2 comments
    Ajax tête la première Ajax tête la première, or the equivalent in english Ajax head first, introduces you to dynamic and asynchronous UI development. In this book, you will not only learn how Ajax works (XmlHttp, aynchronous requests, callbacks, …) but also how to make effective use of it into your webpages with DOM, JSON, XML, etc… Through multiple application examples, the authors let you put into practise the theory following an interesting incremental approach. Starting with a very basic application, you will add blocks that will transform it into a reactive and modern one, with security issues - such as Sql injection - kept in mind. Below the pros and cons of this book :

    Pros

    • Very clear and well explained book (head first collection reputation)
    • Iterative approach : introduces basic concepts, then new ones through refactoring of previous code examples
    • Originality of examples : surf shop, the chaos project, …
    • Interesting chapter about the Document Object Model (DOM)
    • Also deals with security issues (Sql injection, …)
    • Briefly introduces the main javascript libraries and frameworks, such as script.aculo.usprototype and dojo

    Cons

    • I found the beginning too long (in fact too easy)
    •  Some minor errors in the book, including technical ones

    Conclusion

    I really appreciated this reading, which I found very original and very instructive at the same time. Covered topics, including Ajax basics, Javascript, Xml, Json, Dom and security will give you a strong starting point to go further in Ajax development. A must have.

    Share/Save/Bookmark