rbwhitaker / CSharpPlayersGuideEarlyAccess

A place to track issues with the C# Player's Guide for patches and future editions
19 stars 0 forks source link

Chop up Vin Fletcher's Arrows #665

Closed rbwhitaker closed 1 year ago

rbwhitaker commented 2 years ago

The Vin Fletcher's Arrows challenge asks a lot from people in their first real exposure to classes and objects. That needs to change.

I think Vin Fletcher's Arrows can be broken into maybe three different challenges.

First, something that demands making the Arrow class and one instance of it and doing something simple with it, like displaying its cost (and it could literally be output that is simply 5 or whatever).

Second, something that demands making multiple instances. Maybe make two instances and compare their costs or something. And maybe this should also demand using the fields in the class.

Third, we finally get to user input and let people pick their values, as the book currently has.

One thing I think this will solve is a problem I see a lot of people encounter: trying to shove user input into the Arrow class. The fact that you'll have a good class before touching user input will lead people to making naturally better classes from the get go, which is a good reason to pursue this. However, I also wonder if, on this last challenge, there shouldn't be a question asking, "Where did you put your parsing code? In your main method or in the Arrow class? Why did you pick that?" To get people thinking about where these things should live.

rbwhitaker commented 1 year ago

I didn't end up making this three challenges. I left it at two. The multiple object thing felt like a bit of a stretch to throw in now, so I left it alone. I also specifically told the reader to not put user input in the Arrow class, which I think will put people on a better path, even if they don't have a great explanation for why it is useful to separate it until a few chapters later, when talking about object-oriented design.