subCHILD

Archive for July, 2008

Passing Hashes (Objects) as Arguments to Functions

posted by admin in Code, JavaScript

If you don’t know this already, JavaScript functions which accept a single object (hash) which contains each of the properties are far better than functions which accept a number of individual parameters.  The reason is that using a hash no longer requires your function’s API to depend on the presence of certain arguments or on their order, and it also means that updating the functions to support new arguments will have no negative impact on all other uses (and users) of it.

So, instead of functions like:

function concat(str1, str2){
	return str1 + str2;
}

concat("This API", " is bad.");

You should create functions that work like this:

function concat(props){
	return props.str1 + props.str2;
}

concat({str1:"This API", str2:" is better.});

More

Choosing a (WordPress) Blog Theme (and customizing it)

posted by admin in Code, design

It seems appropriate to me that the first blog post should be about picking the blog theme since I’ve done this a few times recently (both for myself and others’ blogs) and I always come across the same problems. First of all, the official WordPress themes site offers possibly the lamest selection of themes, which is further degraded by their volume. If you’re looking for a WordPress theme that’s more stylish or unique, I recommend looking elsewhere.

A few sources I came across:

After picking a few themes I liked, I tested them out and also checked the code for each.  I am sad to say that I am yet to see a theme that has code I would consider even decent. Generally, they vary from usable to just plain embarrassing. I’m not sure who writes this stuff, but the theme which I initially chose (Modicus Remix by Art Culture) was simple and slick, but was nothing close to being packaged for distribution. The year in the copyright was hard-coded to “2007″, the feeds were still hard-coded to Art Culture’s feeds, it had its own subscription form, and its own Google Ad Syndication module. Considering that it took a few minutes to remove all this stuff its surprising that they would leave it in.

More

Recent Posts
Recent Comments
About
Simon: Hi there, i am looking for a parameter which can change direction of mov...
CM: Hi, Alex! I know exactly what king of messages you get, like "Hi, I'm new to php a...
admin: Alive and well....
SJ: If the array size exceeded 10 then sorting will not work. any help?...
shutterstock: I've learn several excellent stuff here. Definitely price bookmarking for revisiting....

Subchild is a blog about web development. It's author is Aleksandar Kolundzija, himself a web developer for 10++ years, presently a Hacker-in-Residence at betaworks. Prior to betaworks, Alex worked at Google, Meebo, MLB Advanced Media (MLB.com), Razorfish, and elsewhere.

Some of Alex's side projects include Gallerama.com, Slideshowify, LiveXmlEdit, and other blogs like Dopevector and blog.gallerama.com. When he's not working on any of those, Alex is probably playing guitar, producing music, mixing records, taking photos, playing with his kid, or watching documentaries about particle physics, the monetary system, etc.

Let him know what's up: ak @ subchild.com