When you show the code before pulling out the impact function perhaps it would be nice to point out the only difference between them is the operation done that Math.floor is applied to. Took me forever to realize they weren't the same as the rest of the code is identical. Other than that great easy to follow explanation!
I'm PhD. in Computer Science from Málaga, Spain. Currently, I am teaching developers and degree/master computer science how to be experts in web technologies and computer science.
Sorry for you time finding the difference in the codes. In fact, the template method is used only when there are small differences (or steps) in your algorithm. So, I though that a good example could be an algorithm of three steps in which two steps was common and one was difference.
Thanks for your comments ;-)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
When you show the code before pulling out the impact function perhaps it would be nice to point out the only difference between them is the operation done that Math.floor is applied to. Took me forever to realize they weren't the same as the rest of the code is identical. Other than that great easy to follow explanation!
Hi Scott!
Sorry for you time finding the difference in the codes. In fact, the template method is used only when there are small differences (or steps) in your algorithm. So, I though that a good example could be an algorithm of three steps in which two steps was common and one was difference.
Thanks for your comments ;-)