I recently signed up with Digital Ocean on their $5/month plan to rent an instance (aka droplet) for the purpose of host…
How to avoid problems without totally avoiding them.
There’s one big difference between iCloud and iTunes when it comes to device backups
If you’re in the US and you have decent T-Mobile coverage in your area you should pay full price for an unlocked phone. …
My latest blog post on medium.com
I work with some interesting people. One guy I work with (let’s call him Harry) has been doing web development a lot lon…
The Pyramid of Code Quality
When evaluating the quality of code, I consider three criteria, whereby each must be satisfied before considering the next. I’ve put these levels into pyramid that I’ve dubbed “The Pyramid of Code Quaity” aka “The 3 C’s” aka “Code’s Hierarchy of Needs”:

Correctness
It should go without saying that if the code doesn’t do what it’s intended to do, it’s worthless (or worse, dangerous). If the code being reviewed doesn’t include tests, then one could even say that the code is not even wrong, since there’s no easy and reproducible way to determine if it works correctly.
Clarity
Once you know that the code is correct and solves the intended problem, it’s important that the code is readable by other programmers. Just because a piece of code works today it does not mean it’s free of bugs, has all the desired features. Plus, software is known to rot over time. Even if the original author remains the sole maintainer, they still need to read and understand the code at some point in the future.
To improve clarity, code should have properly named variables and function, have just enough comments (not too many or too few), use well known design patterns, and follow the given language’s common styles and practices.
Cleverness (aka Conciseness)
Once the code is correct and clearly readable, only then does the cleverness of the code matter. For some programming languages, like Ruby, the cleverness of code is often in service of making it as concise as possible, saving a line here or a character there. Unfortunately, this cleverness can often jeopardize the clarity of the code, in which case it should be avoided.
On the other hand, if you were to compare two equally correct and clearly readable pieces of code, the one more cleverly and concisely written should be preferred. After all, less code produces fewer bugs.
iOS “Open in Chrome” Bookmarklet
Today Google released Chrome for iOS (for free).
Already it’s pretty clear that it’s a much better browser than iOS’s default Safari browser. Unfortunately, even if you want to use Chrome, clicking a link in any other iOS app will launch Safari.
My current workaround is this bit of javascript that will launch the current page in Chrome. Just copy and paste it into a bookmark in Safari, then if you ever find yourself in Safari, but would rather be in Chrome, tap the bookmark and voila! You’re now in Chrome but on the same page!
javascript:location.href="googlechrome"+location.href.substring(4);
Install instructions:
- Copy the bit of code up there.
- Bookmark this page.
- Open the Safari bookmarks, click “edit”, and edit the new bookmark.
- Rename it to “Open in Chrome” or something like that.
- Delete the URL that’s there and paste in the above code.