We are building a product that will be used in poetry classes. We target a poetry of a form called as cumulative poetry. The functionality is broken down into releases and its recommended that you approach the problem incrementally.
Business needs
Cumulative poetry shows itself little by little. It’s much like unfolding a tale. The one taught in the class goes like -
- Day 1
This is the house that Jack built.
- Day 2
This is the malt that lay in
the house that Jack built.
- Day 3
This is the rat that ate
the malt that lay in
the house that Jack built.
And so on, as you see the tale is unfolded little by little every day. The whole tale is unfolded on,
- Day 12
This is the horse and the hound and the horn that belonged to
the farmer sowing his corn that kept
the rooster that crowed in the morn that woke
the priest all shaven and shorn that married
the man all tattered and torn that kissed
the maiden all forlorn that milked
that cow with the crumpled horn that tossed
the dog that worried
the cat that killed
the rat that ate
the malth that lay in
the house that Jack built.
Technical needs
- You are expected to commit the source code in a private github repository shared with your trainers.
- There should be a documented way of generating a jar that supports above mentioned functionality, with the following behaviour:
Flags supported
--reveal-for-day for_which_day
: Reveals the tale up till that day
Example usage:
$ java -jar poetry-class.jar --reveal-for-day 1
This is the house that Jack built.
$ java -jar poetry-class.jar --reveal-for-day 2
This is the malt that lay in
the house that Jack built.
-
It is expected that all code is unit tested. If you don't know about unit tests, don't worry - here is a friendly blog by Martin Fowler talking about unit testing. And you can take a look at junit's official guide to efficiently write tests with same.
-
Its expected you write all code using git as your version control system pushed to a private remote repository like Bitbucket and you share access with your mentors.
-
Please use a convention for your git messages, like the one mentioned here. Also, try to keep your commits small with one logical change in each commit.
-
Use
gradle
as the build tool. You can learn about it from official documentation. However be careful with the time you spend on it, as its quite exhaustive. It might be better to connect with people in your office who already worked with or know about gradle. Anyhow,./gradlew test
should get you started for running tests.
The poetry class wants each line to echo twice, if the flag is specified. Else retain the default behaviors. The purpose is that the poetry starts reading more like a song.
Technical expecations
- Support the new flags as shown below
Flags supported
--reveal-for-day for_which_day [--echo]
: Reveals the tale up till that day, with an optional echo
Example usage:
$ java -jar poetry-class.jar --reveal-for-day 1
This is the house that Jack built.
$ java -jar poetry-class.jar --echo --reveal-for-day 1
This is the house that Jack built
the house that Jack built.
$ java -jar poetry-class.jar --echo --reveal-for-day 2
This is the malth that lay in
the malth that lay in
the house that Jack built
the house that Jack built.
-
As mentioned previously, all code is unit tested. Maintained in source control with small commits.
-
Try to ensure that your classes are bite sized and have a single responsibility allocated to them. A practise of Object Calisthenics can help you achieve that.