Joshua's Perspective on Typescript and WODs

05 Sep 2024

Background

Typescript/Javascript will be the fourth language I am being exposed to right after C, C++, and Python. Being that I am studying Computer Engineering, the past two years have really been focused around mostly on the use of C for our assignments and a decent amount of C++ during my second year. The only time I used Python would be for my EE 160 which was my “Intro to Programming for Engineers”. Before taking this class I don’t even believe I looked at Javascript/Typescript code, however, I heard lots of good things about it so I was eager to learn to use it in this class. But now that I have started to learn the language, what do I think about it?

How I like using Typescript

When going through the tutorials, it made me realize that all of these languages are fairly similar in a sense. The two biggest things I noticed about Typescript were that the language was fairly simple, just like Python, and that the main thing I had to remember was the use of syntax such as “let” and assigning types using semicolons. Though I find it intriguing that there is no use of types within Javascript, I felt that for me personally, the types in which we can use for Typescript are very helpful. It’s helpful to keep track of what needs to be put in as variables, and what is to be expected to be spit out, overall adding a sense of organization and predictability to the language. I also really liked that the language can kind of use context clues within our code to implicitly define the types without us having to explicitly do it. Once again this programming language reminds me a lot of Python and I appreciate the organization and simplicity of Typescript. It was through practice and doing the WODs that these things became more apparent to me.

WOD

I want to transition this essay into talking about our “Workout of the Day”, or WOD for short. As of right now, we have done 2 practice ones at home, 1 practice group one in class, and we had our first actual one today. The two practice ones at home were not too bad. The very first one, “projectEulerOne” was fairly simplistic where I approached it by using a for loop and an if and if else statement. I was able to complete this one within the Rx range. While typing this one out I felt that it was pretty similar to the other languages that I have been coding in with the exception of the use of “let”. You can refer to Figure 1 below for a snapshot of my “projectEurlerOne” code. Then in class, on the day of the practice group WOD, I ended up coming late. However, I started working on it right away but unlike the other groups, I didn’t have a partner. Luckily enough it wasn’t too bad. This was the temperature conversion one where we either converted it from Fahrenheit to Celcius or flipped it. The thing that stuck out to me about this one was the use of assigning the type of variable we wanted to use and how to assign it using semicolons. I felt that this one was good practice for that and understanding we can also define the type of return value we want back. Figure 2 below contains a snapshot of my code. For the second practice WOD I took it 3 times. For the first one I used a double for loop to check each letter within the word, I completed it but got in the Sd section. On the second attempt, I used the same method but did it a lot faster and landed in the Rx. The only thing I was skeptical about at first was being able to traverse the string as if it were an array, turns out you can! Lastly, after watching the video, I decided to try it the way the professor did and got in the Rx. That was my first time implementing a map, “.get”, and “.set”. These code segments can be seen in Figures 3, 4, & 5 shown below. It was good practice! Lastly, for the actual WOD today I found it fairly easy and just used an if, multiple if else statements, and an else statement. I then concatenated the results in the return as a string. This can be seen in Figures 6 & 7.

Figures 1 & 2: On the left is my code for the first practice WOD and on the right is my code for the practice “group” WOD

Figures 3, 4, & 5: The three are images of my attempts for the second practice WOD respectively

LEAVE BLANK FOR NOW JUST IN CASE Figures 6 & 7: Show my code for our first actual WOD

The practice I got in using the practice WODs at home did help me. Going through the Typescript tutorial was good but I didn’t completely understand things until I put the actual work in and implemented it myself. I think the WODs did exactly that for me. I notice that I actually kind of enjoy pressure situations and the goal of beating something(trying to get into the Rx time frame); I feel that it turns a certain part of my brain on. That being said, so far I do like this style of learning. The timer adds the pressure and makes it more fun for me while still getting the reps in. I also feel that it’s good to repetitiously practice as you said in class. Though it is only the first couple of weeks, I do feel that these WODs will be a key component for learning the language.

Conclusion

Overall, my experience with Typescript has been very positive. I enjoy the simplicity, organization, and awareness of this language. While I still have a lot to learn, I believe that the WODs are a great tool for me to really beat these concepts and practices into my brain. I can see myself really enjoying using this language. I am very excited about what is in store for this class and what we will be learning to implement.