https://github.com/alvarogarcia7/kata-formulation-copy-program
https://github.com/alvarogarcia7/kata-formulation-copy-program
dip fake kata kata-boilerplate kata-formulation mock solid-principles stub
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alvarogarcia7/kata-formulation-copy-program
- Owner: alvarogarcia7
- Created: 2017-05-29T13:18:17.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-29T17:38:44.000Z (about 9 years ago)
- Last Synced: 2025-08-11T21:34:42.798Z (10 months ago)
- Topics: dip, fake, kata, kata-boilerplate, kata-formulation, mock, solid-principles, stub
- Size: 29.3 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kata Formulation: Copy Program
## Description
> Consider a simple program that is charged
> with the task of copying characters typed on a keyboard to a printer. Assume, furthermore,
> that the implementation platform does not have an operating system that supports device
> independence. We might conceive of a structure for this:
> 
> Figure [above] is a "structure chart". It shows that there are three modules, or subprograms,
> in the application. The "Copy" module calls the other two. One can easily imagine a loop
> within the "Copy" module. The body of that loop calls the "Read Keyboard" module to fetch
> a character from the keyboard, it then sends that character to the "Write Printer" module
> which prints the character.
> extracted from [The Dependency Inversion Principle](https://drive.google.com/file/d/0BwhCYaYDn8EgMjdlMWIzNGUtZTQ0NC00ZjQ5LTkwYzQtZjRhMDRlNTQ3ZGMz/view), by Robert C. Martin
## Problem
Your task, should you accept it, is to write a program that performs the above-descripted
action.
Bear in mind that we are not sure where to 'read' from. Neither where we want to write to.
These are the APIs we want to have:
```java
class ReadKeyboard {
public boolean hasNext();
public String get();
}
```
```java
class WritePrinter {
public void print(String message);
}
```