Flexible React Components at Any Scale

I’ve been working with React components for about the last 3 years now, with a variety of different state-management conventions being employed, from internal state to object literals to Backbone models to Redux. One of the things I enjoy the most about React is the simplicity of swapping out templates based on whatever logic you want to use. You can have functions that are conditionally called and output template fragments, you can inline your logic as part of a template itself, or you can have entirely different components to render your output conditionally, based on some logic determined by a parent component.
Continue reading

Do you even learn, bro?

ES5 is fairly mainstream at this point, but a lot of real-world developers still have to deal with the likes of IE8 or other legacy support, and shims and polyfills to add missing and expected functionality. ES6 has been pretty heavily fleshed out, and is starting to gain adoption amongst some of the evergreen vendors, but still has a long way to go. ES7 is still very much in the proposal stages.
Continue reading

Evolving jQuery UI For Web Components

My job centers around writing reusable javascript components. As a result, I spend a lot of time reading, a lot of time writing code, and a lot of time revisiting those things I’ve previously written, and trying to improve upon them. In recent months, I’ve been obsessed with performance improvements, both with rendering state as well as optimizing them for the browser’s paint cycles. There are, by now, plenty of articles out there about window.requestAnimationFrame(), deferred objects and promises, development patterns, up-and-coming Web Components proposals, etc. This article is going to be an attempt to marry a lot of those disparate concepts in the context of the jQuery UI Widget Factory, which is one of the more widely used frameworks out there for reusable UI components.
Continue reading

The Javascript Console

Most web developers are familiar with some of the available developer tools out there in various browsers at this point. However, most people don’t use them anywhere near their full potential. The goal of this post is to explore the javascript console in a bit of detail, describing some of the features and techniques of using it, but without duplicating effort on the part of some other good blog posts. I’m sure I’ll miss some items that people deem appropriate or necessary, so please feel free to fill in the gaps in the comments below. I’ll mostly be speaking from the context of the Chrome developer tools, unless I specify otherwise, as I find them to be one of the more (if not the most) robust offerings currently. Continue reading

To Bootstrap, or Not to Bootstrap…

We have a new product we’re apparently looking to spin off here at work, and as part of that conversation, someone threw out the words “Twitter Bootstrap“. For those of you not familiar with Bootstrap, it’s a predefined set of (both stylistic and javascript) visual components¬†and layout scaffolding that makes it fairly quick and easy to prototype websites, and is pretty snazzy in appearance to my developer’s eye, though you might hear differently from designers. Continue reading

Modular Widget Design Architecture

I’ve previously mentioned that I work on the Platform team within my current company, as the caretaker of our central UI widget repository. As part of an ongoing effort, we’ve been in talks with our offices in Washington, D.C. about how to share some of the development effort between our teams, and get the most out of the finite front-end engineering resources we have at our disposal. In our most recent round of collaboration, there was some terminology brought up that I really liked as a method of conceptualizing the building of widgets, and how they should relate to each other. It was put into the context of the building blocks of life itself: Elements, Compounds, Cells, and Organisms. Continue reading

Bend Over, jQuery… This Won’t Hurt a Bit…

I have my first large-scale public presentation coming up in about a month and a half, at the jQuery Conference here in Austin, TX. My topic is about getting the most out of jQuery UI Widgets, mostly dealing with some tips and tricks I’ve either learned or developed over my own time in working with the factory. Some things I’d planned to present were still just conceptual at the time I made my proposal. One of them almost bit me in the ass because of something I hadn’t considered, but having just nailed it with some help from something buried in the bowels of jQuery, I feel compelled to write an article about it, to deviate from some of the more basic, foundational things I’ve been writing about lately. Continue reading

Encapsulation

If you come from a more traditional programming language like C++, Java, or even PHP, you’re probably already familiar with the concept of encapsulation. So what is encapsulation? It’s the act of hiding some parts of your code from some other parts of your code, and only exposing what’s deemed necessary for the consumers of that code. Think about it as your custom object types providing an API, or interface, to any external code that might be consuming the functionality your custom objects provide. Continue reading

Object Prototypes

Javascript object prototypes are a topic that’s very near and dear to my heart. Not nearly enough developers make use of the prototype object, or contemplate the overhead of prototype chaining of deeply nested object constructors. Some people use them, but not quite correctly, as in they don’t exactly know where to draw the line in the sand between what should be stored in an instance of an object, and what should be stored in that object’s prototype. This post will attempt to demystify javascript prototypes, and to make them a weapon of choice in your developer arsenal. Continue reading

Primitive Data Types

Javascript only has and handful of primitive data types: string, number, boolean, null, and undefined. So what makes a data type primitive? For one thing, primitive data types have no members whatsoever; they are strictly a value that can be assigned to a variable or compared against. For another, any variable references to a primitive type are passed from function to function by value rather than by reference, as typical objects are. Continue reading