Docker for Dummies, I mean Developers

2016 Feb12
I

mages, Containers, and Tags! Oh My! **Docker** is the new hotness in the software world. Dockerize all of the things! For my tastes, [Docker](https://docs.docker.com) is really more of an operations tool for packaging and deploying self contained apps. However, it is making its way into the development circles. I have been finding that, sometimes, developers have a hard time understanding all of the pieces and how the fit together. They tend to copy and paste commands from docs and tutorials and pray to the gods that there app is running. Confusion between containers, and images, building and running and what tags are just has them typing themselves in circles. But fear **not**! There is a

Read More
filed under:  class oop docker

Production Ready Node: Caching

2015 Apr29
c

aching is often times the first line of defense against poor performing applications and very quickly becomes a critical and complex part of various parts of the stack. One of the more frustrating aspects of caching, is that there are so many very capable solutions available - Redis, memcached, memory etc. Even some databases or plain old `files` can be used to cache data in certain circumstances. Each of them having different strengths, weaknesses, uses cases and different APIs.

Cache ['kash] -n, noun; -v, verb

a component that stores data so future requests for that data can be served faster; the data stored in a cache might be the results of an earlier computation, or the duplicates of data

Read More

Production Ready Node: Command Line Tooling

2015 Mar06
c

ommand Line tools are an important component to development, administration and maintenance of most all software projects - large or small. A good command line tool greatly speeds up repetitive operations through simple and flexible abstractions.

The Node.js community has a number of tools out there for quickly building out a command line interfaces, commander being one of the more popular. However, most all of them suffer from the same set of problems, making them difficult to integrate into applications in a clean an re-usable manner. Primarily speaking, there is no way to separate general functionality, from a command, from the argument parsing, or a command from the command line tool itself. This makes building for code re-use

Read More

Better Errors Through JavaScript Inheritance

2015 Jan23
O

ne of the more frustrating things in JavaScript has always been how Errors are handled. They are difficult to check for, harder to extend and often times have cryptic messages providing little insight into what has gone wrong.

Uncaught TypeError: undefined is not a function

Everyone has seen this at one time or another. It isn't very helpful, and these types of errors are actually difficult to account for in JavaScript applications. The only error handling in JavaScript that the language allows is generic try/catch, where you can catch an error, but trying to recover from specific errors is difficult to do. Large in part the the fact that you can throw anything, not just errors. You can

Read More
filed under:  javascript oop errors inheritance

Going "Web Scale" with JavaScript Polymorphism

2013 Jul09
T

he recent trend has been to push more and more work on to the client side as browser become more and more capable. This means that complexity of your javascript can get out of hand very quickly. Being able to scale simple piece up to handle complex and even specialized tasks is an important part of sound javascript application architecture.

One way to accomplish this is through simple polymorphism, or as in many Object Orient Orientated languages, Generic Programming. The general pattern is to have a single light class or module that has a standard set of methods which does nothing more than call methods of the same name on any number of other objects ( classes, modules, etc. )

For

Read More
filed under:  javascript amd polymorphism oop

Fun With MooTool Part 3: Class Mutators

2013 Jun23
T

he Class system in [Mootools](http://mootools.net) a exceptionally powerful for the little amount of code that it is comprised of. A large part of that power comes from the Mutator system. A Mutator can be thought of a lot like a plug-in. However unlike most plug-ins that are executed at run time, Mootools Mutators are executed at the time a class is [actually defined](http://github.com/mootools/mootools-core/blob/master/Source/Class/Class.js#L76) altering the end result of the class

A Mutator is nothing more than a JavaScript function that has access to the internals of the class it is attached to. These functions are stored in a Mutators namespace in the Mootools library.

Read More

Fun With Mootools Part 2: Protected Methods

2012 Jul17
P

rivate and protected class methods can come in handy when creating complex applications. While JavaScript doesn't provide these features natively, [Mootools](http://mootools.net) provides a mechanism to define protected methods on a class. Protected means that the function can only be called by the originating class or a sub-class of the originating class. An attempt to call a protected function by a different class or from an instance of the class would result in error. Here is how you do that with a mootools classs:

var SecretClass = new Class({
	Implements:[Options]
	, initialize: function( options ){
		this.setOptions( options );
		var s = this.protectedMethod();
	}

	/**
	 * A regular class method 
	 */
	,publicMethod: function( name ){
		alert("Hello" + ( name || "world") + "!"
Read More
filed under:  mootools class javascript oop

Pythonic Iterators With Mootools

2012 Jun12
P

ython comes standard with an interesting module called, itertools, which provides a set of functions that make performing complex computations that revolve around iteration much easier. It is actually a invaluable set of tools to have at your disposal when you get comfortable with them. The module itself can work with anything that implements the iterator interface. An iterator is an object wrapper around some sequence that exposes a method called next. When the next method is called, the iterator should return the next item in the sequence and throws a StopIteration exception when there is nothing left in the sequence. While JavaScript doesn't offer anything that would resemble an iterator, that are actually very simple to implement when

Read More

Fun With Mootools Part 1: The Class toElement method

2012 Apr14
T

he [MooTools](http://www.mootools.net) ( My Object Orientated Tools ) JavaScript framework is a pretty sweet piece of software. It's goal is to make developing with JavaScript easier. It provides large set of tools for building complex JavaScript applications. There are a lot of hidden [goodies](http://www.youtube.com/watch?v=6nOVQDMOvvE) tucked away in the framework that kick off one of those ["AHa!" moments](http://en.wikipedia.org/wiki/Eureka_effect). One of those goodies is the toElement method on classes. One of those goodies is the **toElement** method on classes.

The Class' method, toElement, works in tandem with the MooTools document.id ( $ ) method. In most cases, Classes center around a DOM element for some reason

Read More
filed under:  dom mootools class javascript oop