Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Friday, September 12, 2014

The second life of SVG

Scalable Vector Graphics (SVG) have been around for a while now. As the name suggests, it is a vector image format, ie, SVG images can be resized at no quality loss, just like fonts, and defined in plain text, in an XML format. Back in the early 2000's, it's support was very spotty, and early versions of Internet Explorer just snubbed it... so it basically was a non-starter for web development. It sailed through most of the decade, essentially unnoticed to the greater public, until the stars aligned Google put it on the spotlight.

What happened to SVG in the past decade?
  • Increased need for scalable graphics, independent of 3rd party? The boom of Internet connected devices created a jungle of screens of all shapes and sizes, likely making a workable vector image format much more appealing. Format specifications started evolving at a steadier pace, with version 1.1 being released in 2011, and version 2 underway.
  • SVG Support vastly improved, to the point it is now a perfectly fine option on all major browsers.
  • Other technologies have matured, such as CSS and javascript, to the point of leveraging the XML / txt nature of SVG by integrating it seamlessly to the structure of an HTML document. SVG elements can now be manipulated like any other HTML tags, styled, used for animation or even created on the fly, while retaining its sweet scalability.
Here's a sample SVG-based animation mimicking the type of skill cooldown commonly found in RPG games like World of Warcraft.

See the Pen EwoxL by Dod (@VoodooDod) on CodePen.


EDIT: Here's another sample showing SVG in action, using its native support for animations.

This isn't to say SVG has become the hammer to hit all your web nails with. When it comes to web drawing, HTML5 specs include canvas, essentially a drawing surface which is, in most cases, hardware accelerated. But as often in new technologies, it's not an exact overlap: for one, it's raster based, ie, drawn to-the-pixel for better rendering, but not resizing friendly. It is also very primitive in that all the drawing needs to be coded (SVG images can be vased in a separate file), and it doesn't integrate to HTML the way SVG does: what's in a canvas is not, for instance available to CSS styling or DOM events (click, roll-over, etc.); in short, it can make for great performances when used right, but becomes very tedious for the most basic tasks.

So SVG got a massive usability bump, but it still hasn't gained the level of visibility enjoyed by HTML5. While it can perform very similar functions to HTML5 canvas, they are not quite redundant either. As a rule of thumb, if you are using a limited number of shapes, and a big (or scalable) drawing area, SVG is the most convenient way to go; if you are dealing with picture perfect rendering, or with hundreds of animatable images, canvas is probably the only viable option to squeeze enough performance out of your browser. Either way, many javascript libraries exist to smooth the learning curve. I haven't dug too much into canvas-based libraries, but for SVG, I'd wholeheartedly recommend you to look into Raphael.js.

Wednesday, September 3, 2014

Converging to HTML5

I haven't had, in so far, much exposure to HTML5. There are some explanations to that: one is that my jobs in most the past few years have had me work on thick clients or back ends, the kind of heavy lifting done against proprietary systems / architecture, targeted to internal customer only; another is that the specs on HTML5 are still evolving, and in the corporate world, most of the existing body of work rely on established solutions (or at least perceived so). Still, the web has become ubiquitous, and I had my fair share of ASP .NET, peppered with javascript / JQuery and CSS, just not the bleeding edge kind of project.

Increasingly, though, the HTML5 specs are taking shape, and javascript and CSS have matured in amazing ways since the days where I did full time web development (2004!). And while I'm getting seriously curious, there are 2 other converging factors that are also getting me there:
  • If you are a bit familiar with the .Net scene, it's unlikely you've missed the ongoing community drama that surged with (to put a timeline) the advent of Windows 8, and signs pointing at a shift of focus towards HTML5...  more than raising a few eyebrows, Microsoft's mighty fumble on the future of the .Net platform lead to posts like these. If you bought into the technology for a living, that's quite some incentive to diversify.
  • While I still revere my almighty desktop PC, there's no denying mobile devices have become dominant in the computing market place. It's now more likely for a non IT person to own a laptop than a desktop, and fairly common to own both a phone and a tablet. But it is, for IT people, such a Babel tower, where making an hybrid app running everywhere (or at least on iPad/iPhone, Android, and winRT) has become a Holy Grail; interacting with the device requires platform specific layers so far, but a number of solutions have otherwise emerged to try to keep code bases unified, to name a few:
    • Xamarin: a .Net C# based development tool that lets you code your app in Visual Studio (or not) to have the compiler do the cross-platform heavy lifting; UIs still need to be coded separately though.
    • DevExtreme: a proprietary solution from a company (DevExpress) historically committed to Microsoft products. It leverages Visual Studio as well, but relies on a combination of HTML / javascript / CSS for development, resorting to a 3rd party library (PhoneGap) for interactions with the device. Interestingly, it provides conditional stylesheets to emulate a native look and feel, and packages the entire application so that it installs just like a native app.
    • Appcelerator: an open source XML / Javascript based solution, which compiles to native target code; its company has become the largest third-party app publisher on the Apple store and Android store
    • Adobe Air: With the fall of Flash on Mobile devices back in 2011, with HTML5 as the obvious successor, Adobe side-stepped the problem of having a browser hosted plugin and came up with it own solution, using a side install on one hand, and relying on ActionScript (its legacy proprietary language), HTML, CSS, JavaScript on the other.
    • Rho Mobile: Ruby / HTML / javascript / CSS based solution
    • ...
See a pattern there? While this conveys a feel a bit reminiscent of the browsers' war of the late 90s, there seem to be a fairly clear trend towards the HTML / javascript / CSS trifecta for mobile cross-platform development.

Sunday, August 31, 2014

Post #0

My friends call me Dod. Since you made it to my small corner of the web, you're welcome to it! Nothing to do, by the way, with the good old Day of Defeat (I get that a lot), just an actual diminutive that stuck from my teenage years. I live in the New York area these days, but I grew up in France so if you're looking for the reason for my odd figures of speech, look no further. I'm a programmer by trade, a decent one I believe, though it's a vocation that came to me in the late, fed by a healthy dose of Cartesian logic a nerdy fascination for gadgets and computer games. While most of my school days were spent on open systems (NetBSD mostly), I started out as a web developer using classic ASP (yes, VBScript), and moved on to embrace C# and the various iterations of the .Net framework.

So what got me to start this up? I find myself often popping up with ideas, things to do or to dig up, but somehow life always seems to get in the way, and they come to pass. So this starts up for me as an experiment; I'm making the bet that getting outside of my comfort zone, writing down what's going though this mind wandering of mine and giving it some structure will make something good come out of it. It's a process, and I think the act of sharing may help too.

What's to be expected on this blog then? Well this may cover a vast array of topics, but this is clearly work in progress. Obviously, there will be some nerdy stuff, computer / programming and the like, but I also have a keen interest in sporty topics, food/cooking, reading and traveling. Expect any of this to pepper the geeky stuff at any time!