Pomodoro clock project - feedback request

Pomodoro clock project - feedback request
0.0 0

#1

Hi everyone, I have completed a first solid working draft for my Pomodoro clock project.


(edited to link to v2)

All input would be appreciated. I’m especially looking for feedback on helping make my code functional and/or dry.

In particular, I have one function (sessionCounter) that calls itself. It works nicely in practice (I use the pomodoro clock for working), but I wonder if I am creating a stack mess with this approach. Any thoughts?

Thank you,
Ben


#2

Yeah, your sessionCounter is a recursive function (calls itself) but it doesn’t stop (infinite loop) which will eventually cause stack overflow because you run out of space.


#3

Thanks elisecode247! I was afraid of that.

Do you have any thoughts as to how to restructure sessionCounter so it doesn’t do that? Originally I had two almost duplicate functions (sessionCounter and breakCounter) and one called the other, but I guess this would be just as likely to cause stack overflow, right?


#4

the “id” variable needs to be outside the function, so that the function changes the value of the id. Right now, you’re creating a new “id” variable every 1 second.


#5

Thanks, I’ve fixed that now.