ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

5 Reasons not to Learn JavaScript as Your First Programming Language

Updated on June 7, 2012

0. Javascript builds very bad programming habits

A new programmer needs a rigorous language and development environment that provides immediate feedback for syntax errors and potential logic errors. Javascript is typically developed in a simple text editor such as Notepad or TextPad, which provides no programming support whatsoever. Some tutorial web sites allow students to type their Javascript into a text box on a web page. This strategy is deceptively convenient in the short-term but teaches new programmers nothing about proper style, program layout, or documentation.

Beginning Javascript programmers learn very few good habits and horrifyingly bad habits:

  • They are not encouraged to build in program documentation as they write their code (see JavaDocs, etc.),
  • They are not provided with sufficient syntax checking during code editing (see Eclipse, NetBeans, Visual Studio),
  • They are required to launch a web browser to execute their code, and
  • They have precious little debugging support, if any.

Another significant problem with Javascript sample code is the appalling lack of comments. Since Javascript code is downloaded to the web browser in source code form, programmers tend to skimp on comments because they are unwilling to explain to the entire world what what their code is doing. This trend causes a snowball effect: new programmers see this type of code and assume that everyone writes that way across all programming languages.

1. It's interpreted

An interpreted language is executed from the original source code rather than being compiled. The compilation step creates an intermediate language (as in Java and .Net) or a binary file targeted at a specific processor. The compilation step catches syntax errors early in the software development process. In Javascript, syntax errors are eventually caught, but at run-time. This strategy requires that every code path be executed in order to identify every possible syntax error. A neophyte programmer does not have the skill to perform such testing. Beginning programmers are also frustrated by syntax errors that interrupt the execution of their code, especially when they learn that many other languages offer a much more efficient alternative.

Javascript runtime errors are also cryptic. Beginning programmers become frustrated quickly when diagnostics cannot be decoded.

2. It's loosely typed

A loosely typed programming language makes broad assumptions regarding data types when evaluating expressions. The assumptions are deterministic, but javascript makes these decisions at run-time, meaning that many data conversion problems go unnoticed unless testing is extremely thorough. Data conversion assumptions very often cause subtle logic problems that frustrate all programmers: beginning programmers pay a heavy price for learning Javascript as their first language.

3. Variables do not need to be declared

Declaring a variable (name, type, scope) in a computer program provides a level of strictness and specificity that benefits programmers. A beginning programmer may enjoy the freedom of using variables ad hoc without adding declaration statements, but the Javascript interpreter is left with the task of determining how to perform data type conversions (see point #2, above) rather than the programmer.

Another huge roadblock to new programmers learning Javascript as their first language is the hazard of simple typographical errors. Mistyping the name of a variable used in an expression simply causes the Javascript interpreter to create a new variable with the new name. A strongly typed language, or at least a language requiring variables to be declared prior to first use, would catch these errors. Experience programmers understand the value of diagnostic feedback from their development tools. The old saying 'no new is good news' does not apply to software engineering.

4. There are too many versions

Javascript runs on the client side of web applications, meaning that is is downloaded to the web browser on the user's computer and executed inside the browser. Each web browser manufacturer is free to implement their own version of the language. Although mainstream browsers are fairly consistent in their implementations, they are not all the same. There are many browser versions within the same manufacturer that need to be supported by a Javascript program. A beginning programmer who copies and pastes code snippets from even the most reputable programming web sites is susceptible to subtle version issues that can be extremely frustrating.

5. Objects are Ignored

OOP, Object Oriented Programming, is the current paradigm for the vast majority of software development. it is possible to study Javascript and almost completely ignore crucial aspects of OOP. Entry-level programmers learning Javascript as their first language should have early exposure to classes, objects, inheritance, polymorphism, encapsulation, and data hiding. Certainly they do not need to be assigned these concepts on their first day of programming, but it is possible to almost completely ignore them while learning Javascript.

Comments

    0 of 8192 characters used
    Post Comment

    • drbj profile image

      drbj and sherry 4 years ago from south Florida

      Be vigilant, nicomp. Javascript may not take this lying down.

    • nicomp profile image
      Author

      nicomp really 4 years ago from Ohio, USA

      @drbj: Javascript will have to get in line: the Horsey race people and the NASCAR people are still after me.

    Click to Rate This Article