CS373 Spring 2021: Blog 3

What did you do this past week?

This week, I finally start working on the first project. I first got my GitLab ready, forking the repo, cloning to my local machine and exercising pulling and pushing changes to my forked repo. Then, I followed the guidance from the project website. Firstly, I corrected the given test cases. Then, I used the two optimization techniques we talked during class to try to speed up my program. However, it still failed the last test case, which I think I will fix during the weekend.

What’s in your way?

Since I’m new to GitLab, I have no idea about it, especially the “issue” feature of GitLab. Initially, I was confused about what the “issue” is and how I can use it. After reading some articles about it, I now have some thought about it. And I hope it will become smoother as the project goes.

What will you do next week?

Like I mentioned, I will try to fix my code to pass all the test cases in Hackerrank this weekend. So, I will use some time from my next week to finish up this project. Also, as the first project is about to ending, I will start thinking about the group and the group projects.

If you read it, what did you think of the Continuous Integration?

Not yet. I’m planing to read in on Sunday!

What was your experience of Collatz?

Personally speaking, I think this problem is super interesting and challenging. Because, I can come up with a naive solution at the first glance. However, there are a lot of ways to optimize my code. For example, I can reduce the range of the max_length need to be computed under some situation. Also, I can use a cache to memorize the values already computed which will speed up the program. The optimization makes Collatz interesting as well as challenging.

What was your experience of exceptions?

Typically, exceptions are not what I want. It’s frustrating to see some exceptions in my code, like array index out of bound. However, sometimes I found they are super useful, as they can provide a way for the communication between functions. For example, once I tried to decide if a string can be parsed as double or int. A simply way I came up with was to try convert it to int first. Then, if there was exception, I handled that exception and convert it to double instead.

What made you happy this week?

I got all my quiz questions right!

What’s your pick-of-the-week or tip-of-the-week?

I personally think Pycharm is a great IDE for Python program. It is able to auto-fill your code and some useful suggestions about the style of the program you’re writing. The best thing about it is Pycharm can format your code by just one click. Because indentation is super important in Python. I encountered a lot of trouble with the indentation, especially the mix use of space and tabs. However, all of these can be solved by Pycharm by just one click. And the Pycharm will format the code based on the PEP8 which is a very official document about Python style.