Skip to content

Classic FizzBuzz exercise implemented in a Pure Object-Oriented Style

License

Notifications You must be signed in to change notification settings

SilasReinagel/PureOOFizzBuzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PureOOFizzBuzz

Build Status License

This project was inspired by Elegant Objects by Yegor Bugayenko

PureOOFizzBuzz is a true object-oriented and immutable Java8 demo. Its key benefits, comparing to all others, include these seven fundamental principles:

  1. not a single null (why NULL is bad?)
  2. not a single public static method (why they are bad?)
  3. not a single mutable class (why they are bad?)
  4. not a single instanceof keyword, type casting, or reflection (why?)
  5. not a single getter or setter (why?)
  6. not a single new outside of secondary constructors
  7. not a single Java primitive

Usage

FizzBuzz values cannot be accessed directly. Instead they can be printed to any Media.

You can implement Media however you like.

####Print to Collection Usage

TextCollection media = new TextCollection();
new FizzBuzz(100).print(media);
Collection<String> stringValues = media.strings();

####Print Range to Collection Usage

TextCollection media = new TextCollection();
new FizzBuzz(15, 50).print(media);
Collection<String> stringValues = media.strings();

####Print to Console Usage

new FizzBuzz(100).print(new SystemConsole());

Credits

Silas Reinagel

License

You may use this code in part or in full however you wish.
No credit or attachments are required.

About

Classic FizzBuzz exercise implemented in a Pure Object-Oriented Style

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages