Absolutely bonkers! Love it and hate it at the same time. Thankfully, starting with Java21 and type-pattern matching visitors can be replaced with switch expressions. Additionally, if sealed classes/interfaces are used, it can offer a compile-time guarantee that all subtypes in the hierarchy have been properly taken care of. Unlike here, where visiting logic is placed in the registry and only breaks at run-time. And with NPE, of all things! Nonetheless, video offers a lot of neat tricks for functional and fluent APIs. I'll surely use them either for builders or custom assertion classes for AssertJ.
9:06 vp violates the GOF rule to never depend on concrete types, only on abstractions. How do you inject MockBody for Body in a test if the code depends on concrete types?
Great Video Learned a lot and a lot of tricks are now in my sleeve !! . Thank you soo much 34:52 In the Interface X, How can one call define method type() as an instance value out of it , Can anyone share info or notes on the same?
Absolutely bonkers! Love it and hate it at the same time.
Thankfully, starting with Java21 and type-pattern matching visitors can be replaced with switch expressions. Additionally, if sealed classes/interfaces are used, it can offer a compile-time guarantee that all subtypes in the hierarchy have been properly taken care of. Unlike here, where visiting logic is placed in the registry and only breaks at run-time. And with NPE, of all things!
Nonetheless, video offers a lot of neat tricks for functional and fluent APIs. I'll surely use them either for builders or custom assertion classes for AssertJ.
this talk should be entitled "insane people code like this"...
it got pretty good in the middle and then devolved again in the end
this is Nice video.
it is a different way of solving a problem
Awesome, thank you!
Great presentation.
Very insightful
Thank you!
1:30 why Visitor Pattern
3:28 code demo
3:37 the Visitor Pattern has to visit some *graph* object
Great thank you!
i hope nobody writes this kind of code in production
It is about learning various tricks. You do not have to write like this. sometimes, to teach, we have to use things like this.
9:06 vp violates the GOF rule to never depend on concrete types, only on abstractions. How do you inject MockBody for Body in a test if the code depends on concrete types?
use mockito
Great Video Learned a lot and a lot of tricks are now in my sleeve !! . Thank you soo much
34:52 In the Interface X, How can one call define method type() as an instance value out of it , Can anyone share info or notes on the same?
check at 33:44 - type() is a method in the interface X