-
-
Notifications
You must be signed in to change notification settings - Fork 546
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 Idea: Bob and Friends #1585
Comments
If it were not for #1560, I'd fully endorse the exercise. :-) You are welcome to implement it as a track-specific exercise for Haskell. |
@sshine Thank you. I just read through your That is also where I discovered that this repo is on lockdown. I will implement it for Haskell. I need to finish the open PR I have over there too 😅 Luckily, my over engineered solution to the regular |
@sshine what do you think about a name? |
I like the name, and I look forward to your take on it. You can start another PR before you finish the first one. :-) |
Okay, thanks. I will also add a branch to my fork of this repo with the proposed |
Hey, so I am thinking of a new exercise. It is inspired by
bob
, but it might be better if it is just calledreply
.Basically, I am a big proponent of decoupling the logic for classifying messages to Bob from the reply logic. Typically this results in using some sort of
Algebraic Data Type
or enum variants.An example of my over-engineered solution in Haskell can be found here.
The benefit, as I see it, is that there is clear separation of logic and responsibilities. A wonderful side effect of that is how easy it becomes to implement reply functions for people other than Bob.
Across paradigms there are many ways that this can be handled. In rust for instance one could use a
Reply
trait that takes a&str
and returns a&str
, but it can use anenum
namedLocution
orMsgClass
to do the work that isn't related to the structBob
orCarol
orJohn
.In OOP languages people could use class composition or use interfaces.
Anyway, I made this issue, so I could guage community enthusiasm for this exercise idea.
I think it is still worth it to have the
bob
exercise (sort of like how theresistor-color
exercises keep uping their game at each step).It seems to me like most students experience
bob
as an annoying burden. I didn't realize how much I liked the exercise, until I realized there was a massive opportunity to decouple that logic of message classification from response generation thereby making well-compartmentalized code that was general enough to make newresponders
trivial to write.Okay, I am always too verbose :/ Please let me know your thoughts about this. If there seems to be some excitement for this proposal, then I will make a PR for this new exercise ;)
The text was updated successfully, but these errors were encountered: