Thursday, November 30, 2017

JavaScript: Introduction

William Nguyen

JavaScript: The Good Parts, Douglas Crockford

Programming can often be seen as extremely difficult and time consuming to learn. This is not always the case, as it can easily be learned by anyone who simply devotes their time and effort. Learning a computer language can be extremely beneficial for those who are interested in a path down the quickly-growing technology field, as the pay and demand for experienced programmers are extremely high.

There are a vast amount of programming languages that are available to learners, each with their own purpose, such as C++, C#, Python, etc. However, I will be focusing on JavaScript, one of the most demanded languages in the job industry.

What exactly is JavaScript? JavaScript is the primary language that web browsers use, making it one of the most popular programming languages in the world (Crockford 2). This means it can be used to create web interactive elements such as text, or create complex applications and programs. In my practice to eventually master the language, I have chosen to create a simple program that responds with text based on whether a given statement is true or false. To create this program, I first need to obtain a console, which is a text-only interface that runs computer languages. Luckily, there are a multitude of consoles readily available on the internet, some with helpful guides, which I found out about when I started to learn how to program.
SoloLearn, the console I am using


After I found my console, I started to play with some of the code and test some different functions, seeing how JavaScript worked. As it turned out, many of my statements had mistakes, making it impossible for them to execute properly.  I found that it is necessary and extremely important to have good syntax when programming if you want your code to function. From this, I realized that I was essentially "speaking to the computer", and similarly to real life situations, if you do not communicate clearly, the person will not be able to do the job properly.


Syntax errors in red

 
The correct output

I made a significant amount of mistakes, but even the smallest error can make a huge impact on the how the code runs. In addition, errors can cost us large amounts of time to fix. "The sooner we can detect and repair errors, the less they cost us. JavaScript is a loosely typed language..." (Crockford 3). This means that JavaScript's software is unforgiving when it comes to mistakes, and this shows that in order to not waste precious time finding/fixing mistakes, we need to construct code accurately the first time. I noticed that I was constantly making mistakes by overlooking the minuscule details. After realizing what I was doing wrong, I was able to change the way I wrote code. Instead of typing and moving onto the next line without looking back, I made sure to double-check my work for syntax errors. This was extremely effective, as it became a helpful habit.


Code working properly!
Close-up of edited code

Practicing to master my new technique took quite a bit of trial and error, but as a result, my code was working much more often!




Question: Have you ever tried or thought about starting to learn how to code? If so, what are your thoughts on the learning process, and if not, what is your opinion on  starting to learn something                                                                  completely new?  


Works Cited:
Crockford, Douglas. JavaScript: The Good Parts. O'Reilly Media, Inc., 2008.




6 comments:

  1. I really liked how you showed the process of initially being having many errors and then learning to correct them. I think it really helps emphasize the importance of paying attention and perseverance when programming. I've been programming in Java for many years now as well as scripting in HTML, JavaScript and CSS, but recently I've also been trying to learn C++. Learning programming can be a difficult process and I remember when I first started I couldn't figure out why things didn't work and it took some time to realize that syntax is extremely important. However, even though I know other languages, learning C++ is difficult as it has new things and new syntax that I don't know. You really have to be able to persevere and think outside the box in order to write code effectively.

    ReplyDelete
    Replies
    1. Hi Josh, thank you for taking the time to give some feedback! I am extremely new to programming, and I am also going through the confusing state you were in at my stage in coding. I definitely agree that perseverance and dedication can be a big part in learning something new. Since you have gone through many years of coding with experience, how have you motivated yourself to keep going?

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Good post William! Although I personally haven't learned JS, I have learned CSS and HTML in my Web Design class. Being the most basic of code languages, those two weren't too hard to learn though I'm sure JS is a bit more complex. I am taking Web Design 2 next semester though, so your post helped me grasp a great idea of what we will be learning! Thanks!

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  4. I'd also like to know, how much do you enjoy coding?

    ReplyDelete