by David LeMieux
Code libraries and frameworks are great. They provide so much of the heavy lifting that developing with them becomes easy and predictable. In most cases, code libraries are a perfect remedy.
In JavaScript, for example, jQuery not only provides a nice interface for dom manipulation, but also normalizes all the browser quirks so that, regardless of how a method is implemented, we know it will work. True encapsulation that benefits the developer. Unfortunately libraries like jQuery come at a cost, albeit an increasingly small one: Bandwidth.
There are things that can be done to offset this, like using a CDN hosted version of the file. There are also tools that can help you manage what features you need and only package those in. Modernizr has an excellent example of this on their download page. Still, there are cases like those I see at work where a 20Kb library takes up too much space.
At Flite I help develop our ad platform. Users can make ads for desktop and mobile web use and then traffic them via different channels. The IAB has numerous guidelines about Internet advertising, and one of them is about file size. Some ads, for example, have to be under 40Kb, images and all. Since we develop a platform that allows users to create ads in a drag-and-drop interface and customize it will different components and features we are, in effect, serving small web applications as ads. But for all the functionality we allow, we can't tap in to the features provided in a library like Angular JS, for example, because the minified file size is nearly 30K on its own, leaving very little room for other assets.
I understand this is a problem that is perhaps unique to our circumstances at Flite. It still holds true that if we can, in most cases, make our file sizes smaller then sites will load faster and faster load times mean more satisfied users. So my question is always this: At what point does using a library become useful?
If all I need to do is get an element on the page, there is no need to use jQuery with its selector interface when regular old Vanilla JavaScript can help:
var item = document.getElementById("theItemIWant");
There is a pattern in some JavaScript libraries in which methods called on an object return that same object so that more methods can be called. This is known as method chaining and it looks something like this:
$('#myDiv').show().addClass('foo').append("Hello"); //And so on
$('#myDiv').width(300).height(300);
$('#myDiv').width() //Returns a number
I made some minor updates to please lately and I figured I could talk about them here.
First, I fixed some bugs around the token replacement and input for aliases that use them. I also made it so that the template values could be provided inline with the initial command so that what was once:
> please do something
> input: _
> please do something -input 'foo'
A quick update to say that I put the bulk of the E.ggTimer code on Github as is. Mostly because it isn't doing much good just sitting there. Also, it will better coax me to make improvements and clean it up.
Check it out on Github
All the different layouts. 1) Large. 2) Medium Large (iPad Horizontal). 3) Medium Small (iPad Vertical) 4) Small (iPhone)
Continuing last years example I made another digital family Christmas card.
Last year I experimented with different HTML5 features including audio and canvas. That card was JavaScript heavy. This year I decided to try my hand at CSS and everyone's favorite buzz-work: Responsive Design. The result is a page with a lot of rectangles and images. Clicking (or tapping) each image will flip it over with CSS 3d transitions and show new content. The JavaScript used is minimal.
I had originally set out to use a framework or library like Twitter's Bootstrap. I found, however, that there was a certain amount of feature overkill for what I was trying to accomplish.
I also attempted to use CSS media queries to support Retina devices, but I failed miserably. Maybe next year?
I've made the code for both cards available at github. As usual, it only works in modern browsers, and even then only really in the webkit ones. I didn't want to take the time to make it compatible. Sorry.
2011
2012
Just a story I did on Twitter. Nothing important.
Back in my day we had books. You had to pick them up and open them and turn each page by hand.— David LeMieux (@lemieuxster) January 29, 2013
And if you wanted to know where something was you'd have to hope it was in the index or that there was even an index at all.— David LeMieux (@lemieuxster) January 29, 2013
And from time to time certain books would be enchanted. Opening them without first saying an incantation would release all of Hell's demons.— David LeMieux (@lemieuxster) January 29, 2013
Then you'd have to run to the warlock's house and ask him to help, but there was always a price. Your Uncle Jim gave his life for ours.— David LeMieux (@lemieuxster) January 29, 2013
Anyway, you kids don't know how good you have it, what with these AR Contacts and cranial implants.— David LeMieux (@lemieuxster) January 29, 2013
For nearly as long as I've worked at Flite I've done more or less the same thing. Not just "writing code" but "writing code to do the same thing." It has been a fun challenge and actually resulted in some work I am very proud of. Recently, however, I was assigned a new thing and it has been delightfully freeing.
I've worked on different projects in the past, but my main focus on all of those projects has been the ad runtime platform at Flite. Now I am working on something more front-end related and the change of pace has done two things: 1) It has given me a chance to stretch different coder muscles and 2) Taking a step back from platform work, I've actually begun to get lots of creative ideas about the platform again. Previously I was feeling somewhat stuck in a loop.
The stresses are different. In the platform code, I have to constantly make sure I'm not making the file size (for a file served thousands of times a minute) too large. I also have to make sure it is robust enough to work anywhere without breaking ad or webpage functionality. Not having that constant worry has been liberating. In its place are new worries - like am I writing code compatible with existing patterns and not breaking user experience - but they are new and fresh and welcome.
For the one or two people who will read this: Flite is Hiring