This week was still hard for me. Different from assignment 1, I finished assignment 2 part 2 1 day ahead of the deadline. I felt relieved.
Assignment 2 tortured me a lot. I doubted my answer often, since it certainly was not the most efficient way to solve the problem. For example, when generating the regex permutations, I could have limited the dots and the bars inside the parenthesis but I failed to. Then the codes I wrote took minutes to run on some input. Besides, it was hard to choose whether to merge different cases together or seperate them. Combining different cases can avoid duplicating codes, but it could make codes longer than separating the cases and it made the codes unclear.
I also had to deal with the style problem. A line that looks wonderful had to be modified due to the length. I wrote an if statement in one line and because of the last word fell to the next line, I had to rewrite this if statement in four lines, including an else case who took 2 lines. I was a little amazed by the length the code had. I doubted whether or not it would work with a shorter length.
But anyway I handed it in after learning that I didn't have to pay too much attention on efficiency for now. I sometimes blame computers why they are so stupid that they never understand my mind. But that is why I am learning computer science. And I love computers.
没有评论:
发表评论