Hands-on Rust: Why name the MapBuilder constructor "build" instead of "new"? (Page 94)

I notice that new is used as the constructor name for Map and Player, but build as the constructor name for MapBuilder. I feel like the answer for this difference should be obvious, but it’s escaping me.

1 Like

Thanks! Added to the issue tracker. I should probably rename it for consistency (you can use whatever name you want, but consistency is good). If I remember rightly, I originally had the builder using the “builder pattern” (makes sense), but it was too big - so it got trimmed down to fit in the book. Should have changed the names when I did it!

2 Likes

That makes sense. Thanks for the background info/context!

2 Likes