28 May, 2014

HTML5 "Programming" is Not Programming

As the HTML5 craze sinks its teeth into more and more programmer-hopefuls, I see a rise in articles that say: "Doodz!  I programming in HTML5!"  Yerk!

The reason I yerk at statements like the above is simple: the "programming" displayed in the articles isn't really HTML5 programming, but Javascript programming.  Oh, yes, these doodz use objects and methods that are built into the user agents which utilize HTML5-only elements;  however, they are not programming in HTML5.

HTML5 programming looks like this:

<!DOCTYPE html>
<html>
    <head>
        <title>Awesome Programmer Dood</title>
    </head>
    <body>
        <article>Look!  Iz programming!</article>
    </body>
</html>


What these starry-eyed neophytes are really programming is this:

<script type="text/javascript">
  function drawSquare(len) {
    cvs = document.getElementById("whiteboard");
    ctx = cvs.getContext("2d");
    ctx.fillStyle = "red";
    ctx.fillRect(0,0,len,len);
  }
</script>

Huh?  What's that I see?  Did that script element say it was Javascript?  Gee, I guess it did.  Any noob can type "<canvas id="whiteboard>", but creating all of the Javascript to do the drawing and so forth is a horse of a different color.

But, I digress.  The point is, programmers who write Javascript code to draw pretty things on HTML5 elements should really be more accurate.  They are programming in Javascript using an api in the user agent.

No comments:

Post a Comment