Algebraic Data Types (ADT) in Scala | Rock the JVM

  Рет қаралды 10,908

Rock the JVM

Rock the JVM

Күн бұрын

Пікірлер: 34
@CoreyMinter
@CoreyMinter 4 жыл бұрын
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.
@rockthejvm
@rockthejvm 4 жыл бұрын
Yep
@ValinorFP
@ValinorFP Жыл бұрын
Wonderful video, as always. Thank you, Daniel and long live Scala!
@Yupppi
@Yupppi Жыл бұрын
Rock the JVM? That's the Marshall head from the 2010's, somewhat popular. Worth rocking.
@ibrahimkoz1983
@ibrahimkoz1983 Жыл бұрын
Always-valid domain model and avoiding primitive obsession are directly relevant to this concept.
@i6g7f
@i6g7f 4 жыл бұрын
nicely crafted demonstration. Very helpful to promote use of ADTs in Scala
@rockthejvm
@rockthejvm 4 жыл бұрын
So glad it's useful!
@mourikogoro9709
@mourikogoro9709 3 жыл бұрын
The best ADT tutorial!!
@rockthejvm
@rockthejvm 3 жыл бұрын
Glad it helped!
@miloventimiglia8547
@miloventimiglia8547 4 жыл бұрын
Once more a brilliant video! Keep up the good work!
@rockthejvm
@rockthejvm 4 жыл бұрын
Thank you!
@ZoYaBoBo
@ZoYaBoBo 6 ай бұрын
Thank you for explaining ADT, you are awesome )
@matteozampieri6392
@matteozampieri6392 4 жыл бұрын
Just bought access to your Advanced Scala course on Udemy! I am also eyeing the Spark Streaming 3.0 for my job :p
@rockthejvm
@rockthejvm 4 жыл бұрын
Nice! Enjoy!
@Minimingus
@Minimingus 3 жыл бұрын
Best explanation ever
@rockthejvm
@rockthejvm 3 жыл бұрын
Glad you liked it!
@Lumintorious
@Lumintorious 4 жыл бұрын
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.
@rockthejvm
@rockthejvm 4 жыл бұрын
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.
@wojciechgradzki100
@wojciechgradzki100 4 жыл бұрын
Would be good if we have ADTs part 2 with smart constructors etc
@rockthejvm
@rockthejvm 4 жыл бұрын
Yep - coming soon!
@juanjdlt
@juanjdlt 4 жыл бұрын
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
@rockthejvm
@rockthejvm 4 жыл бұрын
Sure - you can use both. But you got the idea :D
@victorgomez335
@victorgomez335 2 жыл бұрын
Great video, you rock!!
@estebanmarin002
@estebanmarin002 2 жыл бұрын
❤ thanks for this
@parthnayi786
@parthnayi786 4 жыл бұрын
Can you make one video on HTTP4s CRUD
@kyotin1
@kyotin1 3 жыл бұрын
it's awesome video!
@rockthejvm
@rockthejvm 3 жыл бұрын
Glad you liked it!
@omarojmb
@omarojmb 4 жыл бұрын
you rock
@rockthejvm
@rockthejvm 4 жыл бұрын
:D
@barslo
@barslo 4 жыл бұрын
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.
@rockthejvm
@rockthejvm 4 жыл бұрын
Check out the type lambdas video - the * is used for that purpose, but you won't need it anymore in Scala 3.
@utubebroadcastme
@utubebroadcastme 4 жыл бұрын
is this scala 3 ? why not try the new syntax ?
@rockthejvm
@rockthejvm 4 жыл бұрын
Wanted to make this accessible to all. Will increasingly use the new syntax in future videos.
@utubebroadcastme
@utubebroadcastme 4 жыл бұрын
@@rockthejvm I just feel that's what most people are 'googling' this days, plus the videos will age better ... great series nonetheless
Value Classes in Scala | Rock the JVM
22:27
Rock the JVM
Рет қаралды 5 М.
The Power of Recursion - How To Think Code Clearly
19:34
Rock the JVM
Рет қаралды 3 М.
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
What the Functor? | Functors in Scala | Rock the JVM
24:43
Rock the JVM
Рет қаралды 12 М.
Rust Data Modelling Without Classes
11:25
No Boilerplate
Рет қаралды 185 М.
Contravariance in Scala: Why Is It So Hard? | Rock the JVM
16:24
Rock the JVM
Рет қаралды 15 М.
Why are Type Classes useful in Scala? | Rock the JVM
11:22
Rock the JVM
Рет қаралды 17 М.
How to Sort Lists with Tail Recursion in Scala | Rock the JVM
20:06
RUST Enums ARE Better
5:49
ThePrimeagen
Рет қаралды 147 М.