For one of my first assignments in ICS 314, we were tasked with doing the “Introduction to Javascript” and “ES6” modules at freecodecamp.com.org. About 132 exercises later, I finally learned that “=>” symbolizes more than just the keybind to walk right in Minecraft and that “let” is more than just a word used in math proofs. Of course, Javascript isn’t as bad as I’m making it out to be. Coming from a background in Java, Javascript feels lighter and less clunky; the following is a basic function that gives a true/false statement if a number is even using Java and Javascript (ES6) which shows the enhanced readability of Javascript:
Java:
function isItEven(int number) {
return number % 2 == 0;
}
Javascript:
const isItEven = (number) => number % 2 == 0;
It’s like Javascript decided that things like type parameters, mandatory curly braces, and even the iconic return statement were no longer worth the trouble. In terms of readability, I far prefer the arrow format in ES6 for smaller functions. Having efficient code is not just having less code, it’s about being able to follow what the function is supposed to do without overwhelming the person reading the code. To compare, the arrow function is like an expression in math. Similar to how you want to reduce an algebraic expression, the arrow function shows you exactly what it’s going to do, in a linear fashion. The way the function is laid out makes sense. Meanwhile, Java takes its time, setting safeguards like parameter types and curly braces to help you specify what code you want within it.
However, there are caveats to the arrow functions as well - from what I’ve experienced in Javascript so far, the arrow format seems to only work well for simpler functions. For bigger functions, such as simulating a real-life situation like a classroom and applying sorting algorithms, Java is more comfortable for me. Functions get increasingly complex as more and more variables, conditionals, and loops are added and consequently, the traditional formatting of Java, or even Javascript, gives you more control over the organization of the code within it.
That’s not to say that the ES6 arrow format isn’t suitable for software engineering. An important skill to learn is the ability to write code more efficiently. With this skill, even complex functions can be simplified into a few lines of code in the right hands, which makes arrow functions so powerful. However, Javascript still allows for more traditional formatting of functions, so if larger blocks of code are necessary, it’s something that is still possible in this language. Essentially, you have the best of both worlds in Javascript, which points it towards being a pretty great choice for software engineering.
Another big part of ICS 314 is our timed WODs, or Workouts of the Day, which contribute to the concept of “Athletic Software Engineering”. Based on the popular CrossFit WODs, every week we will be given some kind of coding exercise to complete in a specified amount of time. Just like a physical exercise plan, the WODs start out at an easier level but slowly ramp up in intensity. Having gone through a couple of the practice WODs so far, my first impression is that although intimidating, they are useful in helping us learn how to think under pressure and a decent way of determining if we really understand the material. Any problem with a time limit is bound to be stressful. However, I think that learning how to both think and code faster is a skill that will be necessary in a professional software engineering environment.
In the WODs that I have attempted so far, I’ve come to the realization that I’ll need to put more practice into coding more efficiently and accurately. In two of the practice WODs, I wasted at least two or more minutes getting an error and unfortunately not noticing a mistyped letter in one of my variables or even the function name itself. However, I think this is good. Having in-class and practice WODs helps me to pinpoint where I need to improve and how I can become a stronger programmer. This is a new learning style that I’ll need to adapt to, but in the long-run I do think it will be very beneficial.
Overall, my first few steps into Javascript ES6 have been eye-opening, especially with the new utility of arrow functions. Javascript seems like a flexible choice to use in software engineering, as it provides us with a concise way to lay out simple functions while still giving us a way to manage more complicated functions. On the other hand, athletic software engineering and the WODs do seem a bit stressful, but useful in shaping us to become better software engineers. Going forth into ICS 314, I am anticipating the WODs and further learning of Javascript to help me grow into a refined programmer.