Тёмный

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

Rock the JVM
Подписаться 24 тыс.
Просмотров 11 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 34   
@CoreyMinter
@CoreyMinter 3 года назад
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 3 года назад
Yep
@ValinorFP
@ValinorFP 10 месяцев назад
Wonderful video, as always. Thank you, Daniel and long live Scala!
@Yupppi
@Yupppi 10 месяцев назад
Rock the JVM? That's the Marshall head from the 2010's, somewhat popular. Worth rocking.
@i6g7f
@i6g7f 3 года назад
nicely crafted demonstration. Very helpful to promote use of ADTs in Scala
@rockthejvm
@rockthejvm 3 года назад
So glad it's useful!
@mourikogoro9709
@mourikogoro9709 3 года назад
The best ADT tutorial!!
@rockthejvm
@rockthejvm 3 года назад
Glad it helped!
@ibrahimkoz1983
@ibrahimkoz1983 Год назад
Always-valid domain model and avoiding primitive obsession are directly relevant to this concept.
@ZoYaBoBo
@ZoYaBoBo 4 месяца назад
Thank you for explaining ADT, you are awesome )
@Minimingus
@Minimingus 3 года назад
Best explanation ever
@rockthejvm
@rockthejvm 3 года назад
Glad you liked it!
@miloventimiglia8547
@miloventimiglia8547 3 года назад
Once more a brilliant video! Keep up the good work!
@rockthejvm
@rockthejvm 3 года назад
Thank you!
@Lumintorious
@Lumintorious 3 года назад
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 3 года назад
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.
@matteozampieri6392
@matteozampieri6392 3 года назад
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 3 года назад
Nice! Enjoy!
@estebanmarin002
@estebanmarin002 2 года назад
❤ thanks for this
@wojciechgradzki100
@wojciechgradzki100 3 года назад
Would be good if we have ADTs part 2 with smart constructors etc
@rockthejvm
@rockthejvm 3 года назад
Yep - coming soon!
@victorgomez335
@victorgomez335 2 года назад
Great video, you rock!!
@juanjdlt
@juanjdlt 3 года назад
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 3 года назад
Sure - you can use both. But you got the idea :D
@kyotin1
@kyotin1 3 года назад
it's awesome video!
@rockthejvm
@rockthejvm 3 года назад
Glad you liked it!
@parthnayi786
@parthnayi786 3 года назад
Can you make one video on HTTP4s CRUD
@omarojmb
@omarojmb 3 года назад
you rock
@rockthejvm
@rockthejvm 3 года назад
:D
@barslo
@barslo 3 года назад
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 3 года назад
Check out the type lambdas video - the * is used for that purpose, but you won't need it anymore in Scala 3.
@utubebroadcastme
@utubebroadcastme 3 года назад
is this scala 3 ? why not try the new syntax ?
@rockthejvm
@rockthejvm 3 года назад
Wanted to make this accessible to all. Will increasingly use the new syntax in future videos.
@utubebroadcastme
@utubebroadcastme 3 года назад
@@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
Просмотров 4,9 тыс.
Brawl Stars expliquez ça
00:11
Просмотров 6 млн
Физика пасты Карбонара 🧪🔬
00:57
ДУБАЙСКАЯ ШОКОЛАДКА 🍫
00:55
Просмотров 2,4 млн
Scala 3: Match Types | Rock the JVM
22:57
Просмотров 4,1 тыс.
What the Functor? | Functors in Scala | Rock the JVM
24:43
Nicolas Rinaudo - When is an ADT not an ADT?
37:25
Просмотров 1,5 тыс.
Idiomatic Error Handling in Scala | Rock the JVM
26:45
Category Theory 5.2: Algebraic data types
33:14
Просмотров 39 тыс.
Semigroups and Monoids in Scala
23:05
Просмотров 6 тыс.
Brawl Stars expliquez ça
00:11
Просмотров 6 млн