Fun in Source Code with Off And Away

Off and Away is a neat travel bidding site that lets you bid on travel deals for pennies. (The bids cost roughly a buck, though.) Curious at how their timer was put together, biz-partner Bob took a peek at their JavaScript. Somewhat surprised to find that they hadn’t minified it, he was even more amused by their credit card function, aptly named $.fn.creditcard_shizzle.

When writing and testing code, it’s really tempting to put in junk data or in-jokes or other fun bits. As a development company, we’ve banned that outright, even in development environments, because we’ve discovered that somehow, some way, our little joke will end up live, released to clients or their customers, or even worse, appear in big bold letters in the middle of a demo. Nothing quite matches the sheer terror and stomach-pit feeling as having “stupid mcassface” show up during a demo.

Clearly, Off and Away’s devs/founders have a sense of humor and since this is source code and not customer-facing, this isn’t really a big deal. It’s not even vulgar. But it’s amusing to stumble across these sort of gems, as long as they’re not in the middle of a demo. For more fun, search swear words on Google’s Code Search. You’ll find some exasperated comments, angry rants, and outright bitterness, to be sure. (Hell, even Microsoft’s done it.)

Off and Away

Posted in: Development

Is PHP 5.3 Terminal? Well, It’s Getting One For Namespaces

A language lives and dies by how easy it is for a person to express something within that language. But the ease in expression is much like the type I and type II error rate in a statistical test: as you adjust one to be nearer to where you want it to be, the other gets farther away. So the architects of a language have to choose between adding more keywords and constructs or having longer, but simpler sequences of existing ones.

PHP is a very easy language to learn and use because it has a syntax that is a simplified sampling from C++/Java and Perl. People who use these languages pick up PHP fast, and people who haven’t used any languages often learn PHP with as much ease as they would learn Perl.

Read More »

Posted in: Articles, Development

Introducing Ask

Sometimes, our developers are a bit too busy to come up with blog topics on their own. They’ve requested we have the masses feed them to them directly, instead.  So in an effort to make their lives easier (and to stop us from having to beat posts out of them each week), we’ve created a new category: Ask  Here, we hope to open up to our readers and answer any of your questions on anything ranging from UI/UX design concepts, complex development issues, architecture and code concepts and everything in between.  We’d also love for you to seek reviews of websites, services, books or anything else related to technology or that you happen to find interesting in the field.

So start submitting your ideas for topics you’d like us to cover, your questions, and your links for our review now!  We’ve added this handy form that shows up on the sidebar when you are in the Ask HTMList section of the site to make it easier on you.   And of course, you can email your questions to ask [at] htmlist [dot] com. Try to stump us; we’ll let you know if we had to cave to Google in our responses!

Posted in: Announcements, Ask

You Suck At Programming And I Hate You: Things NEVER To Do In PHP & SQL

One of the more exciting (by which I mean soul-crushing, murderous-rage inducing) things about my job is getting to look at the terrible, terrible code that runs all sorts of different websites on the internet. Chances are, you wrote some of this terrible code; I know I did.  It’s even possible that you still write such code. In case you do, go grab yourself a stiff drink (a strong vodka martini, or gin and tonic is recommended) and get comfortable, because I’m about to lay some edumacation on you.

Things You Should Never Do

First, I’m going to talk about some things I’ve come across that you should never, ever do. If you do these things and I ever have to work on your code, be prepared for the fury of ten-thousand burning suns to come crashing down around you, for I have warned you. Pay it forward by writing decent code, for one day you may find yourself having to maintain someone else’s heap of terrible code and woe, for you shall feel some tinge of guilt, having made other developers go through your new hell.

All of the snippets in this article were found in actual code being used in the wild. (And most of them come from a single, disastrous, amalgamation-of-fail file.)

Read More »

Posted in: Development, Rants

The Lazy, Clever Programmer: A Compendium Of Code Reuse & Recycling

I started getting “serious” about development because I had a desire never to write lengthy, wandering streams of code again.  It was not for any reason but unadulterated laziness—the kind that so overpowers the better senses as to force a person to spend hours in a chair with the express goal of not spending hours in said chair.  It’s a wild, consuming laziness that seems to know no bounds.

As developers, once we start separating our code into abstract ontological typologies, we make use of the human mind’s phenomenal ability to work with types.  Our code becomes less about jump tables and registers and more about users, email messages and images.  What once was a problem of allocating resources and operations within the computer becomes an abstract, logical problem within a collection of objects.  Like children awe-struck by stories of magicians of old, speaking incantations and pressing their wishes into reality by the power of their mind alone, we become drunk with the sense of awe and possibility.

We *really* dive into things after the jump, so go ahead and hit it.

Read More »

Posted in: Articles, Development

Why you really, *really* should document your code properly, inside and out

Coders like to code; coders don’t like to write. It’s no secret that thorough and approachable documentation is a rarity in the coding world. Despite its necessity for the adoptability of a given software package, finding good documentation is notoriously difficult. I’ve seen “documentation” consist of a simple phpDocumentor run. To the folks at Magento: this is NOT DOCUMENTATION!!! It’s merely is an incomplete reference guide!

Maybe it’s because I’m not the greatest coder this side of the Mississippi, or perhaps because I actually have an interest in writing English, but I, for one, like to write documentation. In past projects, I have begged bosses and project managers to allocate time for me to document the code that I have written (every time I was denied…by the way). [Not the case here, for the record. We love documentation and Brandon's new. He'll come to see that. :-) —Ed] Good documentation, whether for internal applications or publicly available code bases is nearly as important as the code itself. Here’s why, after the jump.

Read More »

Posted in: Development, How To, Rants

Function References and Runtime Functions in PHP 5

Well, it’s the final hour of the final day, so it’s time for my weekly mandatory blog post. I was going to counter-rant a hack-job post and call the author a chump as much as my fingers could muster. But I was told that “Chump!” three hundred times is not a blog post. As I was thinking of other topics to write about I realized two things. First, no one cares that much about Lindsay Lohan anymore. Second, I have a hard time deciding what to do.

But it is this distinct lack of commitment that, while being so destructive to my personal relationships, has brought me into a rarely discussed nether-region of PHP functionally: function references and lambda functions. The sad thing is there isn’t really either in the language – at least not what you’re thinking of if you just read “function references” and “lambda functions” and though, “Oh yeah! Those are awesome!”. No, I’m going to talk about the dark and shameful ways in which we make do without these features in PHP. That feeling you just got? It’s called excitement. Actually, it’s probably indigestion, but get it checked out anyway. All good? Follow us after the jump for a look into the depths of PHP 5.

Read More »

Posted in: Development