Closed askingalot closed 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.
@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?
^ this stuff.
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?
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.
This is the first step in changing the curriculum to use DI