This Doesn't Make Sense - Scala Loops

  Рет қаралды 7,413

Rock the JVM

Rock the JVM

Күн бұрын

Written form to keep for later: rockthejvm.com...
This video is for:
- programmers who are just getting started with Scala, potentially confused about why we discourage loops
- Scala teachers and instructors who need to manage the confusion in their classes
In this video I'll present a hypothesis that has been proven effective in my trainings at Adobe and in the recent Scala at Light Speed mini-course (rockthejvm.com.... It can also be contrarian, however.
Watch the previous rant on variables: • This Doesn't Make Sens...
Follow Rock the JVM on:
LinkedIn: / rockthejvm
Twitter: / rockthejvm
Blog: rockthejvm.com...
-------------------------------------------------------------------------
Home: rockthejvm.com
-------------------------------------------------------------------------

Пікірлер: 22
@piotrbeda6887
@piotrbeda6887 4 жыл бұрын
Your channel getting hits rapidly, keep going ! Awesome content
@sevret313
@sevret313 4 жыл бұрын
Funny that you say that, as when I learnt Scala at uni maybe 6 years ago, they did not start with normal loops but got straight into the functional way of doing things.
@rockthejvm
@rockthejvm 4 жыл бұрын
That's the idea! I'm simply amazed how many Scala tutorials and trainings start with variables and loops.
@D4no00
@D4no00 10 ай бұрын
To me it seems that scala introduced loops and all of the other imperative concepts to make migration of codebases from Java to Scala easy, however it seems that having so many features makes it lack a certain philosophy and direction.
@coffeezealot8535
@coffeezealot8535 4 жыл бұрын
Thank you for all your content. I already finished your Udemy Scala courses and they are amazing. I am about to start the Spark course, soooo excited!
@rockthejvm
@rockthejvm 4 жыл бұрын
Glad you like them!
@chetansp912
@chetansp912 3 жыл бұрын
You surely have amazing content in your channel Daniel.!! Love the fact that you also have the information documented in your blogs.!
@rockthejvm
@rockthejvm 3 жыл бұрын
Much appreciated - more to come!
@chetansp912
@chetansp912 3 жыл бұрын
@@rockthejvm Awesome, will look forward to it.. :)
@user-fe1tw9zn4q
@user-fe1tw9zn4q 2 жыл бұрын
great series thanks
@michielpeeters2027
@michielpeeters2027 3 жыл бұрын
So do you think for comprehensions are good or bad? They seem similar to 'do' notation in Haskell.
@rockthejvm
@rockthejvm 3 жыл бұрын
For comprehensions are actually pretty awesome, because they're expressions not instructions.
@scotttang6229
@scotttang6229 2 жыл бұрын
Bought all three of your courses on Udemy. Thank you
@rockthejvm
@rockthejvm 2 жыл бұрын
Enjoy them!
@mourikogoro9709
@mourikogoro9709 3 жыл бұрын
What do you think about regular 'for loop' (eg. in Java)? Is it better or safer than 'while loop'?
@rockthejvm
@rockthejvm 3 жыл бұрын
It's not the syntactic form that makes the difference. The Java for/while loops mean the same thing.
@mourikogoro9709
@mourikogoro9709 3 жыл бұрын
@@rockthejvm but 'for loop' doesn't have mutable indexing statement like "i = i+1" inside its block. so should it be safer in concurrent-workload environment?
@sourabh234me
@sourabh234me 2 жыл бұрын
You mentioned how foreach is different from that of Java and that here it is higher order function taking another function as argument. When I opened this foreach function by the standard library, I see it is actually using a while loop to iterate over the elements. So does it not make it same as Java ?
@rockthejvm
@rockthejvm 2 жыл бұрын
The difference is in how you think code.
@mayabartolabac
@mayabartolabac 3 жыл бұрын
I would agree that functions are better than loops in dealing with data structures, but what about the case where I want to loop in a game? Maybe I'm programming a chess game and I want to alternate between 2 players and that requires a loop. Do I stick to loops or should I use recursion for that?
@rockthejvm
@rockthejvm 3 жыл бұрын
You can still use recursion, of course. Look, loops aren't the devil. You can use them, that's why the language supports them. The point I want to make in the video is that learning Scala needs to come with learning a different mindset, and learning just the Scala syntax while keeping the old imperative mindset is a disservice to the learner.
@mayabartolabac
@mayabartolabac 3 жыл бұрын
@@rockthejvm Ah thanks for replying quickly! I've decided to use loops for the main part of the game, since recursion and passing state is pretty tedious with that, but I'll put them off for other parts of the program.
Much Ado about Nothing | Rock the JVM
14:15
Rock the JVM
Рет қаралды 1,9 М.
Self-Types in Scala - the Why and the How | Rock the JVM
14:57
Rock the JVM
Рет қаралды 8 М.
Шок. Никокадо Авокадо похудел на 110 кг
00:44
Apple peeling hack @scottsreality
00:37
_vector_
Рет қаралды 132 МЛН
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1,1 МЛН
10+ Scala Concepts You Need to Know
16:50
DevInsideYou
Рет қаралды 5 М.
Objects and Companions in Scala | Rock the JVM
14:01
Rock the JVM
Рет қаралды 8 М.
Semigroups and Monoids in Scala
23:05
Rock the JVM
Рет қаралды 6 М.
Functional Collections in Scala
23:48
Rock the JVM
Рет қаралды 4,8 М.
Given and Using Clauses in Scala 3 | Rock the JVM
20:24
Rock the JVM
Рет қаралды 6 М.
Value Classes in Scala | Rock the JVM
22:27
Rock the JVM
Рет қаралды 4,9 М.
Idiomatic Error Handling in Scala | Rock the JVM
26:45
Rock the JVM
Рет қаралды 9 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 77 М.
Top 10 Skills to Learn to Be a Scala Developer
28:13
Rock the JVM
Рет қаралды 15 М.
Шок. Никокадо Авокадо похудел на 110 кг
00:44