Kotlin for C# Developers - Alex Dunn
Вставка
- Опубліковано 2 лип 2019
- Dive into the latest craze in languages and platforms - Kotlin. This time we will be looking at it from the perspective of a .NET C# developer, draw comparisons between the languages, and bridge the gap between these 2 amazing languages.
We'll look at:
- Kotlin as a language
- Platforms Kotlin is great for
- Object Oriented Implementations in Kotlin
- Extended Features
- Features Kotlin has that C# doesn't
- A demo Android application in Kotlin vs a Xamarin.Android app in C#
In the end you will leave with a foundational knowledge of Kotlin and its capabilities to build awesome apps with less code. You should feel comfortable comparing C# applications to Kotlin applications and know where to find resources to learn even more!
Check out more of our talks in the following links!
NDC Conferences
ndcoslo.com
ndcconferences... - Наука та технологія
Hey ya'll - speaker here. I don't normally do this on videos of my talks, but I wanted to address some of the thoughts shared so far! First off, I was totally incorrect about my explanation of the 'external' keyword in Kotlin and have updated this talk to reflect that. The experience I've had with it was reflected incorrectly, I took the time to go back and look at the times I've used it and was simply incorrect (I haven't used it with the JS external implementations, but just with JNI for codec work with audio mixing). Thanks to those who pointed this out! For those claiming this is bad Kotlin code, or "could be cleaner" - yeah, that's kinda the point. The talk is "Kotlin for C# Developers", so the Kotlin examples are written to reflect familiar styles that C# Developers are experienced with to just get them introduced to the basics of the language and its features and to help facilitate an easier "Compare and Contrast" conversation. I've implemented over a dozen high usage Android applications in Kotlin, worked on Java to Kotlin Migrations, consulted with fortune 100 brands on Kotlin best practices, and have plenty of other Kotlin talks that might interest you more if you want some real Kotlin goodness! I appreciate all the feedback and would love to talk to you all more about it! Hit me up on twitter @Suave_Pirate and I'm happy to talk about it :)
Dear Mr. Speaker, Why is your Kotlin code 8:51 not just
class Dog(
var name: String?=null,
var age: Int? = null,
var breed: String? = null
)
and instead you displayed something so scary to look at. That is not idiomatic kotlin at all. That is just Java code written in kotlin
@@andy_lamax that slide is talking about constructor overrides. Once again, it's not meant to be idiomatic Kotlin. Its comparing basic capabilities of both. The point being a class with a default empty constructor and another constructor override. That's the paradigm with all the code examples as mentioned in my previous comment
I love the trash talk towards Java 😂. I feel like C# is Java except not bad, aka it implements everything that Java has in a better way AND has way more customizability, along with more flexibility.
Great talk!
Just a small hint: the slide "Asynchronous Streams" presented at 48:46 has a small error... the foreach in the RunAsync methode should be "await foreach"
The external keyword has a totally different meaning.
You forgot sealed classes in kotlin.
Lambdas are passed as parameters but if it's the last parameter you can omit the parentheses
I enjoyed this video, but I don't see a scenario where I would use Kotlin over C# Core. Especially once .NET 5 and Blazor come out.
My guess is the price for language + libraries + tools. For example spring for server side and android studio for mobiles
I wouldn't either when presented something incorrectly. People shouldn't present something that they don't quite understand. Most of the Kotlin examples can be improved and there are several things that are completely wrong in this presentation.
Your prophecy is now playing out...2022
I learned a lot from this video.
Java didn't have default interface implementation from the get-go. It was introduced in Java 8. He must be confused with anonymous classes.
Looks nice, but what about the development process. Is is as fast as with C#?
Nice talk with good information. I would say that speaker has slight bias towards Kotlin but its not affecting the presentation that much. I do wonder if the goal of supporting multiple platforms (js/jvm/llvm) is possible in the long term. Compiling to wasm makes more sense that to js. Also speaker mentioned influence of typescript and I did not notice it anywhere.
why your video only comparing the code?
I would prefer Kotlin unless C# can manage to have a reasonable "immutable by default" and "explicit nullability" experience together.
C# 8
"immutable by default"
That would be neat!
immuteable by default !! common you will kill the performence
@@mohamedalmohsen8311 A language that is breaking performance records in different cases and also getting love from devs is Rust. And it follows the immutable by default principle. In Rust, one can certainly make a value mutable, but it has to be declared.
@@GulshanurRahman yeah I really don't get that criticism. Erlang has this property too and no one in their right mind would say it isn't performant
I mean maybe C developers, but I try to tune them out :P
I really hate to see how wrong this video is about koltin. external keyword isn't the opposite of internal, it is used to define JavaScript code for intereopability with kotlin
"Java doesn't have a very good Date object" - I wonder why he simply didn't use LocalDate & Period instead :P
It's because the presenter doesn't know idiomatic Kotlin (or Java for that matter). Most of the Kotlin examples from this presentation can be improved.
Learn the java library .. or just talk about you do not know... date ..... whts that dance (rant) about java lambdas??
but thx for cramming so much in such a concise presentation :)
The only reason it's shorter is because of refactor-variant indentation and putting opening braces in the same line. Fuck that.
It funny to see that C#+.Net started as a copy of Java+JVM and now they are using the JVM to copy C# !
Programming languages evolution is a circular reference, when you think you've the perfect language someone come and reinvent everything from 0 doing exactly the the same, "but different"!
It looks the same when Kotlin is written by someone that doesn't know how to write idiomatic Kotlin code. This presentation is misleading as most of the Kotlin examples can be cleaner.
Well you could compile c# to native in the first place, instead of creating a not-needed language 🤦♂
sometimes you thread so light... potato, potatoe... tomato,
tomatoe... c# kotlinoe...
all i learned from this video is that i should stick to C#, Java & Kotlin and the whole JVM ecosystem is pure fucking insanity, just trying to do simple shit like async programming or call a webapi is wrapped around all kind bullshit
and the syntax holy shit, it's just horrible, it's just confusing, what the fuck does suspend mean, inline, companion, who the fuck come up with this kind of shit
and who the fuck thought letting if & when inside a declaration was a good idea
First
I don't see the use case for kotlin. It's an awful language.
as a kotlin user, Kotlin is not an awful language. I use it in Multiplatform and I see drastic changes in my code base size, and how I am able to target different platforms. Its just that the presenter was trying to lighten up Kotlin for C# devs (I don't know C#), and ddnt even use idiomatic Kotlin, a good example at 8:51,
the kotlin code can just be presented as
class Dog(
var name: String?=null,
var age: String? =null,
var breed: String?=null
)
Those 5 lines have both declared an empty constructor default constructor, and other constructors as kotlin supports argument names as well, which allows you to instantiate your object as you desire with very little code.
My point is, Kotlin isn't an awful language, I am deeply sorry for the person who first showed you kotlin code and practices
Kotlin is amazing. As a veteran programmer that has started programming ever since the dawn of Java and Kotlin, I can safely say Kotlin saves most of the code size and time for me. I have developed several dozens of apps and in no case did I find Kotlin incapable of achieving what I want. It's just that this video shows literally many things a Kotlin programmer doesn't need, and it makes it seem like a hard way to go.
F#
Horrible design. Why do people keep inventing horrible languages? Please don't answer me with your non-sense.
i complata agre with your