Functional Programming Crash Course for Scala Beginners

Поделиться
HTML-код
  • Опубликовано: 2 фев 2025

Комментарии • 32

  • @DevInsideYou
    @DevInsideYou  2 года назад +5

    Table of Contents:
    00:00:00 Intro
    00:03:09 What is FP?
    00:04:38 Project Setup
    00:07:59 v01 - Initial commit - mutable and immutable bank account
    00:11:43 v02 - val _
    00:13:17 v03 - no intermediate state
    00:16:22 v04 - tap
    00:20:21 v05 - scala.util.chaining
    00:20:51 v06 - IMPORTANT | simple mutability challenges
    00:27:47 v07 - simple mutability challenges for bank accounts
    00:32:17 v08 - pipe
    00:33:13 v09 - IMPORTANT | descriptions of programs
    00:41:03 v10 - solving the println problem
    00:42:20 v11 - getting closer to solving the BankAccount problem
    00:42:57 v12 - solving the BankAccount problem
    00:45:44 v13 - IMPORTANT | FPApp
    00:48:20 v14 - Refactoring
    00:49:08 v15 - IMPORTANT | path to Monads - Part 1
    00:52:04 v16 - path to Monads - Part 2
    00:53:30 v17 - path to Monads - Part 3
    00:53:56 v18 - path to Monads - Part 4
    00:54:47 v19 - path to Monads - Part 5
    00:55:43 v20 - path to Monads - Part 6
    00:57:26 v21 - path to Monads - Part 7
    00:57:36 v22 - path to Monads - Part 8
    00:58:31 v23 - path to Monads - Part 9
    00:59:27 v24 - path to Monads - Part 10
    01:00:00 v25 - path to Monads - Part 11
    01:01:58 v26 - mutable state must be delayed
    01:04:15 v27 - fp hello world
    01:05:04 v28 - IMPORTANT | path to Tagless-Final - Part 1
    01:12:44 v29 - path to Tagless-Final - Part 2
    01:17:56 v30 - path to Tagless-Final - Part 3
    01:18:36 v31 - path to Tagless-Final - Part 4
    01:20:18 v33 - lib-examples
    01:23:18 - TF vs monix | cats-effect | ZIO

  • @re1konn
    @re1konn 2 года назад +4

    I started the video but it started getting overwhelming pretty quick for me after having gone halfway through it. I'd rather clone the repo and go through each of the commits myself one by one, pausing the video a hell lot of times(haha). Till the time, I have put it to watch later. I'm sure I'll learn so many nice things from this video. Thank you Vlad.

  • @aneuryperez
    @aneuryperez 2 года назад +3

    Great source of knowledge. Thank you for sharing this.

  • @spare123
    @spare123 2 года назад

    Many thanks for this video! I'm not a beginner in Scala, but this really helped a lot on understanding FP and tagless-final better :)

  • @re1konn
    @re1konn 2 года назад +2

    One tip I would give is to hover over the section of the code or output you are talking about. I saw your were doing it with the visual select some of the times but most times, I was unaware and had to actively find which section you were talking about.

  • @markhathaway9456
    @markhathaway9456 2 года назад

    The discussion here is expressing one or two important ideas in several ways. One is that people need to be able to understand their tools and sometimes a pure FP language is just too cryptic or foreign to them. Another is that this hybrid named Scala 3 offers a lot of capabilities and if someone tackles that they need help with use-cases of when and how to use Imperative, OOP, or FP for best results. It's a big jump from C to C++, but even bigger to Scala and that may be one reason some people fall back to Kotlin or others. They find the tool set fits them better. If people know the power of Scala, but not how to use that power tool, they'll pick a hammer every time.

  • @ppbb15
    @ppbb15 2 года назад +1

    Thanks a lot. It really helps me a lot

  • @thegeniusfool
    @thegeniusfool Год назад

    That’s a huge hand!
    And you know what they say, but hand implies a big Effect!

  • @fssbd5010
    @fssbd5010 2 года назад

    Thank you

  • @zuliandri7315
    @zuliandri7315 Год назад

    thanks @DevinsideYou to sharing your knowledge

  • @gregzoller9003
    @gregzoller9003 2 года назад

    In v22 in the FPConsole you show println accepting in : =>A. Why a thunk here? Why no simply in:A? The Console.println() accepts just A, right? or does it expect a thunk as well?

    • @DevInsideYou
      @DevInsideYou  2 года назад

      It doesn't, but we want to call delay so it's better to delay everything not just the println part.

  • @markelon8303
    @markelon8303 2 года назад

    Great video as always. I have a question: Can a person learn scala as first language?

    • @DevInsideYou
      @DevInsideYou  2 года назад

      There is only one way to find out ruclips.net/p/PLJGDHERh23x-YBJ8LmYU_IGBFflvsKfLu

    • @markelon8303
      @markelon8303 2 года назад

      @@DevInsideYou thanks a lot. I appreciate!!!
      Why don't youtube recommend these videos to me?!!!!!

    • @markelon8303
      @markelon8303 2 года назад

      @@DevInsideYou all I always saw was that it is not ideal to learn scala as first language

    • @markelon8303
      @markelon8303 2 года назад

      @@DevInsideYou watched the first video, heard you saying that "it's not a course or a tutorial". So how can the videos help me learn scala as my first language, how can I use the video?
      Became confused again 😐

    • @DevInsideYou
      @DevInsideYou  2 года назад

      It was a poor choice of words on my part. What I meant was that it's not as streamlined as a proper course or tutorial. It's more exploratory. It's MUCH longer than traditional courses. Furthermore, the approach is very different. I explained some things from very untraditional angles, but you WILL learn a LOT not just about Scala, but about programming in general.

  • @blitzpark1250
    @blitzpark1250 2 года назад

    make a video on scalajs too

  • @OnurErenElibol
    @OnurErenElibol 2 года назад

    In a real world it is very hard to write pure FP thing in any programming language. It's very time consuming, hard to understand, hard to read. My own opinion, I'm fine with some bugs caused by mutability or side effects. Also this fantasies like Zio, Cats and all pure FP libraries pops out written in Scala every day makes Scala looks like a pure FP language and community is not growing around Scala because of the bad reputation of pure FP. I think Scala needs OOP + FP hybrid libraries getting best of both worlds to be popular. It has a very good syntax, very good performance, it is productive. It really deserves to be a popular language, but this academic pure FP things killing it. Sorry :(

    • @DevInsideYou
      @DevInsideYou  2 года назад +1

      Wow, my experience is vastly different from yours. In fact I have never had such a strong urge to disagree with someone.
      There are plenty of companies in the "real world" who are extremely happy with FP. In particular THANKS TO amazing FP libraries that we have in the Scala ecosystem. I sincerely hope that I will never again have to maintain a code base that is not functional.
      Furthermore we don't have new FP libraries popping out every day. Scala is almost 20 years old at this point and we have 3 FP libraries.
      As everyone else you are entitled to your own opinion, however unless you are dealing with tiny code bases I strongly recommend you give FP another shot.
      Cheers and happy coding! :)

    • @OnurErenElibol
      @OnurErenElibol 2 года назад

      @@DevInsideYou If it is smooth that writing pure FP in real world why this pure FP guys doesn't just simply use Haskell? We all know that Scala is not the best tool for that. Scala is a hybrid language, built that way and I think should be used that way. You don't have IO in Scala natively, you even don't have a proper function composition operator and other operators like pipe operator. Also everything is object and used that way in map closures etc... .map(_.method()) yes it is method, not function. Please try to write Ramda js library in Scala. You would end up like find yourself in a weird situation writing all needed Scala core methods' function counter parts. You simply can't use the core library.
      Scala is built in a hybrid way and if you love Scala and want it to be popular, I suggest that please add some OOP libraries like vert.x, jdbc etc. We all know that Scala's OOP capabilities are better than FP ones because of JVM. Also I would really want to see a Rails like framework in Scala, and I know that with Scala 3's new macro features it could be done. That would probably the next big thing for Scala, only if some good Scala developers like you would treat this language as a hybrid one instead of pure FP.

    • @ClewertonCoelho
      @ClewertonCoelho 2 года назад

      Don't assume that if you think FP is hard to understand and hard to read everyone must think the same way. You can have bad code in any paradigm and any language and reading and understanding is a matter of studying and practicing.
      My experience shows me that much of that "bad reputation of pure FP" only exists among people that don't know, don't care and even didn't make an effort to learn the concepts of the paradigm, they just say "it's math, so it's hard, so I quit" and that's very subjective.
      Scala has its audience, no one is expecting Scala to be more popular. For that you can target Kotlin or Java itself.

    • @OnurErenElibol
      @OnurErenElibol 2 года назад

      @@ClewertonCoelho I'm actively using FP in my projects, almost more than 2 years. I didn't quit using it. Also I use it on other languages like JS with RamdaJs or other libraries. I love FP. This is not the point. As every paradigm, FP has some downsides and bottlenecks for specific cases which you SHOULD use some mutable things if you want to be productive and fast. If you try to use pure FP everywhere it would be hard to write, hard to maintain and hard to read. And this is not about knowing FP paradigms or writing good code with FP. This is because FP can be bad on some cases, and this is very normal. It is not a silver bullet. Very clever Scala creators knew this and they build a HYBRID language. I'm commenting to DevInsideYou because when I search something about Scala on RUclips, it shows me results from this channel. Think about beginners try to learn this precious language and landed to an FP world, catastrophic. For popularity, I don't agree with you. This language should be #1 in the TIOBE index. It deserves this, with its speed, productivity, multi paradigm nature, macros, generics and tons of other features. If some newcomers read this comment, please use Scala with its OOP features first and try to use Java libraries to get used to it. You will see that its very clean and easy language.

    • @DevInsideYou
      @DevInsideYou  2 года назад

      I'm sorry, but it's not easy to extract what you just said from your original message. I completely disagreed with it, but I do agree with this one. In fact I made a 3.5h Scala Crash Course in which I made the point that one should start with the familiar feature set first. In fact libraries like ZIO are in favor of mixing FP with OO and techniques like tagless-final are glorified interfaces and their implementations. In fact I like OO modulo mutability and inheritance.

  • @utubebroadcastme
    @utubebroadcastme 2 года назад

    why does every Scala tutorial for beginners have to have monads in it?!? 😅
    this in my opinion is what's hurting Scala