Marko Novakovic
02/22/2023, 5:37 PMBryan Buschmann
02/22/2023, 8:08 PMefemoney
02/22/2023, 8:21 PMtodd.ginsberg
02/22/2023, 8:32 PMType-safety is coupling.I’d word that as “Type-safety is explicit coupling” whereas “Non-type-safe is implicit coupling. The coupling is there either way.
Hanno
02/22/2023, 8:33 PMMarko Novakovic
02/22/2023, 10:08 PMWhy isn’t CarFactory a below the line implementation detail?than it would be in same module as the implementation and the derivatives. that breaks independent deployability. right?
Bryan Buschmann
02/22/2023, 10:10 PMMarko Novakovic
02/22/2023, 10:11 PMBryan Buschmann
02/22/2023, 10:12 PMMarko Novakovic
02/22/2023, 10:16 PMHope you appreciate honest feedbackof course, thank you.
What you call coupling is semantic coupling that wont magically disappear only because you remove the typesas I said above, there absolutely has to be coupling. you are using something, that’s coupling. types just add another layer to it that doesn’t exist in type-unsafe languages. this was tailored example to showcase that exact thing. this is not particularly good factory implementation, it’s rather oversimplified and bad, but it conveys the point. it’s too simple so problem is spotted easily. point is still there regardless of better ways to implement it.
Hopefully i am Not completely off track and Not getting what your points are.explained above. you are not wrong but you kind of missed the point. the thing with unit tests and TDD is that they provide safety, you can write unit tests that make sure that correct
String
, in this case, is passed to the factory. they will not prevent you from creating non existing implementation but you can’t create non existing implementation with types either. difference is that with String
it will crash on runtime and with type-safe approach it will not compile. unit tests can have same function as compiler in this caseBryan Buschmann
02/22/2023, 10:27 PMMarko Novakovic
02/22/2023, 11:12 PMAlso, why would you knowingly ship broken code?who said it’s broken? why is it broken? what I said that mentions shipping broken code
Bryan Buschmann
02/22/2023, 11:31 PMDamien O'Hara
02/23/2023, 5:38 AM