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

    • nicomp profile imageAUTHOR

      nicomp really 

      6 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.

    • drbj profile image

      drbj and sherry 

      6 years ago from south Florida

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

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)