nashville-software-school / bangazon-inc

Curriculum for the C# web development full-time back-end course.
93 stars 230 forks source link

use DI to inject repo into the WalkerController #254

Closed askingalot closed 3 years ago

askingalot commented 3 years ago

This is the first step in changing the curriculum to use DI

copypastedeveloper commented 3 years ago

I like it conceptually. I always skip the interface stuff for DI when teaching it because it then get mentally construed in my experience as I add an interface to inject it, when you can definitely inject the concrete class. Lowers the cognitive load as well. The grabbing the field values I don't think is a part of this pr, but I always just get the value by name and then use it to teach them casting again, using as and explicit casting. Anyway just some thoughts.

askingalot commented 3 years ago

@copypastedeveloper I'm using interfaces to (hopefully) prepare the way to talk about testing.

I don't understand your comment about field values, can you clarify it?

copypastedeveloper commented 3 years ago

image

^ this stuff.

askingalot commented 3 years ago

I see.

I've never taught casting. Do you feel that it helps students understand types better? Or, more generally, how does it help students to understand casting?

copypastedeveloper commented 3 years ago

we initially talk about it when we talk about inheritance, talking about checking the items in a list to see what they actually are and casting them to that to call specialized methods. helps that is and as are involved, since they're generally involved in the inheritance conversation anyway. then we talk about it again in this context as it relates to unboxing of a value type. its not a particular focus, just something we talk about. we move out of ado.net pretty quickly into dapper where all the casting is done behind the scenes for them, but i like for them to know exactly what is happening before we don't make them do it anymore.