Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
matthesrieke committed Jun 1, 2017
0 parents commit 3f0f369
Show file tree
Hide file tree
Showing 25 changed files with 657 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target
nbactions.xml
nbconfiguration.xml


37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# KSwe SoSe 2017 - Aufgabe 5

Diese Aufgabe stellt eine kleine Fingerübung dar, um das Konzept von Scrum -
auf abstrakter Ebene - zu veranschaulichen.

Nach Fertigstellung der Aufgabe soll das Ergebnis im Wechsel mit einem/einer
MitstudentIn im `Code Review` reflektiert werden. Stellt hierzu wechselseitig
einen Pull Request und nutzt die Code-Review-Funktionen von GitHub um Anmerkungen
zu hinterlassen. Denkt daran die Spielregeln zu befolgen.

## Beschreibung

Die verschiedenen Entitäten sind in einem einfachen
Java-Modell abgebildet. Ziel ist es, einen korrekten Ablauf der Scrum-Ereignisse
(wie im [Scrum Guide](http://www.scrumguides.org/download.html) beschrieben)
sicherzustellen.

## Vorgehensweise

Die Klasse `Main` steuert die Ausführung der Scrum-Ereignisse, insbesondere
deren Reihenfolge. Stelle zunächst (mit Hilfe des Scrum Guide) eine korrekte
Reihenfolge her.

In einem nächsten Schritt muss in der Klasse `Scrum` die Method `moveToNextEvent`
vervollständigt werden. Die Idee ist, hier zu überprüfen, ob das geplante Ereignis
den Scrum-Regeln entspricht. Nutze hier insbesondere die verfügbaren Exceptions.

Final müssen noch die Klassen angepasst werden, welche die Scrum-Ereignisse
repräsentieren. Diese befinden sich im Paket `de.hsbochum.fbg.kswe.scrum.events`
und implementieren alle das Interface `Event`. Implementiere für jede dieser
Klassen die `followingEventType`-Methode.

## Ergebnis

Die Ausführung der Main-Klasse sollte ohne Exception beendet werden und ein
Log aufweisen, das die Scrum-Ereignisse in ihrer chronologisch korrekten
Reihenfolge widergibt.
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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>de.hsbochum.fbg.kswe</groupId>
<artifactId>scrum4j</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
61 changes: 61 additions & 0 deletions src/main/java/de/hsbochum/fbg/kswe/scrum/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

package de.hsbochum.fbg.kswe.scrum;

import de.hsbochum.fbg.kswe.scrum.events.UnexpectedNextEventException;
import de.hsbochum.fbg.kswe.scrum.events.InvalidSprintPeriodException;
import de.hsbochum.fbg.kswe.scrum.artifacts.BacklogItem;
import de.hsbochum.fbg.kswe.scrum.artifacts.ProductBacklog;
import de.hsbochum.fbg.kswe.scrum.events.InitializationException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
*
* @author <a href="mailto:[email protected]">Matthes Rieke</a>
*/
public class Main {

private static final Logger LOG = LogManager.getLogger(Main.class);

public static void main(String[] args) {
try {
Scrum scrum = new Scrum(prepareProductBacklog());

scrum.planSprint(2);
scrum.startSprint(14);

scrum.reviewSprint();

scrum.planSprint(2);
scrum.startSprint(10);

scrum.doSprintRetrospective();

scrum.planSprint(2);

} catch (UnexpectedNextEventException | InitializationException |
InvalidSprintPeriodException ex) {
LOG.warn(ex.getMessage(), ex);
}
}

private static ProductBacklog prepareProductBacklog() {
ProductBacklog bl = new ProductBacklog();

bl.addItem(new BacklogItem("Design database structure",
"A fine-grained definition of the database structure",
BacklogItem.Priority.HIGH));
bl.addItem(new BacklogItem("Implement Read DAO",
"Develop the Data Access Objects to provide read capabilities for the database",
BacklogItem.Priority.MEDIUM));
bl.addItem(new BacklogItem("Create UI Mockups for Weather entries view",
"Create Some Mockups for the weather entry overview",
BacklogItem.Priority.HIGH));
bl.addItem(new BacklogItem("Implement Write DAO",
"Develop the Data Access Objects to provide write capabilities for the database",
BacklogItem.Priority.LOW));

return bl;
}

}
88 changes: 88 additions & 0 deletions src/main/java/de/hsbochum/fbg/kswe/scrum/Scrum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

package de.hsbochum.fbg.kswe.scrum;

import de.hsbochum.fbg.kswe.scrum.events.UnexpectedNextEventException;
import de.hsbochum.fbg.kswe.scrum.events.InvalidSprintPeriodException;
import de.hsbochum.fbg.kswe.scrum.artifacts.ProductBacklog;
import de.hsbochum.fbg.kswe.scrum.events.Event;
import de.hsbochum.fbg.kswe.scrum.events.InitializationException;
import de.hsbochum.fbg.kswe.scrum.events.Sprint;
import de.hsbochum.fbg.kswe.scrum.events.SprintPlanning;
import de.hsbochum.fbg.kswe.scrum.events.SprintRetrospective;
import de.hsbochum.fbg.kswe.scrum.events.SprintReview;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
*
* @author <a href="mailto:[email protected]">Matthes Rieke</a>
*/
public class Scrum {

private static final Logger LOG = LogManager.getLogger(Scrum.class);

private final ProductBacklog productBacklog;
private Event currentEvent;
private Sprint initialSprint;

public Scrum(ProductBacklog pbl) {
this.productBacklog = pbl;
}

private void moveToNextEvent(Event event) throws UnexpectedNextEventException, InitializationException {
LOG.info("Moving to next event...");
Event previousEvent = null;

if (this.currentEvent == null) {
this.currentEvent = event;
}
else {
/*
* TODO implement the assertion of the logical order. Throw an
* UnexpectedNextEventException if the order is not correct.
* Hint: the method Class#isAssignableFrom() might be helpful
*/
}

event.init(previousEvent, productBacklog);
LOG.info("Moved to next event: {}", event);
}

public void planSprint(int itemCount) throws UnexpectedNextEventException, InitializationException {
SprintPlanning planning = new SprintPlanning(itemCount);
moveToNextEvent(planning);
}

public void startSprint(int numberOfDays) throws UnexpectedNextEventException, InitializationException, InvalidSprintPeriodException {
Sprint sprint = new Sprint(numberOfDays);
ensureCorrectNumberOfDays(sprint);
moveToNextEvent(sprint);
}

public void doDailyScrum() {
}

public void reviewSprint() throws UnexpectedNextEventException, InitializationException {
SprintReview review = new SprintReview();
moveToNextEvent(review);
}

public void doSprintRetrospective() throws UnexpectedNextEventException, InitializationException {
SprintRetrospective retro = new SprintRetrospective();
moveToNextEvent(retro);
}

private void ensureCorrectNumberOfDays(Sprint sprint) throws InvalidSprintPeriodException {
if (initialSprint == null) {
initialSprint = sprint;
}
else {
if (initialSprint.getNumberOfDays() != sprint.getNumberOfDays()) {
throw new InvalidSprintPeriodException(String.format(
"Sprints always have to have same period. Expected: %s. Got: %s",
initialSprint.getNumberOfDays(), sprint.getNumberOfDays()));
}
}
}

}
39 changes: 39 additions & 0 deletions src/main/java/de/hsbochum/fbg/kswe/scrum/artifacts/Backlog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

package de.hsbochum.fbg.kswe.scrum.artifacts;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
* Abstract class representing a Backlog. ProdcutBacklog and SprintBacklog
* inherit from this class.
*
* @author <a href="mailto:[email protected]">Matthes Rieke</a>
*/
public abstract class Backlog {

private final List<BacklogItem> items = new ArrayList<>();

public void addItem(BacklogItem item) {
this.items.add(item);
Collections.sort(this.items);
}

public List<BacklogItem> getItems() {
return Collections.unmodifiableList(this.items);
}

public BacklogItem getAndRemoveHeadItem() throws NoBacklogItemsAvailableException {
try {
BacklogItem item = this.items.get(0);

this.items.remove(item);
return item;
}
catch (IndexOutOfBoundsException e) {
throw new NoBacklogItemsAvailableException("Backlog is empty!", e);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

package de.hsbochum.fbg.kswe.scrum.artifacts;

/**
*
* @author <a href="mailto:[email protected]">Matthes Rieke</a>
*/
public class BacklogItem implements Comparable {

public enum Priority {
HIGH,
MEDIUM,
LOW
}

private final String title;
private final String description;
private final Priority priority;
private boolean done = false;

public BacklogItem(String title, String description, Priority priority) {
this.title = title;
this.description = description;
this.priority = priority;
}

public Priority getPriority() {
return priority;
}

public String getTitle() {
return title;
}

public String getDescription() {
return description;
}

public boolean isDone() {
return done;
}

public BacklogItem done() {
this.done = true;
return this;
}

@Override
public int compareTo(Object o) {
if (o == null || !(o instanceof BacklogItem)) {
return 1;
}

BacklogItem bi = (BacklogItem) o;

// if we are not done, but the other is, we are higher
if (bi.done && !this.done) {
return 1;
}

// default: compare by priority
return this.getPriority().compareTo(bi.getPriority());
}

}
10 changes: 10 additions & 0 deletions src/main/java/de/hsbochum/fbg/kswe/scrum/artifacts/Increment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

package de.hsbochum.fbg.kswe.scrum.artifacts;

/**
*
* @author <a href="mailto:[email protected]">Matthes Rieke</a>
*/
public class Increment {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

package de.hsbochum.fbg.kswe.scrum.artifacts;

/**
*
* @author <a href="mailto:[email protected]">Matthes Rieke</a>
*/
public class NoBacklogItemsAvailableException extends Exception {

public NoBacklogItemsAvailableException(String message) {
super(message);
}

public NoBacklogItemsAvailableException(String message, Throwable cause) {
super(message, cause);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

package de.hsbochum.fbg.kswe.scrum.artifacts;

/**
*
* @author <a href="mailto:[email protected]">Matthes Rieke</a>
*/
public class ProductBacklog extends Backlog {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

package de.hsbochum.fbg.kswe.scrum.artifacts;

/**
*
* @author <a href="mailto:[email protected]">Matthes Rieke</a>
*/
public class SprintBacklog extends Backlog {

}
Loading

0 comments on commit 3f0f369

Please sign in to comment.