Why All Developers Do Not Make Good JavaScript Developers
In my job, I’m always asked to review and make recommendations regarding the code in the company’s User Interface space. While this is generally a fun and exciting process, it sometimes just proves the difference between developers that know a language and those that can get by during a coding effort. This is where I believe large corporations usually fall short when defining roles for people to employ.
Whether the developer work in the .NET, Java, C++, C# or another application development space, most resumes that have web development experience at least mention the use of JavaScript, HTML and even, in some situations, CSS. To an interviewer that isn’t necessarily a strong developer in the languages they are hiring for, this looks like a dream come true; finally, someone that can develop the application from all aspects of it. MVC at it’s finest! But there is commonly one thing that most people ignore or forget, especially with contractor firms and that is that resumes are bloated with information even if the user has only done something as simple as read and debug a piece of code that wasn’t working well.
Of course, this situation occurs all the time without anyone to being the wiser in most situations. Corporations do not generally have individuals with advanced knowledge in languages other than the main server language they are employing. In fact, code reviews for these pieces of code are usually done by a development lead with around the same knowledge of these front-end languages so items get missed. But what items do you ask?
Let’s take for example some code I recently reviewed. Within this code is a simple timer when a user is logged into their account that will notify them shortly before the session actually expires to remind the user that they are logged in. Sounds simple enough; a timer and a message to the user to remind them, but how could the implementation go wrong? Well, let’s start by looking at the code.
1 2 3 4 5 6 7 | var interval;var timer;var lengthToWait; function startTimer() { if (timer) { clearTimer(timer); } timer = setTimer("someFunction();",lengthToWait*60*1000);} |
Looks fine, but can you see the innate problem with this code? We have globally exposed variables that are generically named. The developer, while working on this specific code made sure that it worked specifically for the needs of this code itself, but what about all of the other code the site could possibly run during a user’s visit? What are the chances that another developer decided to use the same variables? If there are a lot of developers working on this code base, a pretty good chance. And finding the issue could be a daunting task given that the problem most likely would not be found until the regression testing suite that covers this piece of code and then, it’s doubtful that the tie would be made quickly, if at all, that the issue is with the variable naming in the global space.
So, what can one do to keep this from happening? Well, two items come to mind. The first, what a developer that knows enough of the JavaScript language to be dangerous would do, and the more appropriate way, which, ironically, would be the way the developer would fix the issue if they ran into it in their server language.
The first is not optimal, by far, but is the one most easily employed by our weekend JavaScript developer. It gets the job completed and everyone is happy until the next incident during another effort sometime in the future. The second approach takes a little more skill in the language, but it keeps the variables needed wrapped in an object that is only used within itself.
So, how do we get the best coding practices put in force? Hiring a group of User Interface developers would be the easiest solution. A team of developers that work daily in the languages used in this tier of the application space. Unfortunately, even though most companies need developers with these specific knowledge sets, it’s cheaper and faster to simply hire someone that knows enough to get the job done.
To close, I’ll leave you with this. You wouldn’t hire someone to build your house that has only tinkered with a hammer and nails, would you?
Agreed. Although there is definitely something to be said of a poly-skilled development team. I putting a team of specialists together and committing to keeping them together for a year or more, would be the best way to develop that poly-skilling WHILE keeping subject matter experts on the team to address more difficult problems (Timers in JS are NEVER simple).
Great post.
@Mike Busch
Yeah, the example was extremely simplified, but the concepts is pretty solid. There is a ton of JavaScript out in the web today that uses generically named variables that make sense in the context of what the developer was working to accomplish, but did not take into account what it would do with something else that could be added to the site.
I agree with the logic, a barley knowledgeable developer will obviously think myopically about getting the job done. Throw in the fact the developer is a hired gun and will be let go after the code is complete and you have the makings of “The Perfect Code Storm”.
What the problem stems from is that entities that develop a programming language and the institutions that gain profit from teaching it, focus purely on the fundamentals. Even higher educational systems are only in the game to teach the concepts of programming and not best practices.
“Which is the way he wants it. Well he gets it.”
I agree with the logic, a barley knowledgeable developer will obviously think myopically about getting the job done. Throw in the fact the developer is a hired gun and will be let go after the code is complete and you have the makings of “The Perfect Code Storm”.
What the problem stems from is that entities that develop a programming language and the institutions that gain profit from teaching it, focus purely on the fundamentals. Even higher educational systems are only in the game to teach the concepts of programming and not best practices.
“Which is the way he wants it. Well he gets it.”
the useful content u presented do help our team’s research for my company, appreaciate that.
- Lucas