-
-
Notifications
You must be signed in to change notification settings - Fork 749
Update LasagnaTest.java #2085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update LasagnaTest.java #2085
Conversation
|
Based on the instructions, the original values seem correct. Can you elaborate on how you arrived at these new test values? |
Sure. The example in the README. @test Second test is |
|
I believe you got the idea of the The objective of this test is to return the total time (in minutes) spent preparing the lasagna until now (
Should be: The tests should be: |
|
Closes exercism/exercism#6199 |
Have updated the repo to remove the confusing superfluous parameter and updating the description. This is a base exercise the blocks the track. I would think we would want it to be very concise. Unless the point is to challenge the learner to understand that there is a superfluous parameter on the method. Which I would think that would be a different type of exercise completely. |
| public static int expectedMinutesInOven() { | ||
| return 40; | ||
| } | ||
|
|
||
| // TODO: define the 'remainingMinutesInOven()' method | ||
| public static int remainingMinutesInOven(int timeInOven) { | ||
| return expectedMinutesInOven() - timeInOven; | ||
| } | ||
|
|
||
| // TODO: define the 'preparationTimeInMinutes()' method | ||
| public static int preparationTimeInMinutes(int layers) { | ||
| return layers * 2; | ||
| } | ||
|
|
||
| // TODO: define the 'totalTimeInMinutes()' method | ||
| public static int totalTimeInMinutes(int amountLayers) { | ||
| return preparationTimeInMinutes(amountLayers) + expectedMinutesInOven(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal of this exercise is to have students learn how to define methods. Putting the actual implementation in them would defeat that purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laurahannah I appreciate your desire to help improve our exercises, but this PR seems to go against what we try to achieve with this exercise (having students learn how to define methods and call them).
I'm sorry that the time you spent on this PR will be for naught. Might I suggest opening an issue first for potential improvements/changes? That way, we can first agree upon what changes we want to see. Thanks!
| } | ||
|
|
||
| public int totalTimeInMinutes(int amountLayers, int actualMinutes) { | ||
| public int totalTimeInMinutes(int amountLayers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the spec from two parameters to one, whereas we want students to use two parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I am still not understanding. The goal of this exercise is to have the student use two parameters even though one is never used. I did open a defect, but it was closed as working as expected. But I don't believe that is actually the case since we were working on this one as a group and all of us had the same thought. And we are communicating and this is a good thing. This exercise is blocking our progress in the Java track. And we don't want to submit a solution that is bad practice, because then that looks bad on us if anybody reviews our solution. Please advise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laurahannah Take a look at some other solutions: https://exercism.org/tracks/java/exercises/lasagna/solutions
For example:
public class Lasagna {
private final int COOKING_TIME_IN_MINS = 40; // cooking time is 40 minutes
private final int MINS_PREP_PER_LAYER = 2; // each layer takes 2 minutes to cook
// Returns expected length of 40 minutes
public int expectedMinutesInOven(){
return COOKING_TIME_IN_MINS;
}
// Returns minutes remaining in oven, based on expected minutes
public int remainingMinutesInOven(int minutesPassed){
return this.expectedMinutesInOven() - minutesPassed;
}
// Returns number of minutes you have spent preparing the lasagna
public int preparationTimeInMinutes(int numLayers){
return MINS_PREP_PER_LAYER * numLayers;
}
// Returns the total time you have been making the lasagna
public int totalTimeInMinutes(int numLayers, int minutesPassed){
return this.preparationTimeInMinutes(numLayers) + minutesPassed;
}
}You'll see both params are used when the exercise is solved correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the instructions be made clearer somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe explain what the second parameter for the totalTimeInMinutes method is. Also, I have a virtually identical solution to one that was accepted 5 months ago that does not pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instructions say:
Define the totalTimeInMinutes() method that takes two parameters: the first parameter is the number of layers you added to the lasagna, and the second parameter is the number of minutes the lasagna has been in the oven. The function should return how many minutes in total you've worked on cooking the lasagna, which is the sum of the preparation time in minutes, and the time in minutes the lasagna has spent in the oven at the moment.
How could we improve that to make it more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to agree with the OP.
In my opinion, the method/function name should be totalElapsedTimeInMinutes.
When doing this exercise the first couple of times (in different languages) I was confused by this.
In my mind, the method would ask "how many minutes it should be in the oven" as apposed to "how many minutes it has been in the oven."
I was able to infer the correct behaviour from the tests, but the naming is still confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree 100%. Plus the example in the readme, when added to the unit tests, won't pass. Like, even if you are not talking about method names and such. Add the unit test from the readme, then you have this to solve:
totalTimeIntMintues(3, 20) = 26
totalTimeInMintues(4, 8) = 48```
When in doubt, I went with the README. So, please update the README, which was the first request that I had.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totalTimeIntMintues(3, 20) = 26 totalTimeInMintues(4, 8) = 48
As far as I can tell, the second example isn't in the readme or tests.
The tests have the following test
totalTimeInMinutes(4, 8) == 16which makes total sense given the intended purpose of the method.
Also, the remake's example is
totalTimeIntMintues(3, 20) == 26which also makes sense given the intended purpose of the method.
|
I have requested mentoring since it is completely unclear to me how to past this exercise and continue my learning track. |
I think this is the way to go forward. Good luck. I'm closing this PR. |
pull request
Corrected the last two tests
Reviewer Resources:
Track Policies