Friday, February 9th, 2007

So you want to write Javascript for a living?

Category: Editorial

“What do you need to know if you are interviewing for a job that involves Javascript development?”

That is the question posed to various people in the industry such as Elaine Wherry of Meebo, Tom Trenka of Dojo, Neelesh Tendulkar of Simply Hired, and Nicholas Zakas, author of Professional JavaScript for Web Developers.

Here are some of their thoughts:

  • You need to know how to create an element on the fly, get a reference to any element on the page, insert, remove, replace, etc. nodes in the page. These methods should be memorized!
  • No modern web application can survive without event handlers. Knowledge of the differences across browsers and issues surrounding event handling are a must.
  • Do you have any experience with JSON? If so, … why do you think some developers may prefer to use this as the envelope language as opposed to XML?
  • This means understanding how to set up a prototype chain and how to make sure a base constructor is applied correctly in the process of object instantiation.
  • The basics of JS object mutability, and using that to isolate code. Basically faking namespaces by using objects to hold other objects.
  • It’s really important for you to be able to write your own code without relying on JavaScript libraries like Dojo, Prototype, etc.

Do you agree? Anything you would add?

Posted by Dion Almaer at 4:40 am
40 Comments

++++-
4.1 rating from 59 votes

40 Comments »

Comments feed TrackBack URI

Well, in the case you JUST do JS for a living, I suppose this is right! But hey: who the hell just codes JS and gets paid enough to survive the cold winters?

In my daily work, I do alot of JS/Ajax for various projects! I know how to code most of the JS I need but JS won’t pay my bills!!! You have to know more than just JS to do your job!

I cannot imagine that you hire a guy who just can do JS and nothing else…

Comment by Georges — February 9, 2007

You can use a language if you know the basics of it. Most don’t need more, but if you want to master a language, you need to know what’s going on one level below.

This means, to master JavaScript (that is, as used in web browsers), you need to understand how a web browser works. That is, how rendering is done, how asset loading works, multi-threaded parts vs. single-threaded stuff, handling of CSS, DOM population while the page is loading, browser quirks and so on and so forth.

I believe that besides the newbs and the JavaScript overlords, the various libraries help built a new solid “middle-class” generation of JavaScript developers, that get real stuff done but neither want nor need to deal with the really obscure things.

Comment by Thomas Fuchs — February 9, 2007

This is preposterous… I have been using JS for nearly ten years now (in issues ranging from simple form validation to full-fledged Ajax app)… but I won’t learn by heart how to create nodes and move them around, nor need I to use namespaces… the libraries do all the grunt work for us!!! why bother?

Comment by Sad Developper — February 9, 2007

More I want to add:

If we need to know all this about Javascript, so other developers (including me) who develop desktop software do have to know how creating a visual form works and do I have to know how to code that in Assembler? ;)

Comment by Georges — February 9, 2007

Nobody survives on javascript alone.. this is stupid.

Comment by mikael bergkvist — February 9, 2007

This covers the technical part. I agree with most (don’t consider the prototype chain stuff too much of a necessity though).

The far more interesting aspect is though if you are able to write JavaScript that degrades well, takes accessibility into consideration (which means you need to know how browsers behave and fail), can be maintained by someone who is not on your level and can be localized to other languages?

IMHO knowing JS is only half the battle, implementing it without making people dependent on you or your code being a maintenance horror is the other half.

Comment by Chris Heilmann — February 9, 2007

“Georges”:
I used to be an okay developer – I could write programs in Visual Basic .NET. Then, I tried writing an operating system – from scratch.

I didn’t get that far (though I spent a lot of time on it), I only managed to make a system which would start up, recognize keyboard and mouse, show some stuff on the screen, and attempt (somewhat badly) to load a file from a floppy.

However, while writing this, I learned how operating systems work. I can now almost see what kind of assembler commands C code would turn into (even though I don’t really know assembler – I just have an idea of what commands are in it).

What I learned made me much better at writing programs.

However, when it comes to JavaScript – I would love it if I had time to really see how JS works and how web browsers work inside, but I don’t have that kind of time. I don’t, frankly, even have time to remember various javascript functions (I remember plenty, but I can’t right now remember off the top of my head what adds an element – is it document.addElement()?). I do not see any problem with this, as whenever I need to find something it is easily find-able online.

Alex

Comment by Alex — February 9, 2007

I do believe that having a HUGE knowledge of JS is important especially in the days where WEB APPS are becoming more and more used.

Of course having JS on its own is hopeless without the need of a server side language.

But If was running a company which specialized in web apps. e.g meebo then i’d defiently hire someone with mainly JS skills and leave the server side code to the other guros.

I agree with this 100%

Comment by MissenLinx — February 9, 2007

I do about 80% JavaScript and 20% PHP in my current job role. This is because the project I am working on requires a heavy client side and server side mix. JavaScript was the first language I was exposed to back in the 11th grade of high school. I have loved it ever since. Over the years I have learned others, but I am glad to see the resurge of JS in the web dev scene. I do have all the aforementioned commands memorized and many more. To top it off I get paid more than enough to survive. I think the questions posed in the article are valid.

Comment by jd — February 9, 2007

I couldn’t resist to react :-)
For the last 10 years, I earn my living mostly writing JavaScript, but I guess there are not many like me…
The question I would add: How use JavaScript unobtrusively in web pages?

Comment by Michel Van der Meiren — February 9, 2007

There are a few who can make a living doing only JS coding and it seems that those who do are either authors or library developers. For most people, such as myself, you can make JS your primary focus, but I can’t code or strictly deal with JS to make my living.

It makes sense that if you know JS, it’s almost a guarantee that you know other languages to further develop your application. The only other route I could see would be a UI engineer, but even then you’d probably have to deal with some kind of back end code.

Comment by Andrew Herron — February 9, 2007

I’ve been a contract programmer for ten years and only once have I been hired to write JavaScript.

Comment by Dean Edwards — February 9, 2007

Here is my list of thing to know if you are serious about Javascript development and would want to interview with me:

Know your Dom:
Strong knowledge of the Dom rather then memorizing how to add, remove nodes. (I wrote more js than anybody I know personally and if I don’t write any for a month, I can’t remember the methods) Anywhere you go is a different beast. Somebody might use dojo, some yui or prototype, or proprietary library. With some company you have cart blanche and can craft your own. I used to write javascript to be inserted in content section of AOL and Netscape. My boss thought that every library was bloated and had me write everything from scratch, with no dependencies and every script was supposed to be under 2-5k(That’s how I discovered json). Good knowledge of the Dom and Browser issues crosses over libraries and approaches. (can you replace a table row in every browser?)

Know your CSS and (X)HTML: Beside the Dom a js developer should understand and know CSS and (X)HTML like the back of his hands. Without that knowledge most of the scripts are going to be crap. How to create a tabular view without a table, in turns: when to use a table and when not to. When to use lists. The best HTML structure for the task at hand.

Know your Events and Callbacks: A good understanding of the event model are key to any interactivity. If you want to do advanced stuff, ujs and so on you need to understand events and callbacks.

Know your Browsers: all of the above have small or sometimes big differences on each browsers

Know your Javascript: Javascript is definitely one of my favorite languages. (It was my favorite before I discovered Ruby) Javascript is different from any other language. The syntax is deceiving, Js is not even close to c nor java in mentality. It’s scheme++ (the second plus is for design errors :). Understanding the prototype and prototypal inheritance characteristic are musts. Understanding the functional aspect is key to write great javascript. Javascript as a language packs a lot of power for being so lightweight. You must embrace the JS mentality and be able to write it like javascript and not like java.

Be passionate about it: Writing javascript can be extremely frustrating. (browsers’ fault) It’s an ever changing field. New things come up all the time. There are a lot of very smart people trying to solve very complicated problems. Look at Dojo, Tibco, yui-ext. It’s an exciting time for javascript fans and it’s somewhat hard to keep yourself updated.

Everything else is secondary. If you have the above skills, you can write ujs no problem, ajax apps, widgets. You’ll always get it done well and fast.

Once you have these skills the problem becomes understanding when not to write javascript :D

Comment by Diego — February 9, 2007

To all/any of you who think that you cannot make a living on Javascript alone: think again. I am making over USD170,000 and doing more than 90% Javascript at the moment. It’s possible. There are several large corporations that cannot (or will not) use the freely-available frameworks like Dojo because of license restrictions, but need that kind of reusable functionality to compete. I am working on my second such proprietary framework from scratch.
That said, being fluent and comfortable in Java, Perl, Python, etc. are critical for getting onto a large Javascript project. So are good software development and project management skills, of course.
To be honest, I would rather be using and contributing to Dojo, jQuery, GWT, prototype, YUI, etc., but I can’t turn down the money at the moment.
Your dream Javascript job is out there: go find it!
Btw, the bullet points in the original posting are spot on.

Comment by Anonymous Js Guru — February 9, 2007

Having always been a front end programmer (js/html/css) a.k.a in the group that were universally replaced with dreamweaver in the dot com bomb, it is tough. Currently I make a living but next month I could be living under a bridge. But for skills in a front end job:

1) Know the ins and outs of the browsers. JS/CSS/(X)HTML quirks. Are you the person that everybody goes to when there is any question about a browser/front-end code? Can you actually answer their questions or figure it out quickly?
2) Know how to debug #1. That involves more than just opening firebug and looking for a line number. Can you do that in IE? Can you guestimate where some obscure bug is really coming from? Can you do a manual trace of the stack call without putting in an alert on every single line (though there may be a lot of alerts involved). Can you do that in combination with HTML/CSS errors to find whether your script is failing because those are bad? Can you do that in a reasonable amount of time?
3) While you may not be programming the back-end, do you understand how it works? Can you edit the js/html/css in the back-end code without breaking it?
4) Do you understand the limitations of JS? What data do/don’t you have access to? What are the “rules” for javascript? Where can they be bent and broken? Where can things be done in JS instead of the back-end? Where should things run (front/back)? The ability to determine the source of a bug (front/back). In my experience, anything that appears as a front-end defect or that JS has any relationship to will be given to the front-end developer to debug. Even if the back-end is the root cause, the front-end gets it first to determine the source.
5) Scope, packaging, closures, scope, and scope.
6) While I don’t agree that you should know the exact sentax for every DOM manipulation method, you should fully understand how everything works (you can always look up syntax that you don’t use often, but you better know exactly what you are looking for).
7) If your primary job is front-end, you should be able to write everything from scratch by hand. If a interviewee tells me they just search the web for a script that does whatever thing they need at the time and does a plug and play, their chances for being hired – 0%. I can understand the occassional thing, like say an email validation function. I can understand generally prefering to use a library, but when push comes to shove, can you take notepad and do it all?
8) Constantly learning. Keeping up with the latest news, tricks, trends, technologies. The field is changing fast. Next week could be a new discovery that solves *some universal problem that has plagued developers for years here*. If that happens, will you know and adapt immediately or will it have to filter into your favorite library before you use it?
9) Can you talk to a designer, back end coder, information architect, or complete layman equally in their terms? Can they talk to you without your eyes glazing over? Do you understand enough about the above’s job (excluding layman) that you could almost pinch hit for them?

10) Accessibility. What is it? Why does it matter? What are the legal implications?

If you want to be (primarily) a front-end coder, expect to be a jack-of-all trades. While your main role may be to make the page look and function nicely, most likely your secondary role is going to be as an advisor to everybody else. Explaining to manager’s why you can/can’t/should/shouldn’t do X. Explaining to designers why something does/doesn’t work and repeatedly reminding them that while they can make things look great in photoshop, the reality of the browser has to be considered (no, all text should not be a graphic….. just because photoshop supports kerning etc doesn’t mean you should use it…… browser text is pretty much guaranteed to be larger than in photoshop). Talking to information architects about what functionality A that they think would be great would actually work when implemented and/or explaining alternatives, making suggestions on things that can be added and what the latest trends are. Working with back-end coders from system design and integration to testing.

Know everything about the front-end, know a little bit about everything else. Learn fast.

Comment by Bart — February 9, 2007

Good software design practices apply to any platform.

You must understand issues of software design. Patterns, modularity, resuse, etc. and standard GUI framework design patterns like Command and Observer.

In other words you should be a real programmer, not just a javascript hack who knows all the DOM methods. If all they want you for is to cascade select menu options or put some draggable boxes on the screen that’s fine. If you are building something more, then you’ll be over your head if you don’t know how to design software.

It also helps to be familiar with some of the more specific web app issues like push/polling options etc.

nmg

Comment by Nate Grover — February 9, 2007

2 more bulletpoints are needed:

1) do you know what web developer toolbar is?
2) do you know what firebug is?

Comment by blah — February 9, 2007

@Bart: You certainly seem to know what you are doing. You shouldn’t have a problem finding gigs. If you are — and you live in the greater Boston area — send me an email to john at the domain in the signature line. My company could use the help of another highly skilled UI engineer. We are completely inundated with Ajax projects and have been turning them down left and right…

Comment by John Hann — February 9, 2007

The omission of “software development skills” from this long long list, until Nate pointed it out, is why so much JS code is dead on arrival.

Do you anticipate that people who use your code will use it in an environment you didn’t expect?

Do you understand that each piece of code you write should do one thing well?

Can you write an interface that lists its assumptions, and then refrain from making lots of other assumptions that will fail?

Can you explain why anonymous functions are harder to debug than named functions?

etc.

Comment by Travis — February 9, 2007

Imagine my surprise when I saw my latest blog entry on Ajaxian.

The title I gave this piece is misleading. I didn’t mean to imply that somebody could simply follow the bullet points and as a result pay the mortgage. A better way to put this would have been ‘if JS is part of your toolset when creating rich client apps here’s what you should know’ But that doesn’t have much of ring to it…

I agree with all the comments about design patterns and knowledge of other languages etc etc. The point of the blog entry was to establish some minimum set of JS skills that a potential employer good look for to find a solid candidate. With that said – yes its just one tool in a developers toolbox.

Comment by Hans — February 9, 2007

I also think its good to have an advanced knowledge of CSS, DHTML and such. particularly where it applies to browser differences, etc.

Comment by Alexei — February 9, 2007

Thanks for the link Nicholas, would have been nice if Dion has put a link in there or at least gave credit.

Comment by Andrew Herron — February 9, 2007

Thomas: That was spot on. It’s no wonder your library is doing so well.. :)

Comment by Jesse Kuhnert — February 9, 2007

I basically write javascript for a living, keep very busy. It’s not the only thing I do but it it is 90% of it, so the contention that “nobody survives on javascript alone” is absolutely false.

Comment by JoeBoy — February 9, 2007

As someone who programmed pretty much exclusively JavaScript for about the last 6-8 months, I’ll give you my opinions of what is important.

1. DOM manipulation
2. JavaScript object types (number, boolean, object, string, Array Date, RegExp, etc), their methods and how to manipulate object structures. Prototype manipulation is useful knowledge but I wouldn’t call it necessary.
3. Event handling
4. The big thing is knowing browser compatibilities
5. Understanding of closures
6. How scope is managed
7. Keeping up the latest techniques in JavaScript will be helpful

Given that, jobs that are exclusively for JavaScript aren’t very common. At my current place of employment, we had a unique situation in that our web applications had a constraint of having to be implemented entirely in JavaScript because we needed to be operating system independent without having a dependency on Java or a server-side processor. This was a pretty big hassle as implementing a multi-browser library for file i/o manipulation in JavaScript isn’t easy and isn’t what JavaScript is really meant for.

Comment by Andy Kant — February 9, 2007

Hans, Nicholas: I added a link to the original article. Sorry we missed that the first time around!

Comment by Rob Sanheim — February 9, 2007

I’m wondering, from Anonymous JS Guru, what he means specifically by this:

“There are several large corporations that cannot (or will not) use the freely-available frameworks like Dojo because of license restrictions”

Which licensing subscriptions, specifically?

Comment by Mark — February 9, 2007

mean, Which licensing *restrictions*, specifically? (I need to get some sleep)

Comment by Mark — February 9, 2007

@Mark

There really aren’t any restrictions, most of them are pretty much free use (GPL, MIT, etc). However, there are many companies out there that have lawyers that are scared of open-source licenses and prefer to avoid them.

Comment by Andy Kant — February 9, 2007

One more: domain security. What it is, how it works, how to get around it.

Comment by scottandrew — February 9, 2007

…and Nicholas Zakas of Yahoo!
Since I visited his cube almost everyday. :-D

Comment by Hedger — February 10, 2007

Well, a good alternative is to use a case based approach: show a real life javascript front-end, (such as my http://www.fittestmodel.com), and ask any question you like such as:

* How come that the selection lists do not have z-index 100% always in IE? How would you do that?
* How to prevent repeated server requests (IE) for images when viewing the same image multiple times?
* How to force an update request to the server this time, but prevent it the other time. Take for example a tree component. Once brances are populated, and nodes are collapsed afterwards, you do not want to reload the data when the nodes are expanded again.
* How to create a counter button which can count both up and down, slower and faster depending on the mouse position on it?
* How to switch from absolute positions to relative positions and vice versa. How are those windows arranged?
* How can such an application run without xmlhttprequest?

etc, etc..

Comment by camiel — February 10, 2007

JS by itself is meaningless. You NEED to know HTML/CSS to have your JS working, so nope there is no way to do JS only for a living

Comment by noname — February 10, 2007

Well, you can do pure JS for living as I am doing right now. Beside lots other tasks in pageflakes, I write huge amount of JS everyweek to develop flakes as a development engineer. Beside that I also maintain the community, study JS in the user submitted flakes and support them to write efficient JS. If you neglect JS as a language, you are doing a big mistake. JS is extremely powerful and you can do things beyond your imagination with it.

I want to add some tips beside dion’s suggestions. You also need to do the following if you really want to live by coding JS.

1. DOM Scripting is a Must, but not all, simple Node operations will do.
2. Interacting with CSS is also a must.
3. Manipulating JSON is more important than XML becoz its much more flexible and lightweight to transfer your data as JSON object.
4. Choose some popular libraries and stick to them. Personally I suggest Prototype (Its a must), jQuery, mooTools and Scriptaculous. I dont like Dojo becoz it seems too heavier to me. (I dont agree with Dino in this issue, I suggest DRY, Dont Repeat Yourself. Why do you have to reinvent the wheel?)
5. AJAX is also a must.
6. Being able to write JS in Object Notation format (he he he, its JSON)
7. keep yourself uptodate by visiting sites which inform you what’s actually going on in this sector.
8. Be aware of browser compatibility issues (Its a must)

And Finally

9. Love JS

Comment by Hasin Hayder — February 10, 2007

@scottandrew: good one, I forgot that :)
@noname: I would never hire you for this kind of work simply because your ignorance is showing. I got my start with JS not by doing DHTML but by writing a lot of classic ASP using the JScript engine. If you don’t understand that JS != browser then in my opinion you don’t have a clear understanding of the entire HTML+CSS+JS ecosystem.
@Hasin: I disagree with you re: “Choose some popular libraries and stick with them”; even though we in the community try to help people out by evening out the bumps (as it were) you should still be able to figure out how to do some basic and intermediate tasks without relying on an external library–and note that I say this as one of the main contributors to Dojo. Regardless of the fact that a library can be tremendously helpful, you *still need to know what is doing to what and why*.
(Unless you’re talking about implementations of something like, say, SHA-256. *Then* you should use a library :)

Comment by Tom Trenka — February 10, 2007

* Be able to put your script in IE, press 10 times F5, check memory usage, cry out loud … and manage to fix that.

I am living on JS for one year now. I agree that today it is the JS/CSS/DHTML mix that will give you some job.

We should all remember it is the market needs that gives us work to do. Technology is just a way to answer these needs. I have done C++ when it was needed the most. Visual Basic at its time. Server side scripting few years ago … and Ajax-ish stuff today.

Keep in mind the code you write is meant to be used by somebody as a product … whatever the language.

Comment by Candide — February 11, 2007

Great discussion here. I’d like to add from a perspective employer’s point of view, “Give me some cool stuff, work or fun, to look at.” Provide some URLs to professional work, and even better, personal stuff you’ve done for yourself or for others, for fun. Demonstrate something nifty, experimental even, which shows your ability at all of the above things (Object-Oriented approach, DOM, memory leaks, event handling, graceful degradation / progressive enhancement / unobtrusive techniques, etc.) If I can see your code, style and approach in any light, that will help potential employers determine what you can do when working for them. My personal experience has been that having a personal site showing both professional and personal work has been invaluable in regards to looking for employment.

Comment by Scott Schiller — February 11, 2007

Whoever wants to write JavaScript for a living, must also love beer. Period.

Comment by Dustin Diaz — February 11, 2007

Life is too short, JavaScript libraries like Dojo, Prototype save my time.
Just water is ok for me.

Comment by payitforward — February 12, 2007

Gonna have to go with Dustin on this one. What’s worse is when you wake up in the morning after a beer/code binge, realize you’ve done something on the sorts of majestic, and yet have difficulty understanding it.

Comment by Andrew Herron — February 12, 2007

Leave a comment

You must be logged in to post a comment.