Introduction
Recursive function is my most favorite game as a software developer starting from 8/28/2017 10:00 pm. I think that I reach the threshold of number of failures, and then today I had great experience to write a recursive function.
Algorithm practice
My last practice is documented here, and the C# code is here.
Highlights of issues:
1. How to handle edge case?
case 1: "a.b.c", last key should not be followed by the dot char
case 2: if the key is empty string, then dot char should be skipped.
line 36: design of variable newPrefix, first writing is newPrefix = key + ".". The design has flaw, if the key is the last one, the dot char should not be concatenated.
It is 11:50 pm. I turned on the computer and then added some notes about the compile errors in my writing. Write down the compile error, and then work on type issue, in the next practice, I should not write any code on this algorithm with type compiler errors. I am really tired and sleepy.
The corrections are in three places:
1. Line 38, add Dictionary<string, object>
2. Line 45, add (string)
The advice I got from the peer:
1. Move static variable into the function, line 9;
2. Empty key should not be concatenated by dot char '.' by observing the last test case.
Actionable Item
It is very important skills to learn how to work with various levels of software programmer, I decide to reserve 10:00 pm as my mocking interview time every day. I believe that 10:00 pm is hard choice, too late and it takes extra work to get focus. It will be good choice to simulate tough situations in the work place.
Bible verse encourages me to work hard, specially when I am tired.
No comments:
Post a Comment