changeDieClasses --- #62

Merged
alexis.drai merged 7 commits from changeDieClasses into main 2 years ago
Collaborator

implemented chages:

  1. class Die -> AbstractDie
  2. creat class for each type of Dices
  3. add Method to find a random Face

-- Not tested yet --

implemented chages: 1. class Die -> AbstractDie 2. creat class for each type of Dices 3. add Method to find a random Face -- Not tested yet --
ismail.taha_janan added 4 commits 2 years ago
ismail.taha_janan added 1 commit 2 years ago
continuous-integration/drone/push Build is passing Details
9292a2cc44
🩹 #59 : some name spaces
ismail.taha_janan changed title from changeDieClasses to changeDieClasses --- 2 years ago
alexis.drai requested changes 2 years ago
alexis.drai left a comment
Owner

Changing the Dice class is a good idea, and I'm looking forward to these changes being merged into the main branch.

We'll proceed with the merge as soon as the problems mentionned in the review are solved

Changing the Dice class is a good idea, and I'm looking forward to these changes being merged into the main branch. We'll proceed with the merge as soon as the problems mentionned in the review are solved
private readonly List<T> listFaces = new();
public AbstractDie(string name, params T[] faces)
Owner

From SonarQube issue https://codefirst.iut.uca.fr/sonar/project/issues?resolved=false&types=CODE_SMELL&id=dice-app&open=AYNrqm1m8oTwQX-NU-Nz

Since abstract classes can’t be instantiated, there’s no point in their having public or internal constructors. If there is basic initialization logic that should run when an extending class instance is created, you can by all means put it in a constructor, but make that constructor private, private protected or protected.

From SonarQube issue https://codefirst.iut.uca.fr/sonar/project/issues?resolved=false&types=CODE_SMELL&id=dice-app&open=AYNrqm1m8oTwQX-NU-Nz Since abstract classes can’t be instantiated, there’s no point in their having public or internal constructors. If there is basic initialization logic that should run when an extending class instance is created, you can by all means put it in a constructor, but make that constructor private, private protected or protected.
alexis.drai marked this conversation as resolved
{
}
public override AbstractDieFace GetRandomFace()
Owner

code duplication, this method could be implemented directly in the abstract class

code duplication, this method could be implemented directly in the abstract class
alexis.drai marked this conversation as resolved
public override AbstractDieFace GetRandomFace()
{
Random rnd = new();
Owner

we should create only one instance of Random for the whole app.

I think the best way to do that is to create a static instance of Random as part of the AbstractDie class.

we should create only one instance of Random for the whole app. I think the best way to do that is to create a static instance of Random as part of the AbstractDie class.
alexis.drai marked this conversation as resolved
public ImageDie(string name, params ImageDieFace[] faces) : base(name, faces)
{
}
public override ImageDieFace GetRandomFace()
Owner

code duplication, this method could be implemented directly in the abstract class

code duplication, this method could be implemented directly in the abstract class
alexis.drai marked this conversation as resolved
public NumberDie(string name, params NumberDieFace[] faces) : base(name, faces)
{
}
public override NumberDieFace GetRandomFace()
Owner

code duplication, this method could be implemented directly in the abstract class

code duplication, this method could be implemented directly in the abstract class
alexis.drai marked this conversation as resolved
using Model;
Owner

This whole file can be deleted for now, until unit tests are made

This whole file can be deleted for now, until unit tests are made
alexis.drai marked this conversation as resolved
ismail.taha_janan added 1 commit 2 years ago
continuous-integration/drone/push Build is passing Details
344a0fb9ac
🎨 improve code performance
ismail.taha_janan requested review from alexis.drai 2 years ago
ismail.taha_janan added 1 commit 2 years ago
continuous-integration/drone/push Build is passing Details
5a76434f96
🎨 chanege Random type to static
alexis.drai merged commit 4fe026a094 into main 2 years ago

Reviewers

alexis.drai was requested for review 2 years ago
continuous-integration/drone/push Build is passing
The pull request has been merged as 4fe026a094.
Sign in to join this conversation.
Loading…
There is no content yet.