java icon indicating copy to clipboard operation
java copied to clipboard

Add missing stubs to exercises

Open dark-wizz opened this issue 2 years ago • 21 comments

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.

dark-wizz avatar Jun 26 '22 06:06 dark-wizz

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.

andrerfcsantos avatar Jul 04 '22 16:07 andrerfcsantos

Can I take this one on?

jcovington16 avatar Jul 05 '22 04:07 jcovington16

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

andrerfcsantos avatar Jul 05 '22 07:07 andrerfcsantos

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.

jcovington16 avatar Jul 05 '22 12:07 jcovington16

Great!

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

andrerfcsantos avatar Jul 05 '22 13:07 andrerfcsantos

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

jcovington16 avatar Jul 05 '22 13:07 jcovington16

@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.

andrerfcsantos avatar Jul 05 '22 14:07 andrerfcsantos

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 avatar Jul 05 '22 14:07 jcovington16

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

jcovington16 avatar Jul 07 '22 03:07 jcovington16

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
$ 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.

andrerfcsantos avatar Jul 07 '22 08:07 andrerfcsantos

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

jcovington16 avatar Jul 13 '22 04:07 jcovington16

Cool! Go ahead!

andrerfcsantos avatar Jul 17 '22 12:07 andrerfcsantos

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

mvincentbb avatar Aug 27 '22 23:08 mvincentbb

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

andrerfcsantos avatar Sep 25 '22 13:09 andrerfcsantos

I want to take this on too

gabbyhershey avatar Oct 14 '22 22:10 gabbyhershey

@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.

andrerfcsantos avatar Oct 15 '22 09:10 andrerfcsantos

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 avatar Oct 17 '22 21:10 jennylia

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

jennylia avatar Oct 18 '22 02:10 jennylia

@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.

andrerfcsantos avatar Oct 18 '22 21:10 andrerfcsantos

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

PakkuDon avatar Oct 23 '22 14:10 PakkuDon

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

andrerfcsantos avatar Oct 24 '22 13:10 andrerfcsantos

added all missed stubs i've found

Trympyrym avatar Jan 20 '23 09:01 Trympyrym

@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.

saaagarsingh avatar Feb 03 '23 17:02 saaagarsingh

@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.

andrerfcsantos avatar Feb 26 '23 00:02 andrerfcsantos

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

Harsh4902 avatar Mar 04 '23 06:03 Harsh4902

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

andrerfcsantos avatar Mar 04 '23 14:03 andrerfcsantos

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

LightningKay avatar May 03 '23 04:05 LightningKay

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

shantanugaware avatar May 13 '23 17:05 shantanugaware

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"

keiravillekode avatar May 29 '23 10:05 keiravillekode

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.

mnyon-grandkru avatar Jun 10 '23 14:06 mnyon-grandkru