Commit a3a40c64 authored by jcechace's avatar jcechace
Browse files

Added README with description of the assignment

parent 3f83a233
Homework assignment no. 3 (BONUS), Elements
====================================
This is a bonus part of the assignment.
The base assignment of third homework can be found [in this repository](https://gitlab.fi.muni.cz/pb162/2021-hw03-csv)
**Publication date:** May 23, 2021
**Submission deadline:** -
General information
-------------------
In this assignment you will implement a very simple command line application which allows its user to query
[the periodic table](https://en.wikipedia.org/wiki/Periodic_table).
The implementation will use ``src/main/resources/elements.csv`` as its datasource.
The application should support the following command line options.
| CLI option (long) | CLI option (short) | Arguments | Description |
| ------ | ------ | ------ | ------ |
| --help | | | Print application usage |
| --name | | String | Finds element by name |
| --symbol | -s | String | Finds element by symbol |
| --number | -n | int | Finds element by atomic number |
| --year | -y | int | Finds elements by year |
For more details about the CLI see the section "Running the application" in this README as well as JUnit tests.
**Hint:** *You will need a CSV parser, and you have to write it yourself.*
**Hint:** *Add dependency on your CSV parser from hw03 to pom.xml*
### Evaluation
Beside functional correctness this assignment is focused on object-oriented design.
This means that the way you structure your program will be the main part of its evaluation.
On the other hand the given set of tests is not trying to provide an elaborate test coverage and incorrect behaviour in corner-cases should not have a large impact on the evaluation.
Note that all this is at your seminar teacher's discretion.
The maximum number of points for this assignment is **8**.
- **2 points** for passing the tests (attached tests do not guarantee a 100% correctness).
- **6 points** for correct and clean implementation (evaluated by your class teacher).
### Project structure
The structure of project provided as a base for your implementation should meet the following criteria.
1. Package ```cz.muni.fi.pb162.hw03``` contains classes and interfaces provided as part of the assignment.
- **Do not modify or add any classes or subpackages into this package.**
2. Package ```cz.muni.fi.pb162.hw03.app.impl``` should contain your implementation.
- **Anything outside this package will be ignored during evaluation.**
### Names in this document
Unless fully classified name is provided, all class names are relative to the package ```cz.muni.fi.pb162.hw03``` or ```cz.muni.fi.pb162.hw03.app.impl``` for classes implemented as part of your solution.
### Compiling the project
The project can be compiled and packaged in the same way you already know.
**Note:** *Before compiling this project you need to [install your CSV](https://gitlab.fi.muni.cz/pb162/2021-hw03-csv#compiling-the-project) parser project into your local maven repository.
```bash
$ mvn clean install
```
The only difference is, that unlike with seminar project, this time checks for missing documentation and style violation will produce an error.
You can temporarily disable this behavior when running this command.
```bash
$ mvn clean install -Dcheckstyle.fail=false
```
### Running the application
Build command mentioned above will produce a runnable jar file ``target/application.jar``.
The following are example usages of developed application.
```bash
# Search by atomic number
$ java -jar elements.jar -n 1
-------------------------------------------------------------------------------------------------------
| #| Symbol| Name| Standard State| Group Block| Year|
=======================================================================================================
| 1| H| Hydrogen| gas| nonmetal| 1766|
-------------------------------------------------------------------------------------------------------
# Search by year of discovery
$ java -jar elements.jar --year 2003
-------------------------------------------------------------------------------------------------------
| #| Symbol| Name| Standard State| Group Block| Year|
=======================================================================================================
| 113| Nh| Nihonium| | post-transition metal| 2003|
| 115| Mc| Moscovium| | post-transition metal| 2003|
-------------------------------------------------------------------------------------------------------
```
**Note:** *These are just example, refer to tests in order to identify all possible usages.*
### Submitting the assignment
The procedure to submit your solution may differ based on your seminar group. However generally it should be OK to submit ```target/homework02-2021-1.0-SNAPSHOT-sources.jar``` to the homework vault.
## Implementation
Generally speaking there are no mandatory requirements on the structure of your code as long as the command line interface of ```Appplication``` class works correctly.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cz.muni.fi.pb162</groupId>
<artifactId>homework03-2021-elements</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<checkstyle.fail>true</checkstyle.fail>
<!-- dependency versions -->
<version.plugin.checkstyle>2.17</version.plugin.checkstyle>
<version.plugin.source>2.4</version.plugin.source>
<version.junit>5.6.2</version.junit>
<version.mockito>3.9.0</version.mockito>
<version.assertj>3.19.0</version.assertj>
<version.jcommander>1.78</version.jcommander>
<version.system-labda>1.2.0</version.system-labda>
</properties>
<dependencies>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>${version.jcommander}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${version.assertj}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${version.mockito}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${version.mockito}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${version.mockito}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-lambda</artifactId>
<version>${version.system-labda}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Include sources into JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${version.plugin.source}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Executable jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>elements</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>cz.muni.fi.pb162.hw03.app.impl.Application</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>com.beust:jcommander</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<!-- surefire Config -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<!-- Check code style -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${version.plugin.checkstyle}</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>pb162_codestyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failOnViolation>${checkstyle.fail}</failOnViolation>
<violationSeverity>warning</violationSeverity>
<includeTestSourceDirectory>false</includeTestSourceDirectory>
<excludes>*/**/Demo</excludes>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment