Skip to content
/ FizzBuzz Public

Starting from a bad implementation, making small incremental improvements.

License

Notifications You must be signed in to change notification settings

ktzr/FizzBuzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FizzBuzz

It's a famous programming challenge/question.

We have all given it a go at least once in our life. You might even have been asked it in an interview.

I'm starting from the worst implementation I can think of and making small changes to improve it, set by step.

See the code in fizzbuzz.py

What Is FizzBuzz

It's a game made to teach children about, and practice division.

You sit in a circle and incrementally count from 1 to 100, you say a number then the person next to you says the next number.

But

  • If a number is divisible by 3 you say Fizz
  • If a number is divisible by 5 you say Buzz
  • If a number is divisible by both 3 and 5 you say FizzBuzz

Why Did You Write This?

To be honest im not 100% sure.

I started because I want to see how many FizzBuzz implementations I could come up with but realised most implementations follow the same principals or are slight improvements on each other.

I thought, "Why not structure it as a tutorial, maybe someone will find it useful?". So I did.

The Implementations Get More Complex as I Go Down.

Yes, in general they get more complex. This however does not mean they are better. My modifications get a bit ridiculous near the end, I'm a firm believer of YAGNI - things must only be implemented when they are needed, not when you think that you might need them in the future.

Implementing things just because you think you are going to need them will result in a massive waste of time, 90% of the time you aren't going to use it and it just bloats your code. Wait until you need it then implement it!

I Want More FizzBuzz

About

Starting from a bad implementation, making small incremental improvements.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages