Tag Archives: Internet

JavaScript Patterns

Web applications these days, am I right? With all their user experience and fancy A/B tests. It’s all thanks to JavaScript, or, more correctly, browsers and developers alike finally biting the bullet, putting a paper bag over the language’s proverbial head, and getting some good use out of it.

Analogies aside, JavaScript is not so great, but the experts have found ways to reclaim their software engineering integrity. Buried under metric tonnes of “Top 43 jQuery Plugins and Extensions for the Colorblind”, you might actually find such a beacon of knowledge. One of those beacons is a new book, JavaScript Patterns, by Stoyan Stefanov.

My copy is already getting dog ears.

A little bit of personal background, a couple years back I was starting to feel pretty comfortable with jQuery and even started writing my own extensions (not for the colorblind). I was also reading a new book, JavaScript: The Good Parts, by Douglas Crockford. Even though I strongly recommend it, JS: TGP raised more issues than it clarified. Sure, don’t use this and that part of JavaScript, but is that all there is, just a minefield of features, waiting to trip me up? Furthermore, many of those antipatterns he described really only became problematic in larger projects. Shouldn’t I be more concerned about confidently architecting and building those larger projects? I was unable to convince myself that JavaScript was a safe platform on which a very small team could build a stable product. (I even have an ActionScript 3 book from those days.)

Now, end of 2010, enter JavaScript Patterns. It aims to provide insight and best practices for teams who want to create a JavaScript product that won’t be hell to develop and maintain. And for the most part, it’s successful. Stoyan is an engineer at Yahoo, working on YUI, and just off the top of my head, he’s also written Object-Oriented JavaScript and a chapter in High-Performance JavaScript.

Pros

  1. Really does deliver on holistic, well-justified JavaScript programming techniques that embrace the language.
  2. Assumes the appropriate amount of JavaScript and CS knowledge, not too much, not too little.
  3. Focuses mainly on JavaScript, not too much on the specifics of external libraries like jQuery. Libraries these days are big and numerous; a dedicated book for those would probably be more helpful. This one is library-agnostic and might even stay applicable longer.
  4. Adequate treatment of server-side JavaScript. By which I mean, almost none. Similar to the library issue above, server-side JavaScript is still JavaScript. It’s also very volatile and most of the server-side-specific stuff is not unique to JavaScript.

Cons

  1. Could give a little more focus to external libraries. I know I just got done saying that it was a good thing that it didn’t, but face it, almost everyone uses some external library. I think there’s a lot of general advice that one could give to allow developers to extract more from their library of choice while loosening any coupling that may occur along the way.
  2. Lulls a bit in Chapter 6, Code Reuse.
  3. The quote on the back of the book is probably the weakest bit.

    “Stoyan has written the go-to guide for JavaScript developers working on large-scale web applications.”

    Don’t get me wrong, it’s definitely my go-to guide (outside of good old Google), but the quote is from Ryan Grove, YUI Engineer. No offense to Ryan, but if you write a sweet book the publisher should try to hook you up with a quote from someone a little more prestigious than your own coworker.

And that’s all I have to say about that. For the time being, 8.5/10, highly recommended. It’s not very long and it really sets some precedents on which to build. For more study, I recommend you check out YUI Theater and follow some blogs. Ajaxian is great and all, but the real in-depth stuff comes out of projects and project contributors, check out Kangax’s blog (of Prototype fame) and Tim Caswell’s How to Node.

Geek Code

Remember this old bit? Well, I figured it was about time to generate my own. Gentoo users just emerge app-misc/geekcode and run geekcode. There’s also an online generator you can google for. It takes around 15 minutes, and transports you about 15 years into the past.

Here’s me:
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GAT d- s+: a-- C++ UL++ P- L++ E W+++ N o- K w
O-- M-- V-- PS PE- Y PGP t++ 5 X- R !tv b+++ DI+++ D+
G e++ h* r y?
------END GEEK CODE BLOCK------

Here’s a geek code interpreter.

SILT: Google’s Latest Gifts to Coders

This lady on the netbook is almost certainly perusing Google's coding gifts while being frustrated with Gentoo. She gets me. I took this photo at PayPal's Innovate conference a couple weeks ago and it's already my second-most popular photo on flickr. I dedicate this post to you, free netbook lady!


Work and life are trying to keep the SILT posts down, but no way, josé. Fight the power.

I don’t know if these are really the latest, but they’re pretty recent and boy are they handy.

  • I was thoroughly impressed by Google’s properties’ APIs, as demonstrated at the Google Code Playground. Seriously, there’s an incredible amount of data/functionality there.
  • I cannot wait to have something cool enough to code in Go, Google’s new programming language. It’s everything C++ could have been (in a much more perfect world). It mixes everything one could want from dynamic languages (e.g., Python) with the performance and compile-time checks of compiled languages. I’m really cheering for this one, hoping that Google’s backing brings forth a plethora of libraries and frameworks to leverage for practical purposes. Qt bindings or a web framework is what I’m seeking.
  • I’ve basically been relearning Python while using it for the biggest project I’ve done at work, yet. It’s really killing me in spots where there is some unwritten “Pythonic” way of doing something, and I’m met with implicit resistance in doing it the way I had thought made sense. Enter Google’s Style Guides (Python | All). It may not seem like much, but it really helps in those situations when the decision seems arbitrary, but somehow like you might regret making the wrong choice. The simple things, guys. Fundamentals.

As for things I am less grateful for, I am very frustrated with the fact that Gentoo is still on PHP 5.2, because 5.3 has a lot of sweet features, including much better crypto support (of which I am in dire need currently). PHP 5.3.1 is already out, and I can’t get 5.3.0? You guys call this bleeding edge?

Cloudkick is awesome

Cloudkick LogoOh man, cloud computing. It gets talked about a lot, and usually in a really fluffy, “it’s-the-future” sort of way. I’m not sure if we’re all going to have a unified online OS by 2011, but cloud computing is serious business for Internet startups. The ability to lease and scale in smaller and smaller units means a lot for reducing initial costs and maintaining a high level of service for your growing product.

Of course, using cloud-hosting services like Amazon EC2 leads to a different flavor of complexity compared to a considerably more traditional/less scalable/more expensive solution like a dedicated server. So, what can one do to keep it simple while taking advantage of the features offered by cloud computing?

If you haven’t seen it on TechCrunch already, Cloudkick is a free service that can help you do just that. I got a chance to use it a bit during private beta and was very impressed. Alex Polvi and friends at y-combinator have put together a very simple, responsive, and aesthetically pleasing way to monitor and manage all manner of nodes, all from within your browser. Really, some of the stuff these guys do with JavaScript is amazing. (It’s got a sweet in-browser console and it introduced me to the Orbited JavaScript networking library.)

Anyway, if you’ve already got some nodes of your own, or even if you’re just a startup hopeful like myself, I recommend letting the site speak for itself. It’s free, it’s public now, and it’s growing fast.

Hello, world! – A Preliminary Posit

Welcome to blogs. This is one. I had a chance to start a blog way back in the day, 2002ish. Iran has a wacky love affair with The Internet (see blogfa.com, ahmadinejad.ir, and Orkut).

I would have been on the forefront then. But I was like “what’s the point?” Even now my justifications aren’t super compelling:

  1. I probably have a little extra time
  2. I kind of look forward to looking back and shaking my head.
  3. I am maybe trying to broadcast to approximately 3 people in a fashion beyond a comment attached to an article shared on Google Reader.

Anyway, that’s not too bad for a first post. Ah, and eventually I’ll probably end up talking about

  • Comps and techs and progs,
  • sweet Linux commands,
  • some web development (PHP, Flash),
  • politics of the Orient (Easts ranging from Middle to Far),
  • and some personal stuff, like side-projects and maybe some music or product reviews, idk.