Skip to content

clean-code-craft-tcq-7/modular-colorcoder-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Topic: Modularity

Divide into files

Summary:

The 25-pair color code, is used to identify wires in telecommunications cables. Different codes are used for wire leads on devices such as transformers or in building wiring. For more details refer to This Wiki.

There are 25 possible pairs of colors.

  • Each pair of colors maps to a corresponding number
  • Such numbers translate to a pair of colors - a major color and a minor color

Exercise Details:

Modularity

The entire translation program is in a single file. Before adding features and making it bigger, split the file. This exercise has a limit on the loc (lines of code) per file. See the workflow for details.

Duplication

The index-conversion code in MajorColor is almost identical to the one in MinorColor. Resolve the duplication.

New Feature Request

The color coding needs to be printed as a reference manual for wiring personnel. This manual is a mapping from the color-names to the corresponding numbers. Add a function that would format the color coding in a form that someone can print.

Try writing strong tests for this new reporting feature. Examine if strong asserts force you to make re-usable functions.

More Feature Requests

This is getting popular! Customers are asking to add a feature to generate the report in csv form. How much of the existing code can you re-use? Can you add code for this csv feature without changing existing code?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages