Тёмный
No video :(

Advanced Kotlin Techniques for Spring Developers 

Kotlin by JetBrains
Подписаться 74 тыс.
Просмотров 18 тыс.
50% 1

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

 

21 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 43   
@bader-eddineqodia5964
@bader-eddineqodia5964 Год назад
Thank you so much
@asm0di0
@asm0di0 Год назад
In case you want to workaround the primitives another way (Jackson-specific) there is a way: spring: jackson: deserialization: FAIL_ON_NULL_FOR_PRIMITIVES: true
@Alberto_Cavalcante
@Alberto_Cavalcante Год назад
Thanks, that's helpful!
@LostMekkaSoft
@LostMekkaSoft Год назад
thanks for this talk, you are awesome! ♥ some notes i scribbled down while watching: - 10:24 i know this is nitpicking, but seeing that there is no trailing comma in the data class constructor really triggered me. it is a silly pet peeve of mine i guess 😅 - wow, even as a senior dev i didnt know that primitive fields were auto-assigned to their primitive default value when null is given in the json request body. thanks for this insight ^^ (i think i didnt notice it so far because i always use openapi to generate clients for the fontend and server stub interfaces for the backend, so the frontend cannot accidentally supply a null value for a primitive field that is marked as required) - personally, i like the annotation based bean declaration, but i definitely see the value of the bean dsl. however i dont think that the dsl is faster, since spring reflectively scans all components anyways. once a @Bean method is found, registering it as a bean provider function should be about as fast as registering a dsl lambda as a bean provider function, so you should only see performance benefits if you completely disable bean discovery, right?
@asm0di0
@asm0di0 Год назад
Thank you! Regarding 3rd point: they said that Groovy DSL is faster than annotations, but slower than XML. Probably the same is true for Kotlin, but needs benchmarking
@xyvadimxy
@xyvadimxy Год назад
Great session guys!
@asm0di0
@asm0di0 Год назад
Thank you!
@TimoTeamMeinInternet
@TimoTeamMeinInternet Год назад
Great session and learned a lot. Thanks for your time! :)
@softwarengineeringwithfabri
very useful info, thanks 🎉
@asker3042
@asker3042 Год назад
Hi, can you please make a video about reified and inline function? I have no idea about those. I k ow I can read docs but better if you explain and show some examples thanks
@HerbertLandei
@HerbertLandei Год назад
There is really not much to know about it apart from the syntax. It looks like the type is not erased at runtime, but what happens is that because the function is inlined, the compiler can "see" which type is used in every particular scope, and insert the correctly typed code already at compile time. There are some subtle differences and limitations for inlined functions, but nothing serious, it just works 99% of the time.
@paprikar
@paprikar 11 месяцев назад
@@HerbertLandei yeah, looks like it just behaves like a macros that inserts this real code into each place when its used. That is probably what is actually happening, especially, as far as I know, the performance of such methods may not be so good, because such a strategy does not allow to use the essence of the hotspot approach, because in bytecode this method simply won't exist
@donwald3436
@donwald3436 Год назад
43:28 Now there is a new concept, leaky DSL, analogue of leaky abstraction. Why make a DSL that is worse than not using it?
@AnotherDimension
@AnotherDimension 6 месяцев назад
that's true, but isn't that rather a framework's problem than language's one?
@avalagum7957
@avalagum7957 Год назад
If we like the lastest of everything, should we change the kotlin version to 1.8.10 instead of 1.7.xx?
@AntonArhipov
@AntonArhipov Год назад
If you like the latest and greatest - sure, go on and try it! :)
@asm0di0
@asm0di0 Год назад
I tried and it works!
@user-by5yo5yi6t
@user-by5yo5yi6t Год назад
Some comments about @Entity declaration 1.A better way of defining id property is to use 0 @Id @GeneratedValue(strategy = IDENTITY) val id: Long = 0, This way we get rid of always using ? when we access id 2. You dont Have to declare all properties as var, you can define val if you want to, like in ID example above. So your name and age could be val instead of var if you want to, and it will perfectly work
@asm0di0
@asm0di0 11 месяцев назад
That's a nice idea, thanks! I will use it in my talk on JavaZone!
@deepakbisht4957
@deepakbisht4957 9 месяцев назад
Actually Val and var is about the layer you are working on. I use nullable and var in Network and Entity (Database) data classes in the data layer. But for the domain layer all my models or data classes don't have any nullable field and no var field ( i.e. I use all fields with Val) This is the rule I define to make my domain model with no field with nullable and all fields should be immutable or immune for changes. For ex for db model data class UserEntity( val Id : Long?, var name: String?, var email: String? var phone: String) for network model UserNetwork( val Id : Long?, var name: String?, var email: String? var phone: String) But for Domain Same thing should be User( val Id : Long, val name: String, val email: String, val phone: String) As I'm adding default values to the User model when I create a mapper for mapping UserEntity or UserNetwork to User... Using this way I can use my domain model freely without any null checks and without doing any computation to mutate fields of User in Presentation layer and by this I'm decoupling the responsibility of transformation of field of User from my presenter to any service or Repository class...
@boriskaloshin8989
@boriskaloshin8989 Год назад
Забавно смотреть как два русскоговорящих ведут стрим на английском ) И шутка про акцент очень даже в тему, хорошо еще , что чешский акцент, я бы сказал с рязанским ) А доклад хороший)
@programalol
@programalol 9 месяцев назад
Yo que vengo de java me resulta muy comodo trabajar con kotlin
@berkowk
@berkowk 5 месяцев назад
Using data classes for JPA entities seems counterproductive 😂 I guess java records have similar problems.
@Teemofey
@Teemofey Год назад
Чувствуется очень сильный чешский акцент. Лет ми спик фром май харт!
@replicant9611
@replicant9611 Год назад
Очень некрасиво указывать людям на акцент. Живу в Англии и никто ни разу не упрекнул и не пошутил на счёт моего русского акцента. Но среди русскоязычных это вообще как воды попить. То индусский акцент, то чешский теперь. Учитесь культуре общения.
@Teemofey
@Teemofey Год назад
@@replicant9611 Видимо это у вас некрасиво. Не знаю почему, может у вас за это убивают или сажают в тюрьму. Учитесь терпимости и юмору. У нас и акцент, и внешность это повод для беззлобного юмора. Учитесь тому, что существуют разные культуры, в том числе непохожие на вашу.
@replicant9611
@replicant9611 Год назад
Это называется бескультурье и смеяться с акцента "беззлобно" - это, в лучшем случае, бытовой расизм. Продолжайте упорствовать.
@Teemofey
@Teemofey Год назад
@@replicant9611 Я не упорствую, а рассказываю вам о другой культуре с другим отношением к юмору. У нас приняты интернационализм и равноправие, а ещё принято к себе и к другим относиться с пониманием и юмором. Если вы хотите насаждать свою единственно верную культуры и свои единственно верные взгляды то должны быть готовы к тому, что ваша диктатура встретит сопротивление.
@replicant9611
@replicant9611 Год назад
@@Teemofey Вы айтишник-экспат из Еревана? Расскажите как вы в последний раз посмеялись над акцентом и внешностью своего коллеги.
@donwald3436
@donwald3436 Год назад
31:57 I would write Person( id = rs.getInt("id"), name = rs.getString("name"), age = rs.getInt("age"), ) What do you think?
Далее
Nothing is really cool in Kotlin
7:43
Просмотров 2,5 тыс.
Crust of Rust: async/await
2:34:01
Просмотров 189 тыс.
The best programmer I know | Daniel Terhorst-North
56:04
Coroutines Beyond Concurrency by Alex Semin
39:35
Просмотров 20 тыс.
Kotlin DSL in under an hour by Anton Arhipov
41:30
Просмотров 3,4 тыс.
Spring Tips: Spring Boot 3.2
1:21:52
Просмотров 75 тыс.