The illegal state not represented is a huge aspect that people need to appreciate. I see a lot of "stringly typed" programming. It seems to be very common in Python and with beginner programmers. For example as map keys or Python dict keys). With ADTs a huge class of runtime errors are not possible.
@rockthejvm4 жыл бұрын
Yep
@ValinorFP Жыл бұрын
Wonderful video, as always. Thank you, Daniel and long live Scala!
@Yupppi Жыл бұрын
Rock the JVM? That's the Marshall head from the 2010's, somewhat popular. Worth rocking.
@ibrahimkoz1983 Жыл бұрын
Always-valid domain model and avoiding primitive obsession are directly relevant to this concept.
@i6g7f4 жыл бұрын
nicely crafted demonstration. Very helpful to promote use of ADTs in Scala
@rockthejvm4 жыл бұрын
So glad it's useful!
@mourikogoro97093 жыл бұрын
The best ADT tutorial!!
@rockthejvm3 жыл бұрын
Glad it helped!
@miloventimiglia85474 жыл бұрын
Once more a brilliant video! Keep up the good work!
@rockthejvm4 жыл бұрын
Thank you!
@ZoYaBoBo6 ай бұрын
Thank you for explaining ADT, you are awesome )
@matteozampieri63924 жыл бұрын
Just bought access to your Advanced Scala course on Udemy! I am also eyeing the Spark Streaming 3.0 for my job :p
@rockthejvm4 жыл бұрын
Nice! Enjoy!
@Minimingus3 жыл бұрын
Best explanation ever
@rockthejvm3 жыл бұрын
Glad you liked it!
@Lumintorious4 жыл бұрын
I love the explanation, I understood Product and Sum for the first time so thank you for that. My brain is wired towards extensibility so I even though I understand the purpose of ADTs for types that are universally finite (True and False / Up, Down, Left and Right), it's hard for me to understand why you would not use an extensible pattern for the weather type. Weather can be LOTS of things that can cause a whole array of feelings: Tornado, Sandstorm, Blizzard, Foggy etc. and maybe you just want to provide the functionality for these structures/objects, but let client code provide their types. Let's say we have an application like the one you provided for weather requests/responses, but we want to make it open to extension, closed to change (open for external addons/plugins), how would you implement this system to let client code provide their own VolcanicThunderStorm (silly example I know) weather type with it's own feeling? I feel like Scala is about the best of both worlds of FP + OOP and I want to understand the pros and cons of both. Thanks in advance.
@rockthejvm4 жыл бұрын
Legit point. The weather example was really simplified to prove a point (which no doubt you understood). As your logic gets increasingly complicated, you will probably want to expand on your ADTs, e.g. instead of a Sum type you might want to use a Product type to support many more possible values.
@wojciechgradzki1004 жыл бұрын
Would be good if we have ADTs part 2 with smart constructors etc
@rockthejvm4 жыл бұрын
Yep - coming soon!
@juanjdlt4 жыл бұрын
great Videos! thanks a lot. an observation. the function naiveFeeling() shouldn't be receiving the NaiveWeather type alias as the argument type, instead of String? greetings
@rockthejvm4 жыл бұрын
Sure - you can use both. But you got the idea :D
@victorgomez3352 жыл бұрын
Great video, you rock!!
@estebanmarin0022 жыл бұрын
❤ thanks for this
@parthnayi7864 жыл бұрын
Can you make one video on HTTP4s CRUD
@kyotin13 жыл бұрын
it's awesome video!
@rockthejvm3 жыл бұрын
Glad you liked it!
@omarojmb4 жыл бұрын
you rock
@rockthejvm4 жыл бұрын
:D
@barslo4 жыл бұрын
Hi, great videos. I have learnt from them a lot. I have a suggestion about what you could do for the next video. What is the difference between _ and * in type parameter. Here is a post from stackoverflow stackoverflow.com/questions/61686150/difference-between-star-and-underscore-in-type-parameter but it is hard to understand for newcomers. If you could explain it, but in a more simplified way.
@rockthejvm4 жыл бұрын
Check out the type lambdas video - the * is used for that purpose, but you won't need it anymore in Scala 3.
@utubebroadcastme4 жыл бұрын
is this scala 3 ? why not try the new syntax ?
@rockthejvm4 жыл бұрын
Wanted to make this accessible to all. Will increasingly use the new syntax in future videos.
@utubebroadcastme4 жыл бұрын
@@rockthejvm I just feel that's what most people are 'googling' this days, plus the videos will age better ... great series nonetheless