Skip to content
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

bracket-push: curious: why do you suppose it's called bracket-PUSH? #693

Closed
petertseng opened this issue Mar 10, 2017 · 3 comments
Closed

Comments

@petertseng
Copy link
Member

petertseng commented Mar 10, 2017

The bracket-push exercise is about determining whether the brackets in a given string are balanced.

So, one asks, why is the word "push" in the slug? I didn't see an explanation in exercism/DEPRECATED.javascript#31 where the exercise was added. Why is the exercise not called bracket-matching or brackets or something similar?

Well, okay, I can guess why: The name is meant to hint to the students that we can use a stack, because stacks have the "push" operation in the traditional literature. Aside: I wonder why that is so? I found http://stackoverflow.com/questions/420315/stacks-why-push-and-pop that may explain it - it's a spring-loaded stack of dishes.

In that case, I will half-jokingly note that this exercise name unfairly biases the solution space toward solutions that explicitly use a stack data structure and away from solutions using:

  • recursive-descent parsers (well hey, the function call stack is, too, a stack!)
  • some sort of state machine using the same grammar as the recursive-descent parser. Note that I can't really say "finite automaton" here (whether it be deterministic or not) because the language of nested brackets is not regular. But something similar, perhaps? Though of course its internal state will probably also be a stack of some sort.
  • Iteratively attempting to remove any innermost pair of brackets until you can no longer do so. No stacks in this solution at all.
  • Any other solutions that I have not even thought of or seen yet.

Now, remember that it is our policy that our exercises should not drive students toward any particular implementation and our exercises should not be over-prescriptive.

Since the name bracket-push does so, I considered proposing that we rename it.

Unfortunately, this is not my battle to fight today. But hey, if anyone ever comes along and makes the same proposal, you could let the proposer know that I agree, yeah?

@petertseng
Copy link
Member Author

I do not need a response. Have a nice day. (Or give your guess as to why it's called bracket-push)

@petertseng
Copy link
Member Author

some sort of state machine using the same grammar as the recursive-descent parser

I have just found out that such a state machine might be called... a pushdown automaton...!!!

This lends its credence to the name of the exercise!

@rbasso
Copy link
Contributor

rbasso commented Mar 11, 2017

The name makes sense, but it kind of suggests a solution instead of posing a problem.

See: exercism/discussions#124.

emcoding pushed a commit that referenced this issue Nov 19, 2018
petertseng added a commit that referenced this issue Apr 15, 2019
I rehash my prior allegations of
#693 below:

I contend that having the word `push` in the name unnecessarily biases
the solution space toward solutions that use a stack data structure (has
a *push* operation) or a *push*-down automaton, rather than other
solutions not using either of these two.

We have heard a principle that we want to name exercises by their story,
not by what they teach:
#1451 (comment)

The story here is about matching brackets, so I posit that that serves
as the name we want.

I have changed the major version number, as was done in the
retree->satellite rename, even though I do not feel strongly about
whether that should be necessary:
#1478

As we have gained experience in the rename of retree, we see that
problem-specifications is free to rename exercises at any point, without
waiting for all tracks to follow suit.
Of course, this operation should not be performed lightly since it
causes churn in the 31 (*thirty-one*) tracks implementing this exercise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants