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

Exercise Idea: Bob and Friends #1585

Open
guygastineau opened this issue Sep 18, 2019 · 5 comments
Open

Exercise Idea: Bob and Friends #1585

guygastineau opened this issue Sep 18, 2019 · 5 comments

Comments

@guygastineau
Copy link
Contributor

guygastineau commented Sep 18, 2019

Hey, so I am thinking of a new exercise. It is inspired by bob, but it might be better if it is just called reply.

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 an enum named Locution or MsgClass to do the work that isn't related to the struct Bob or Carol or John.

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 the resistor-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 new responders 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 ;)

@guygastineau guygastineau changed the title bob-and-friends: new exercise Exercise Idea: bob-and-friends Sep 18, 2019
@guygastineau guygastineau changed the title Exercise Idea: bob-and-friends Exercise Idea: Bob and Firends Sep 18, 2019
@sshine
Copy link
Contributor

sshine commented Sep 18, 2019

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.

@guygastineau
Copy link
Contributor Author

@sshine Thank you. I just read through your kafka printer proposal, and I love it!

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 bob exercise is already most of the way to a solution that would pass this new proposal.

@guygastineau
Copy link
Contributor Author

guygastineau commented Sep 18, 2019

@sshine what do you think about a name? bob-and-friends clearly establishes the relationship to the bob exercise, but personally I like the reply a little more. I am definitely into hearing suggestions from others.

@sshine
Copy link
Contributor

sshine commented Sep 18, 2019

I like the name, and I look forward to your take on it.

You can start another PR before you finish the first one. :-)

@guygastineau
Copy link
Contributor Author

guygastineau commented Sep 18, 2019

Okay, thanks. I will also add a branch to my fork of this repo with the proposed canonical-data.json, so if there end up being multiple instanciations of the exercise across tracks before this repo is unlocked we can have everybody on the same page. I will link my branch here when I have made the branch.

@yawpitch yawpitch changed the title Exercise Idea: Bob and Firends Exercise Idea: Bob and Friends Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants