I recently read the book clean code by Robert C. Martin and I'm trying to apply his style of writing methods to the FizzBuzz programming example.
So far I have two "public" methods called:
parseNumber, that respectively start the FizzBuzz program or parse a single number according to the FizzBuzz principle.
class FizzBuzz(object): def start(self, end_number): return ",".join(self._parse_numbers(end_number)) def _parse_numbers(self, end_number): number_list =  for number in range(1, end_number+1): number_list.append(self.parse_number(number)) return number_list def parse_number(self, number): if self._is_number_divisible_by_five_and_three(number): return "FizzBuzz" elif self._is_number_divisible_by_three(number): return "Fizz" elif self._is_number_divisible_by_five(number): return "Buzz" else: return str(number) def _is_number_divisible_by_five_and_three(self, number): return number % 15 == 0 def _is_number_divisible_by_three(self, number): return number % 3 == 0 def _is_number_divisible_by_five(self, number): return number % 5 == 0
I'm happy with the last 3 methods that are clearly doing one thing. But the
parse_number methods can be improved, I just don't know how to do that.