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

Exercise test structure #150

Closed
budmc29 opened this Issue Jan 9, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@budmc29
Member

budmc29 commented Jan 9, 2018

My question here: exercism/problem-specifications#1070 (comment) was to know if we need to enforce the rules of the problem-specifications in our tests.

Requiring the property does not look that it's something that is critical and should be enforced, my reasoning being that everyone should be free to structure their code as their wish, some people will do a big procedure, no functions, others will do multiple functions.

If you look at: https://github.com/exercism/bash/blob/master/exercises/armstrong-numbers/armstrong_numbers_test.sh, you will see that we require the user to create a function in the tests.
In contrast, for exercises like this: https://github.com/exercism/bash/blob/master/exercises/triangle/triangle_test.sh is pretty much required.

What do you think about not forcing the user to add functions unless the exercises are dependent on them, ex: triangle, and let the user decide how to structure their implementations?

@sjwarner-bp

This comment has been minimized.

Show comment
Hide comment
@sjwarner-bp

sjwarner-bp Jan 10, 2018

Member

This is a good question.

I think that it is for the team to enforce as we feel appropriate. I know on the Java track we deviate from the canonical data slightly as and when it suits the exercise. The biggest thing we have to consider is how tests will be run. Once we enforce methods in our tests then everyone will have to program using them.

For some exercises, this may be beneficial, whereas for others it might be excessive.

Either way, I think the most important thing will be to enforce whatever decision we come to consistently. I can see benefits to using functions across the board, but would be interested to hear what everyone else thinks.

Member

sjwarner-bp commented Jan 10, 2018

This is a good question.

I think that it is for the team to enforce as we feel appropriate. I know on the Java track we deviate from the canonical data slightly as and when it suits the exercise. The biggest thing we have to consider is how tests will be run. Once we enforce methods in our tests then everyone will have to program using them.

For some exercises, this may be beneficial, whereas for others it might be excessive.

Either way, I think the most important thing will be to enforce whatever decision we come to consistently. I can see benefits to using functions across the board, but would be interested to hear what everyone else thinks.

@budmc29

This comment has been minimized.

Show comment
Hide comment
@budmc29

budmc29 Jan 10, 2018

Member

Can you list the benefits you can think of?
Do you see any downsides?

Member

budmc29 commented Jan 10, 2018

Can you list the benefits you can think of?
Do you see any downsides?

@sjwarner-bp

This comment has been minimized.

Show comment
Hide comment
@sjwarner-bp

sjwarner-bp Jan 11, 2018

Member

Benefits:

  • Breaking code down into functions is some new syntax for beginners to learn
  • Could encourage reuse of code where users may not think/know about functions
  • Allows us to mirror problem-specifications more closely
  • Would allow later exercises (e.g. ciphers with encrypt/decrypt functions) that require multiple functions in a single file to be more consistent with other exercises if applied across the board.

Cons:

  • For some very basic exercises, there is a potential for users to view functions as unnecessary (e.g. hello-world probably doesn't need a function, but would require one for consistency)
Member

sjwarner-bp commented Jan 11, 2018

Benefits:

  • Breaking code down into functions is some new syntax for beginners to learn
  • Could encourage reuse of code where users may not think/know about functions
  • Allows us to mirror problem-specifications more closely
  • Would allow later exercises (e.g. ciphers with encrypt/decrypt functions) that require multiple functions in a single file to be more consistent with other exercises if applied across the board.

Cons:

  • For some very basic exercises, there is a potential for users to view functions as unnecessary (e.g. hello-world probably doesn't need a function, but would require one for consistency)
@budmc29

This comment has been minimized.

Show comment
Hide comment
@budmc29

budmc29 Jan 11, 2018

Member

@kotp @Smarticles101 @kenden what do you guys think?

Member

budmc29 commented Jan 11, 2018

@kotp @Smarticles101 @kenden what do you guys think?

@kenden

This comment has been minimized.

Show comment
Hide comment
@kenden

kenden Jan 11, 2018

Contributor

I don't have a strong opinion on this but

  • Users might confuse functions and arguments. Ex in:
    run ./armstrong_numbers.sh is_armstrong 5
    is is_armstrong a function or a argument to the script?
  • It's a bit weird to always call a script with the same argument, it could be default then.
    Ex: run ./armstrong_numbers.sh 5 might be enough.
    If the user has a function in the code, nice, else it could be a comment for them in Exercism.
  • It we require functions, we might also add checks that the function name is valid:
    Ex: run ./armstrong_numbers.sh thisiswrong 5
Contributor

kenden commented Jan 11, 2018

I don't have a strong opinion on this but

  • Users might confuse functions and arguments. Ex in:
    run ./armstrong_numbers.sh is_armstrong 5
    is is_armstrong a function or a argument to the script?
  • It's a bit weird to always call a script with the same argument, it could be default then.
    Ex: run ./armstrong_numbers.sh 5 might be enough.
    If the user has a function in the code, nice, else it could be a comment for them in Exercism.
  • It we require functions, we might also add checks that the function name is valid:
    Ex: run ./armstrong_numbers.sh thisiswrong 5
@budmc29

This comment has been minimized.

Show comment
Hide comment
@budmc29

budmc29 Jan 29, 2018

Member

Looks like we have an agreement on this.

We will not use functions for tests unless the problems are complex or require them (ex: https://github.com/exercism/bash/blob/master/exercises/triangle/triangle_test.sh)

I agree with @sjwarner-bp points:

  • Breaking code down into functions is some new syntax for beginners to learn
  • Could encourage reuse of code where users may not think/know about functions

and we can address those in: #87.

Member

budmc29 commented Jan 29, 2018

Looks like we have an agreement on this.

We will not use functions for tests unless the problems are complex or require them (ex: https://github.com/exercism/bash/blob/master/exercises/triangle/triangle_test.sh)

I agree with @sjwarner-bp points:

  • Breaking code down into functions is some new syntax for beginners to learn
  • Could encourage reuse of code where users may not think/know about functions

and we can address those in: #87.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment