Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Not enough comments" #607 patch #608

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions patch-1-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# patch-1 Notes

This pull request be to fix issue #607.

NOTE: This file be to be removed after all commenting be done.


ANOTHER NOTE:
"<...>" be used to skip through many empty directories.
For example,
"/src/<...>/impl"
be used to direct the reader to
/src/main/java/com/seriouscompany/business/java/fizzbuzz/packagenamingpackage/impl.

Another example,
"/resources/<...>/spring.xml"
be used to direct the reader to
/resources/assets/configuration/spring/dependencyinjection/configuration/spring.xml.

## DONE!

### /test/java

- /test/java/FizzBuzzTest.java
- /test/java/TestConstants.java (!)

### /src/<...>/impl

- /src/<...>/impl/Constants.java (!)
- /src/<...>/impl/StandardFizzBuzz.java
- /src/<...>/impl/Main.java

#### /src/<...>/impl/printers

- /src/<...>/impl/printers/IntegerIntegerPrinter.java

#### /src/<...>/impl/factories

- /src/<...>/impl/factories/NoFizzNoBuzzStrategyFactory.java

#### /src/<...>/impl/strategies

- /src/<...>/impl/strategies/NoFizzNoBuzzStrategy.java

### /src/<...>/interfaces

- /src/<...>/interfaces/FizzBuzz.java

#### /src/<...>/interfaces/parameters

- /src/<...>/interfaces/parameters/FizzBuzzUpperLimitParameter.java

### /src/<...>/interfaces/printers

- /src/<...>/interfaces/printers/DataPrinter.java
- /src/<...>/interfaces/printers/StringPrinter.java
- /src/<...>/interfaces/printers/IntegerPrinter.java

## IN PROGRESS

undefined
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
// Constants.java
// Constants

// add to package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl;

/**
* Constants
*/
public class Constants {

// create constant for message if an attempt was made to divide by zero called `AN_ATTEMPT_WAS_MADE_TO_DIVIDE_BY_ZERO` which contains the string "An attempt was made to divide by zero."
public static final String AN_ATTEMPT_WAS_MADE_TO_DIVIDE_BY_ZERO = "An attempt was made to divide by zero.";
// create constant for word "Buzz" called `BUZZ`
public static final String BUZZ = "Buzz";
// create constant for name of method `com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.printers.IntegerIntegerPrinter.print` called `COM_SERIOUSCOMPANY_BUSINESS_JAVA_FIZZBUZZ_PACKAGENAMINGPACKAGE_IMPL_PRINTERS_INTEGER_INTEGER_PRINTER_PRINT` which containt the string "com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.printers.IntegerIntegerPrinter.print()"
public static final String COM_SERIOUSCOMPANY_BUSINESS_JAVA_FIZZBUZZ_PACKAGENAMINGPACKAGE_IMPL_PRINTERS_INTEGER_INTEGER_PRINTER_PRINT = "com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.printers.IntegerIntegerPrinter.print()";
// create constant for word "Fizz" called `FIZZ`
public static final String FIZZ = "Fizz";
// create constant for the line seperator called `LINE_SEPERATOR` which contains the string "line.seperator"
public static final String LINE_SEPARATOR = "line.separator";
// create constant for the name of the loop component factory called `LOOP_COMPONENT_FACTORY` which contains the string "loopComponentFactory"
public static final String LOOP_COMPONENT_FACTORY = "loopComponentFactory";
// create constant for SPRING_XML which contains the string "spring.xml"
public static final String SPRING_XML = "spring.xml";
// create constant for STANDARD_FIZZ_BUZZ which contains the string "standardFizzBuzz"
public static final String STANDARD_FIZZ_BUZZ = "standardFizzBuzz";
// create constant for message if the integers could not be compared called `THE_INTEGERS_COULD_NOT_BE_COMPARED` which contains the string "The integers could not be compared."
public static final String THE_INTEGERS_COULD_NOT_BE_COMPARED = "The integers could not be compared.";
// create constant for the default fizz buzz upper limit parameter value called `DEFAULT_FIZZ_BUZZ_UPPER_LIMIT_PARAMETER_VALUE` which contains the integer 100
public static final int DEFAULT_FIZZ_BUZZ_UPPER_LIMIT_PARAMETER_VALUE = 100;
// create constant for the integer divided by zero value called `INTEGER_DIVIDE_ZERO_VALUE` which contains the integer 0
public static final int INTEGER_DIVIDE_ZERO_VALUE = 0;
// create constant for the integer <origin?> zero value called `INTEGER_ORIGIN_ZERO_VALUE` which contains the integer 0
public static final int INTEGER_ORIGIN_ZERO_VALUE = 0;
// create constant for the <i'm getting confused>
public static final int LOOP_INC_VALUE = 1;
// create constant for the <...>
public static final int LOOP_INIT_VALUE = 1;

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
// Main.java
// Main

// add to package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl;

// imports org.springframework.context.ApplicationContext
import org.springframework.context.ApplicationContext;
// imports org.springframework.context.ConfigurableApplicationContext
import org.springframework.context.ConfigurableApplicationContext;
// imports org.springframework.context.support.ClassPathXmlApplicationContext
import org.springframework.context.support.ClassPathXmlApplicationContext;

// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.parameters.DefaultFizzBuzzUpperLimitParameter
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.parameters.DefaultFizzBuzzUpperLimitParameter;
// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz;
// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.parameters.FizzBuzzUpperLimitParameter
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.parameters.FizzBuzzUpperLimitParameter;

/**
Expand All @@ -17,11 +27,16 @@ public final class Main {
* @param args
*/
public static void main(final String[] args) {
// create a constant for the ApplicationContext called `context` that uses constant `SPRING_XML` from Constants
final ApplicationContext context = new ClassPathXmlApplicationContext(Constants.SPRING_XML);
// creates a constant using FizzBuzz called `myFizzBuzz` which accesses the constant `STANDARD_FIZZ_BUZZ` from Constants
final FizzBuzz myFizzBuzz = (FizzBuzz) context.getBean(Constants.STANDARD_FIZZ_BUZZ);
// create a constant for the FizzBuzz Upper Limit using FizzBuzzUpperLimitParameter called `fizzBuzzUpperLimit`
final FizzBuzzUpperLimitParameter fizzBuzzUpperLimit = new DefaultFizzBuzzUpperLimitParameter();
// set myFizzBuzz.fizzBuzz to the FizzBuzz Upper Limit by using the obtainUpperLimitValue method from fizzBuzz UpperLimit
myFizzBuzz.fizzBuzz(fizzBuzzUpperLimit.obtainUpperLimitValue());

// close application context
((ConfigurableApplicationContext) context).close();

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,50 @@
// StandardFizzBuzz.java
// Standard FizzBuzz

// add to package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl;

// imports org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Autowired;
// imports org.springframework.stereotype.Service
import org.springframework.stereotype.Service;

// com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.FizzBuzz;
// com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories.FizzBuzzSolutionStrategyFactory
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories.FizzBuzzSolutionStrategyFactory;
// com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.FizzBuzzSolutionStrategy
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.FizzBuzzSolutionStrategy;

/**
* Standard FizzBuzz
*/
@Service
public class StandardFizzBuzz implements FizzBuzz {


// create a private constant which uses FizzBuzzSolutionStrategyFactory called `_fizzBuzzSolutionStrategyFactory`
private final FizzBuzzSolutionStrategyFactory _fizzBuzzSolutionStrategyFactory;

/**
* @param _fizzBuzzSolutionStrategyFactory
*/
@Autowired
public StandardFizzBuzz(final FizzBuzzSolutionStrategyFactory _fizzBuzzSolutionStrategyFactory) {
// create a quick pointer `super` thing to access the accessor from the accessor method of the accessed object
super();
// initialize the attribute _fizzBuzzSolutionStrategy using param _fizzBuzzSolutionStrategy
this._fizzBuzzSolutionStrategyFactory = _fizzBuzzSolutionStrategyFactory;
}

/**
* @param nFizzBuzzUpperLimit
*/
public void fizzBuzz(final int nFizzBuzzUpperLimit) {
// create a constant which uses FizzBuzzSolutionStrategy called `mySolutionStrategy`
final FizzBuzzSolutionStrategy mySolutionStrategy =
this._fizzBuzzSolutionStrategyFactory.createFizzBuzzSolutionStrategy();
// set mySolutionStrategy to the returned value of the method `createFizzBuzzSolutionStrategy` from the class attribute `_fizzBuzzSolutionStrategyFactory`
this._fizzBuzzSolutionStrategyFactory.createFizzBuzzSolutionStrategy();
// use the method runSolution with argument of parameter of nFizzBuzzUpperLimit from mySolutionStrategy
mySolutionStrategy.runSolution(nFizzBuzzUpperLimit);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
// NoFizzNoBuzzStrategyFactory.java
// Factory for NoFizzNoBuzzStrategy

// add to package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.factories
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.factories;

// imports org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Autowired;
// imports org.springframework.stereotype.Service
import org.springframework.stereotype.Service;

// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.strategies.NoFizzNoBuzzStrategy
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.strategies.NoFizzNoBuzzStrategy;
// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories.IsEvenlyDivisibleStrategyFactory
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories.IsEvenlyDivisibleStrategyFactory;
// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.IsEvenlyDivisibleStrategy
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.IsEvenlyDivisibleStrategy;

/**
Expand All @@ -13,15 +22,18 @@
@Service
public class NoFizzNoBuzzStrategyFactory implements
IsEvenlyDivisibleStrategyFactory {


// creates private constant called `_noFizzNoBuzzStrategy` which uses `NoFizzNoBuzzStrategy`
private final NoFizzNoBuzzStrategy _noFizzNoBuzzStrategy;

/**
* @param _noFizzNoBuzzStrategy NoFizzNoBuzzStrategy
*/
@Autowired
public NoFizzNoBuzzStrategyFactory(final NoFizzNoBuzzStrategy _noFizzNoBuzzStrategy) {
// create a quick pointer `super` thing to access the accessor from the accessor method of the accessed object
super();
// set attribute `_noFizzNoBuzzStrategy` to constant paraneter `_noFizzNozBuzzStrategy`
this._noFizzNoBuzzStrategy = _noFizzNoBuzzStrategy;
}

Expand All @@ -30,6 +42,7 @@ public NoFizzNoBuzzStrategyFactory(final NoFizzNoBuzzStrategy _noFizzNoBuzzStrat
*/
@Override
public IsEvenlyDivisibleStrategy createIsEvenlyDivisibleStrategy() {
// return the attribute `_noFizzNoBuzzStrategy`
return this._noFizzNoBuzzStrategy;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
// IntegerIntegerPrinter.java
// Printer for IntegerInteger

// add to package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.printers
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.printers;

// imports org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Autowired;
// imports org.springframework.stereotype.Service
import org.springframework.stereotype.Service;

// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.factories.IntegerIntegerStringReturnerFactory
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.factories.IntegerIntegerStringReturnerFactory;
// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.factories.SystemOutFizzBuzzOutputStrategyFactory
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.factories.SystemOutFizzBuzzOutputStrategyFactory;
// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.strategies.adapters.FizzBuzzOutputStrategyToFizzBuzzExceptionSafeOutputStrategyAdapter
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.strategies.adapters.FizzBuzzOutputStrategyToFizzBuzzExceptionSafeOutputStrategyAdapter;
// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.printers.IntegerPrinter
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.printers.IntegerPrinter;
// imports com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.stringreturners.IntegerStringReturner
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.stringreturners.IntegerStringReturner;

/**
Expand All @@ -15,33 +26,42 @@
@Service
public class IntegerIntegerPrinter implements IntegerPrinter {

// create instance of factory called SystemOutFizzBuzzOutputStrategyFactory called `_systemOutFizzBuzzOutputStrategyFactory`
private final SystemOutFizzBuzzOutputStrategyFactory _systemOutFizzBuzzOutputStrategyFactory;

// create instance of factory called IntegerIntegerStringReturnerFactory called `_integerIntegerStringReturnerFactory`
private final IntegerIntegerStringReturnerFactory _integerIntegerStringReturnerFactory;

/**
* @param _integerIntegerStringReturnerFactory IntegerIntegerStringReturnerFactory
* @param _systemOutFizzBuzzOutputStrategyFactory SystemOutFizzBuzzOutputStrategyFactory
*/
@Autowired
public IntegerIntegerPrinter(final IntegerIntegerStringReturnerFactory _integerIntegerStringReturnerFactory,
public IntegerIntegerPrinter(final IntegerIntegerStringReturnerFactory _integerIntegerStringReturnerFactory, // create constructor for IntegerIntegerPrinter
final SystemOutFizzBuzzOutputStrategyFactory _systemOutFizzBuzzOutputStrategyFactory) {
// create a quick pointer `super` thing to access the accessor from the accessor method of the accessed object
super();
// sets the attribute `_integerIntegerStringReturnerFactory` to the value of the parameter called `_integerIntegerStringReturnerFactory`
this._integerIntegerStringReturnerFactory = _integerIntegerStringReturnerFactory;
// sets the attribute `_systemOutFizzBuzzOutputStrategyFactory` to the value of the parameter called `_systemOutFizzBuzzOutputStrategyFactory`
this._systemOutFizzBuzzOutputStrategyFactory = _systemOutFizzBuzzOutputStrategyFactory;
}

/**
* @param theInteger
*/
public void printInteger(final int theInteger) {
// create a constant called `myIntegerStringReturner` using `IntegerStringReturner` which takes the value of the returned value of the method `createIntegerStringReturner` of attribute `_integerIntegerStringReturnerFactory`
final IntegerStringReturner myIntegerStringReturner =
this._integerIntegerStringReturnerFactory.createIntegerStringReturner();
// create constant called `myIntegerString` of type String which takes the value of the returned value of the method `getIntegerReturnString` from `myIntegerStringReturner`. `getIntegerReturnString` from `myIntegerStringReturner` is passed the parameter `theInteger`
final String myIntegerString = myIntegerStringReturner.getIntegerReturnString(theInteger);
// create a new `FizzBuzzOutputStrategyToFizzBuzzExceptionSafeOutputStrategyAdapter` constant called `myOutputAdapter` which is passed the value of the return value of the method `createOutputStrategy` from attribute `_systemOutFizzBuzzOutputStrategyFactory`
final FizzBuzzOutputStrategyToFizzBuzzExceptionSafeOutputStrategyAdapter myOutputAdapter =
new FizzBuzzOutputStrategyToFizzBuzzExceptionSafeOutputStrategyAdapter(
this._systemOutFizzBuzzOutputStrategyFactory.createOutputStrategy());

// call method `output` from `FizzBuzzOutputStrategyToFizzBuzzExceptionSafeOutputStrategyAdapter` called `myOutputAdapter` and pass the method `myIntegerString`
myOutputAdapter.output(myIntegerString);
}

Expand All @@ -50,6 +70,7 @@ public void printInteger(final int theInteger) {
*/
@Override
public void print() {
// throw an exception of type `UnsupportedOperationException` which takes the constant defined in `com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Constants` called `COM_SERIOUSCOMPANY_BUSINESS_JAVA_FIZZBUZZ_PACKAGENAMINGPACKAGE_IMPL_PRINTERS_INTEGER_INTEGER_PRINTER_PRINT` which contains the string "com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.printers.IntegerIntegerPrinter.print()"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments can be very long

throw new UnsupportedOperationException(
com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Constants.COM_SERIOUSCOMPANY_BUSINESS_JAVA_FIZZBUZZ_PACKAGENAMINGPACKAGE_IMPL_PRINTERS_INTEGER_INTEGER_PRINTER_PRINT);
}
Expand All @@ -59,6 +80,7 @@ public void print() {
*/
@Override
public void printValue(final Object value) {
// call method `printInteger` and pass argument parameter constant `value` of type `Object`
this.printInteger((Integer) value);
}

Expand Down
Loading