rockpaperscissors is a is a true object-oriented implementation of the famous Rock, Paper and Scissors game.
This application follows these four fundamental principles:
- No
null
(why?) - No code in constructors (why?)
- No getters and setters (why?)
- No mutable objects (why?)
- No
static
methods, not evenprivate
ones (why?) - No
instanceof
, type casting, or reflection (why?) - No implementation inheritance (why?)
- No public methods without
@Override
- No statements in test methods except
assertThat
(why?)
If you want to know more about true object-oriented programming, I recommend these books:
- Elegant Objects (Volume 1) by Yegor Bugayenko
- Elegant Objects (Volume 2) by Yegor Bugayenko
- Object Thinking by David West
First, build it:
$ mvn clean package
Then, run:
$ java -jar target/rockpaperscissors-VERSION-jar-with-dependencies.jar
Change VERSION for the version found in pom.xml
file.
The MIT License (MIT)
Copyright (C) 2017-2018 Fabricio Barros Cabral
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.