filmov
tv
This one’s important - Refactoring to Functional Kotlin
![preview_player](https://i.ytimg.com/vi/OG6wwCkljaA/maxresdefault.jpg)
Показать описание
I know - I said that there would only be one FizzBuzz episode! But then people kept making comments on that episode, and asking me questions, and HTTP benchmarking is still hard, and I just can’t help myself, I like to play with code and talk about it.
So today we’ll go back to a blank FizzBuzz slate and use the exercise to look at a really important topic - actions and calculations, or impure and pure functions. We’ll get things working as quickly and dirtily as we can, and then look at the code to help understand the difference between the function types: why we should prefer calculations; why actions come to dominate our code unless we take, erm action; and how to use Kotlin sequences to keep our code both pure and responsive.
In this episode
* 00:01:16 What is an acceptance test?
* 00:01:58 Testing one layer down from main
* 00:03:44 JFDI
* 00:04:45 What is an Action?
* 00:06:59 Why do we differentiate?
* 00:07:19 Splitting actions from calculations
* 00:08:55 Actions begat actions
* 00:09:27 Functional programming hides actions
* 00:10:39 Seek and destroy actions
* 00:12:07 Large results of calculations can be a problem
* 00:13:07 Getting creative with calculations
* 00:13:56 Hiding state in an iterator
* 00:16:25 Iterables and Sequences are the same really
* 00:19:06 Don't look behind the curtain
* 00:19:23 Round up
So today we’ll go back to a blank FizzBuzz slate and use the exercise to look at a really important topic - actions and calculations, or impure and pure functions. We’ll get things working as quickly and dirtily as we can, and then look at the code to help understand the difference between the function types: why we should prefer calculations; why actions come to dominate our code unless we take, erm action; and how to use Kotlin sequences to keep our code both pure and responsive.
In this episode
* 00:01:16 What is an acceptance test?
* 00:01:58 Testing one layer down from main
* 00:03:44 JFDI
* 00:04:45 What is an Action?
* 00:06:59 Why do we differentiate?
* 00:07:19 Splitting actions from calculations
* 00:08:55 Actions begat actions
* 00:09:27 Functional programming hides actions
* 00:10:39 Seek and destroy actions
* 00:12:07 Large results of calculations can be a problem
* 00:13:07 Getting creative with calculations
* 00:13:56 Hiding state in an iterator
* 00:16:25 Iterables and Sequences are the same really
* 00:19:06 Don't look behind the curtain
* 00:19:23 Round up
Комментарии