dgquvn / repo

1 stars 1 forks source link

FizzBuzz_generic_v1.cpp should be refactored into multiple classes #3

Closed jayjaybillings closed 7 years ago

jayjaybillings commented 7 years ago

Right now FizzBuzz_generic_v1.cpp solves the generic FizzBuzz problem, but it would benefit from being written in an Object-Oriented way. For example, there are several obvious classes:

See @cruziken's example for reference.

jayjaybillings commented 7 years ago

When you do this, be sure that you don't put "using namespace std;" in any header files. It is OK to use this in main or an implementation (.cpp) file, but in headers using a namespace is discouraged.

(N.B. - I still make this mistake all the time when I write a header file!)

jayjaybillings commented 7 years ago

@dgquvn I noticed that the FizzBuzz branch does most of this renaming. However, the names are not ideal. For example, it is generally bad practice to name a class generate_output. That is a great name for a function, but you would name the class OutputGenerator. Likewise, writing_to_file would be FileWriter.