exercism / java

Exercism exercises in Java.
https://exercism.org/tracks/java
MIT License
689 stars 671 forks source link

Add missing stubs to exercises #2133

Closed dark-wizz closed 1 year ago

dark-wizz commented 2 years ago

The problem

Right now for some exercises, a student is required to read the tests to know which functions they should implement. This is annoying, time consuming and might discourage people from doing the exercise entirely. We should provide stubs for all exercises. Stubs should provide the signature of functions and classes, just so the student is immediately ready to start writing the custom logic. This is an example of a stub, from the Raindrops exercise:

class RaindropConverter {

    String convert(int number) {
        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
    }

}

All stubs must follow this format.

Contributing to this issue

This is a big issue that will require changes to a lot of exercises. The good news is that you don't need to fix this is all exercises to contribute to this issue! PRs fixing this in just one exercise at a time or a couple of exercises at a time are more than welcome.

andrerfcsantos commented 2 years ago

I absolutely agree we should do this!

@Dark-WizZ I changed the description of the issue just to make the issue and what needs to be done clearer.

jcovington16 commented 2 years ago

Can I take this one on?

andrerfcsantos commented 2 years ago

@jcovington16 Go ahead! Are you considering changing this is all exercises or only in a subset of them?

jcovington16 commented 2 years ago

Just a subset. After this one I'll be able to knock out some more difficult tasks. Just trying to work myself up to it.

andrerfcsantos commented 2 years ago

Great!

In that case, I won't assign the issue to you, just so other people can also contribute for this in other exercises.

jcovington16 commented 2 years ago

Understood. I'll look for a more challenging issue.

andrerfcsantos commented 2 years ago

@jcovington16 You absolutely can work on this issue, sorry I haven't made that clear! What I meant to say before is that since you won't be working on all the exercises and only a subset of them, I won't mark the issue as claimed just so other people can join alongside you. it's totally ok for several people to work on this issue at the same time, ideally looking at different exercises.

jcovington16 commented 2 years ago

Oh ok I understand now. I'll finish up the PR I have now and get started with this one before I dive into the analyzer. This one shouldn't take me long.

jcovington16 commented 2 years ago

@Dark-WizZ @andrerfcsantos Do we know specifically which exercises need these stubs implemented? And which tracks as well?

andrerfcsantos commented 2 years ago

It seems here in the Java track, all "medium" difficulty exercises or above don't include stubs, so probably those are a good start, but there might be more. A quick jq query for exercises that are medium difficulty or above gives me this:

jq query ```console $ jq '.exercises.practice | map(select(.difficulty >= 4)) | map(.slug) | sort' config.json [ "affine-cipher", "all-your-base", "allergies", "alphametics", "anagram", "atbash-cipher", "bank-account", "beer-song", "binary-search", "binary-search-tree", "bob", "book-store", "bowling", "change", "circular-buffer", "clock", "collatz-conjecture", "complex-numbers", "connect", "crypto-square", "custom-set", "diamond", "diffie-hellman", "dominoes", "error-handling", "etl", "flatten-array", "food-chain", "forth", "go-counting", "grade-school", "grep", "hangman", "house", "isbn-verifier", "isogram", "kindergarten-garden", "knapsack", "largest-series-product", "linked-list", "list-ops", "luhn", "markdown", "matching-brackets", "matrix", "meetup", "minesweeper", "nth-prime", "nucleotide-count", "ocr-numbers", "palindrome-products", "parallel-letter-frequency", "pascals-triangle", "phone-number", "pig-latin", "poker", "prime-factors", "proverb", "pythagorean-triplet", "queen-attack", "rail-fence-cipher", "rational-numbers", "rectangles", "rest-api", "robot-name", "robot-simulator", "roman-numerals", "rotational-cipher", "run-length-encoding", "saddle-points", "satellite", "series", "sieve", "simple-cipher", "simple-linked-list", "spiral-matrix", "sublist", "sum-of-multiples", "tournament", "transpose", "tree-building", "triangle", "twelve-days", "two-bucket", "variable-length-quantity", "word-count", "word-search", "wordy", "yacht", "zebra-puzzle", "zipper" ] ```

There might be other exercises marked as easy that might not have stubs, so it might be worth to also double-check those.

About other tracks...I don't know the state of stubs in other tracks other than the Go track, which has them. Also note the inclusion of stubs is something that each track can decide independently, some tracks might decide to not include them on purpose. If you are thinking on contributing a similar change to other tracks, please confirm the stance of each track on including stubs before proceeding.

jcovington16 commented 2 years ago

I will go through and knock out A-G just to give someone else an opportunity to knock out a few and it seems no one else jumped on this @andrerfcsantos. Also some of these looks like they have the code implemented

andrerfcsantos commented 2 years ago

Cool! Go ahead!

mvincentbb commented 2 years ago

Please, I’m new here. I want to contribute on this issue. Is it possible?

andrerfcsantos commented 2 years ago

@mvincentbb Yes! Feel free to help with this issue.

gabbyhershey commented 1 year ago

I want to take this on too

andrerfcsantos commented 1 year ago

@gabbyhershey Feel free to do so. Several people can work on this. If you are thinking on working on several exercises, it's probably a good idea to say your plan just to avoid repeated work.

jennylia commented 1 year ago

I'll do a small "linked-list" one to get started. I'm gonna ignore



Since this exercise has a difficulty of > 4 it doesn't come
with any starter implementation.
This is so that you get to practice creating classes and methods
which is an important part of programming in Java.

Please remove this comment when submitting your solution.

*/
``` for now
jennylia commented 1 year ago

my PR: https://github.com/exercism/java/pull/2183

andrerfcsantos commented 1 year ago

@jennylia Cool! If in the PR you mention the issue, it is automatically linked here. Avoids you having to make a comment just to link the issue.

PakkuDon commented 1 year ago

Hello there! I wasn't sure which exercises had been claimed but I'll have a PR up shortly to add stubs for exercises W - Z

andrerfcsantos commented 1 year ago

@PakkuDon I think they are all pretty much open :)

Trympyrym commented 1 year ago

added all missed stubs i've found

saaagarsingh commented 1 year ago

@andrerfcsantos hey just wanted to know if all the exercises have got the stubs or not. If the issue is still open to work then do let me know. I'll start working on it.

andrerfcsantos commented 1 year ago

@saaagarsingh Some still don't. Feel free to add stubs to exercises where you don't see them.

And thank you for your interest in this. I think this is something that will massively benefit the track.

Harsh4902 commented 1 year ago

Hey, if this issue is still open than I want to contribute in it

andrerfcsantos commented 1 year ago

@Harsh4902 Yes, we're still accepting contributions for this!

LightningKay commented 1 year ago

Hi, I've tried to add stubs for one exercise here - https://github.com/exercism/java/pull/2303#issue-1693283680

shantanugaware commented 1 year ago

Hello, I'm new here, is the issue fixed or does it still needs attention?

keiravillekode commented 1 year ago

The following still lack stubs:

allergies
all-your-base
alphametics
anagram
atbash-cipher
bank-account
beer-song
bob
book-store
bowling
change
circular-buffer
clock
complex-numbers
crypto-square
custom-set
diffie-hellman
dominoes
flatten-array
food-chain
forth
go-counting
grade-school
grep
hangman
house
knapsack
matching-brackets
meetup
minesweeper
nucleotide-count
ocr-numbers
palindrome-products
parallel-letter-frequency
pascals-triangle
phone-number
pig-latin
poker
prime-factors
pythagorean-triplet
queen-attack
rail-fence-cipher
rectangles
rest-api
robot-name
robot-simulator
roman-numerals
run-length-encoding

I grepped for "Since this exercise has a difficulty of"

mnyon-grandkru commented 1 year ago

Hi there. I created a PR to help fill in stubs for the PigLatinTranslator, but the check may need approval. What would I need to do in order to get that approval? Thanks much.

SleeplessByte commented 1 year ago

Partially fixed by #2325 Partially fixed by #2326

SleeplessByte commented 1 year ago

(woops didn't mean to close it)

SleeplessByte commented 1 year ago

Partially fixed by #2319

sanderploegsma commented 1 year ago

I went through the practice exercises and found two more exercises without stubs, opened PRs to add them. Once they are merged I believe this issue can be closed as completed!