OOP Project Template

This commit is contained in:
OOP Project Team
2019-02-14 01:11:37 +01:00
commit d001b5ac26
12 changed files with 520 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@@ -0,0 +1,13 @@
# Maven ignores
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# Exclude maven wrapper
!/.mvn/wrapper/maven-wrapper.jar

188
CSE1105.checkstyle.xml Normal file
View File

@@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: TI1216
Description:
Checkstyle configurartion that checks the Google coding conventions (https://google-styleguide.googlecode.com/svn-history/r130/trunk/javaguide.html).
-->
<module name="Checker">
<property name="severity" value="warning"/>
<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java, properties, xml"/>
<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message" value="Avoid using corresponding octal or Unicode escape."/>
</module>
<module name="LineLength">
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
<property name="max" value="100"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="RightCurly">
<property name="option" value="alone"/>
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notPreceded" value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
<message key="ws.notFollowed" value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
</module>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="MissingSwitchDefault"/>
<module name="FallThrough"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="option" value="nl"/>
<property name="tokens" value="DOT"/>
</module>
<module name="SeparatorWrap">
<property name="option" value="EOL"/>
<property name="tokens" value="COMMA"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern" value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern" value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<property name="allowOneCharVarInForLoop" value="true"/>
<property name="tokens" value="VARIABLE_DEF"/>
<message key="name.invalidPattern" value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern" value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern" value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern" value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.notPreceded" value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
<message key="ws.followed" value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded" value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow" value="GenericWhitespace ''{0}'' should followed by whitespace."/>
</module>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="caseIndent" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="allowedAbbreviationLength" value="1"/>
<property name="ignoreFinal" value="false"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
<module name="CustomImportOrder">
<property name="customImportOrderRules" value="STATIC###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE"/>
<property name="specialImportsRegExp" value="com.google"/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
</module>
<module name="MethodParamPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="AtclauseOrder">
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
</module>
<module name="JavadocMethod">
<property name="minLineCount" value="2"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="scope" value="public"/>
<property name="allowThrowsTagsForSubclasses" value="true"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern" value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>
</module>
<module name="CommentsIndentation"/>
<module name="UnusedImports"/>
<module name="RedundantImport"/>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="MethodCount">
<property name="maxTotal" value="50"/>
<property name="maxPrivate" value="50"/>
<property name="maxPackage" value="50"/>
<property name="maxProtected" value="50"/>
<property name="maxPublic" value="50"/>
</module>
<module name="AvoidNestedBlocks"/>
<module name="DeclarationOrder"/>
<module name="EmptyStatement"/>
<module name="IllegalThrows"/>
<module name="IllegalCatch"/>
<module name="MissingSwitchDefault"/>
<module name="StringLiteralEquality"/>
<module name="UnnecessaryParentheses"/>
<module name="CyclomaticComplexity"/>
</module>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="FileLength"/>
</module>

23
README.md Normal file
View File

@@ -0,0 +1,23 @@
# CSE1105 Template Repository
This a template repository to help you get started on making the best project possible!
You can download the latest version [here](https://github.com/SERG-Delft/TI1216/releases)
http://stackoverflow.com/a/6466993
## How to import into your IDE
Eclipse:
[http://javapapers.com/java/import-maven-project-into-eclipse/](http://javapapers.com/java/import-maven-project-into-eclipse/)
Intellij:
[https://www.jetbrains.com/help/idea/2016.2/importing-project-from-maven-model.html](https://www.jetbrains.com/help/idea/2016.2/importing-project-from-maven-model.html)
## Getting your weekly reports
**Jacoco**:
Run `maven install` ([Intellij](https://www.jetbrains.com/help/idea/2016.3/getting-started-with-maven.html#execute_maven_goal)/[Eclipse](http://imgur.com/a/6q7pV))
**Checkstyle**:
Run `maven site`

15
doc/meetings/README.md Normal file
View File

@@ -0,0 +1,15 @@
# Meetings folder
**Agenda**
Before your weekly meeting you need to commit an agenda to this folder.
Make sure that the filename follows the naming convention.
For instance, for February 13th you would use `20190213_agenda.xyz`.
`xyz` would be the type of the file, please use either MarkDown (recommended, `.md` files) or PDFs (`.pdf`).
**Meeting notes**
After your weekly meeting you need to commit your notes in this folder.
Please use the following naming convention: `20190213_notes.xyz` (where you change the date to the date of the meeting).
Please hand in either a MarkDown or PDF file.

View File

@@ -0,0 +1,5 @@
# Checkstyle folder
At the end of the week, please commit a readable screenshot that shows the Checkstyle results.
Make sure that the file follows the naming convention; `20190213_checkstyle.xyz` for February 13th.
`.xyz` can be either `.jpg` or `.png`.

View File

@@ -0,0 +1,9 @@
# Final report folder
This is where you commit a **PDF** version of the draft and the final version of your report.
Checklist when handing in;
- [ ] All your names and student numbers are visible on the report.
- [ ] The filename is following the pattern `20190213_final_report.pdf` / `20190213_draft_final_report.pdf` (where the date is updated corresponding to the actual date).
- [ ] Your final report is also uploaded to Brightspace.

View File

@@ -0,0 +1,5 @@
# Sprint review folder
At the end of the week, please commit a PDF or MarkDown file containing your sprint review.
Please use the following naming convention: `20190213_sprint_review.xyz` (update the date according to your current sprint).
`.xyz` can be either `.pdf` or `.md`.

View File

@@ -0,0 +1,18 @@
<!-- An example of how you can do a sprint review -->
# Sprint Review
## Main problems Encountered
### Problem 1: Multiple members were too late
During the lab, multiple people arrived too late. This interfered with the meeting that was scheduled at that moment and it had to be postponed.
To mitigate this, a cake rule was added to push members to be on time
## Adjustments from previous sprints
- Increase testing effort
- This was not achieved. New agreements have been made.
## Adjustments for next sprint
- Increase testing effort
- Add cake rule

56
doc/sprint1/agenda.md Normal file
View File

@@ -0,0 +1,56 @@
# Meeting 1
> Quoted text will give you extra pointers to how an agenda should look like
## Opening
> Here you check if everyone is present
## Approval of the agenda
> Make sure everything that needs to be discussed is in the agenda or add it if something is missing.
## Points of action
> The items below are things you should look into after the meeting. During the meeting you can divide (some of) the work between the team members, so that everybody has something to do afterwards.
> Your TA will you for the meeting. Note down all other questions that you have so that you can ask them then.
- Create a planning and convert it to GitLab issues
- Discuss a cake rule: If you are late or not there at all, you have to bring cake (or something similar)
- Create a readme with your names, a picture and your personal development plan
- It is your job that you and your team contribute (equally)
- If there is a problem it is your responsibility to notify the TA
- Things to research:
- Scrum (See Brightspace)
- Why should you use it?
- What is a scrum master?
- How are you going to use scrum in the team?
- How will you document the sprints? (tip: templates)
- Schedule for taking notes and chairing
- Git (See Brightspace)
- How does it work?
- What is branching?
- Maven (See Brightspace)
- What does it do?
- How do you add a library to the pom file?
- Have you set the team id?
- Code structure
- How will you use packages?
- Database options
- Json
- Gson
- Jackson
- SQL
- Plain text
- GUI
- JavaFX
- IDE
- Eclipse
- IntelliJ
## Any other business
> If anybody has something that should be discussed but came up with that after the agenda was finalized (in point 2), he/she should bring that up now so that it can be discussed after all.
## Question round
> If there are any questions, now is the time to ask them.
## Closing
> Now you can start working on the project. Good luck!

104
pom.xml Normal file
View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>group-template</groupId>
<artifactId>OOP-Project</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Starter OOPProject-Template</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<checkstyle.version>7.2</checkstyle.version>
<checkstyle.plugin.version>2.17</checkstyle.plugin.version>
<jacoco-maven-plugin.version>0.7.8</jacoco-maven-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.plugin.version}</version>
<!-- Specifying configuration here will take effect on the execution of "mvn site",
but will not take effect on the execution of "mvn checkstyle:checkstyle" -->
<configuration>
<configLocation>CSE1105.checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@@ -0,0 +1,36 @@
package grade;
import java.util.stream.IntStream;
public class ProjectGrade {
/**
* Returns a grade depending on if you used git and the project compiles.
* @param usedGit true if git was used
* @param compiles true if the project compiled
* @param grade grade calculated from the rubric
* @return grade
*/
public static double calculateGrade(boolean usedGit, boolean compiles, double grade) {
if (!usedGit || !compiles) {
return 1.0;
}
return grade;
}
public static boolean usesLambda() {
return IntStream.of(0, 2, 4, 6, 8, 10).map(i -> i * i)
.allMatch(i -> (i + 1) % 2 == 1);
}
/**
* Tells you when the ta is happy.
* @param bringCake true if you brought cake
* @return happyness of the TA
*/
public static boolean taIsHappy(boolean bringCake) {
return bringCake;
}
}

View File

@@ -0,0 +1,48 @@
package grade;
import org.junit.Assert;
import org.junit.Test;
public class ProjectGradeTest {
private static final double DELTA = 0.001;
@Test
public void getGoodGradeIfCorrect() {
double grade = ProjectGrade.calculateGrade(true, true, 7.5);
Assert.assertEquals(7.5, grade, DELTA);
}
@Test
public void getBadGradeIfNotCompiles() {
double grade = ProjectGrade.calculateGrade(true, false, 7.5);
Assert.assertEquals(1, grade, DELTA);
}
@Test
public void getBadGradeIfNotUsedGit() {
double grade = ProjectGrade.calculateGrade(false, true, 7.5);
Assert.assertEquals(1, grade, DELTA);
}
@Test
public void testTaIsNotHappy() {
Assert.assertFalse(ProjectGrade.taIsHappy(false));
}
@Test
public void testTaIsHappy() {
Assert.assertTrue(ProjectGrade.taIsHappy(true));
}
@Test
public void testIsUsingLambda() {
Assert.assertTrue(ProjectGrade.usesLambda());
}
}