Giter Site home page Giter Site logo

capstat's People

Contributors

hjorthjort avatar holmus avatar lol2kpe avatar saser avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

capstat's Issues

Create value objects for matches and users in the infrastructure layer that can be returned by the facade for database queries

These should be simple value objects, containing everything needed to create a user, like nickname (String), ELORanking (Double), etc, and the same for matches.

This is an important part of separating the infrastructure layer from the domain layer, as the infrastructure layer should have no dependence on the domain layer or the classes in it.

Name suggestions:

  • "UserDatabaseRow" and "MatchDatabaseRow"
  • "UserValueObject" and "MatchValueObject"

Add top class documentation

Add javadoc comments to top of classes exlaining their intended use, which classes they are intended to be used by, their concept at a high level, etc.

This should help with maintenance, and is also a grading criteria.

Use enum for hits and misses

They are currently implemented using an inner abstract class which itself has inner classes, which feels like a bit too complicated for its own good. Replacing these with enums should reduce the complexity without changing any of the functionality.

Make ThrowSequence class

The ThrowSequence class should be able to register hits and misses. It should also be possible to set a new starting state for the ThrowSequence, with a state of the glasses and a starting player decided by the user.

Specify and implement equals() for classes

There should be good specifications and implementations for equals() for more or less all classes that we have created. Both because it makes sense, and because it will probably help us in our unit testing later (I'm guessing JUnit's assertEquals() uses equals() to check for equality).

Task Queue Thread Class

Create a class that can be called when a new statement should be sent to the database. This thread should be active as long as the queue is not empty.

Refactor match class into several classes

Match class is at the moment very fat, full of methods and fields. It should probably be refactored in to a larger set of classes, where the match class delegates responsibility to other classes. This should make it more object oriented and possible to change more easily.

Make enum for Player1 and Player2

Storing this information in integers requires exception handling. This could be helped by creating an enumeration. A boolean could do the trick, but would not be intuitively understandable.

Decide starting player from ChalmersAge, or let user choose

Who starts the game should be automatically decided by the match based on the ChalmersAge of the players. However, it should also be possible for the spectator to decide starting player, regardless of the players' ages, or if the players have not been set yet.

These two features should ideally be implemented together, since they might interfere with each other.

Save matches via ResultsLedger

Implements methods in ResultsLedger to save a match to the database. The Match should (probably?) be given by an instance of the Match class.

Create the Event Bus

Create an event bus where listeners kan register themselves to listen for certain updates using strings. Listeners are stored together with their keys in a Map.

Possibly the event bus should take a few different types of Listeners, most highly prioritized are:

  • DataEventListener โ€“ skickar med objekt
  • NotificationEventListener โ€“ inga parametrar

Make Match follow the Strategy pattern

The Match class should have variable representing it's strategy towards saving matches: whether they should be ranked or unranked. This could be a boolean, or a Strategy object, which would give some added complexity but also flexibility. This object/boolean should be passed along to wherever in the system rankings are updated, perhaps through the event bus.

Implement a "task queue" for temporary storage of SQL queries

As mentioned in #10, a possible solution for temporary storage of matches is to store SQL queries (for insertion of matches into the database) in a text file on the computer, in case a connection to the database is not available. This can be abstracted to a "task queue": a queue of tasks to perform, that can be added to and removed from, on a FIFO ("first in, first out") basis.

A solution that this issue suggests is to have a ITaskQueue interface and have different concrete implementations of that interface, e.g. storing SQL queries in a text file.

Move security to model layer

The Security class represents a Service in Domain Driven Design. That is,

  1. it fulfills an operation belonging in the domain layer, an operation that does not belong in any entity or value object.
  2. the interface doesn't contain elements from other layers.
  3. the operation is stateless.

Therefore it should be moved to the model package. This also gives greater package coherence.

Move Factories and ThrowSequence to Model Package

The Factories for players and matches are conceptually a part of the domain model, and should be in the same package to avoid tangled package dependencies.

ThrowSequence is also conceptually a part of the domain, and should be in the model package.

Implement functionality to save match results in a local file

Alongside the database - soon to be set up - we will need a way to store results, temporarily, outside of the database, to make sure no data is lost even with crashes, errors or connectivity issues.

The most reasonable way should be to store the SQL queries meant to be sent to the database as rows in a text file, and delete the rows only when they have definitely been saved to the database.

Alter User table

As it is now, it is impossible to change data for a user directly as there are no such methods in the facade.
One possibly way to do this anyway is to read a user to a blueprint, delete the user from the database, change data in the blueprint and re-add the user again with the new data.
Methods to alter the user data should be added in DatabaseFacade though.

Implement match rounds

At the moment, a match consists of a single round. It should consist of an odd number of rounds, and end once a player has definitely won.

Suggested implementation: Give the match the number of rounds a player must win to win the whole match, rather than the maximum number of rounds which can be played. This should give more readable code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.