dnd-character: Suggestions for improving constructor in stub and in reference solution
See original GitHub issueMayur on Slack said that the DND Character exercise was hard to figure out.
I suspect that adding a constructor to the stub file would improve the situation.
As for the modifier
method, shouldn’t this be a static method?
And as for the reference solution, I would suggest the improvement to have Random
dependency-injected into the constructor, since otherwise you can only do probabilistic testing, as is done now.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Stub - D&D Wiki
Almost no class page is in a finished state when it is first posted. For guidance, see the 5e Class Design Guide. Aefling...
Read more >Community solutions for D&D Character in JavaScript on ...
Explore other people's solutions to D&D Character in JavaScript, and learn how others have solved the exercise.
Read more >Enforce super call on non constructor methods - java
No, that is not possible. It is entirely up to the overriding method to call the superclass method, or not. However, there is...
Read more >D&D 5E Character Creation Guide - YouTube
A Dungeons and Dragons 5th Edition character creation tutorial.Sponsored by Hero Forge: http://bit.ly/heroforge1Support WASD20 on Patreon: ...
Read more >5 EASY Roleplaying Tips for a Better D&D 5e Character
Want to learn how to roleplay better for your next DnD character ? Whether you've been playing Dungeons and Dragons for years, or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Because it depends on only its input, not on any object properties.
Since you don’t need the context of an object to compute the function, the minimal implementation would be a static method.
Compare this to the Haskell solution, the C# solution and the Python solution where they’re respectively a pure function independent of the
Character
type, a static method, and a top-level definition independent of theCharacter
class. The closest of these to the Java track would be the C# one, I think.OK. I’m not sure I can imagine more than one solution besides the one where
Random
is injected into the constructor. The unit tests aren’t compatible with this type of solution, and I can’t imagine how it could be.I believe I’ve left enough of an impression without contributing code to the solution, so I’ll bid you a good day now. 😄