Write Once, Run Anywhere
ฝัง
- เผยแพร่เมื่อ 1 ต.ค. 2024
- A quick look at the Kotlin programming language.
💬 Topics:
- What is Kotlin?
- Advantages of Kotlin;
- Kotlin, Java and the JVM
- Immutability in Kotlin;
- Kotlin code examples;
- Kotlin crash course;
- Kotlin advanced features;
📖 Blog Article - www.awesome.cl...
🥇 Become a Member - / @awesome-coding
✉️ Join the Newsletter - newsletter.awe...
If it's made by JetBrains, you can be rest assured that it'll be a pleasure to work with.
can confirm, i cant go back visual studio
I dislike how async code is written in kotlin
0:00 "Write once, -run- debug anywhere"
I see what you did there
😅✌️
Lol "write once debug anywhere" was a banger start 😂
Beautiful language but the soft lock-in to IntelliJ (because it's the only real way of developing Kotlin) makes it irrelevant for me, at least.
This is a really good point. You are right, IntelliJ is pretty much a must for a good developer experience.
Object can also be used as a static class, the object is some thing that never instantiate thus a static object no inheritance etc, additionally there is this thing called companion object which is essentially a static class within an instantiatable class, this exist so that it could replace stuff such as manager class that manage other class, now you'll have all the code with the same functionality within the same class and same file
e.g.
class A
A.something() //companion object method
a.somrthing() // instance object method
One thing I don’t like is gradle. It’s super slow and prefer maven.
A gradle file looks much better but it takes forever to do anything compared to
maven in xml.
For me gradle seems more straightforward and actually runs faster than maven
@@h4ktbtw It is more straight forward and i stated that in my comment but on my intel macos its slower then maven. Idk. Maybe if i got a macbook with the new chips id see how great gradle can be.
@@jaymartinez311 it can the intel chip’s fault. I don’t really remember how it felt on one of these. However it is flying on M1/M1 Pro
Damn you really made me want to give it a try after I've delayed it for so long... great job
Glad to hear! Good luck trying it!
coincidentally, I just tried Kotlin yesterday with Android Studio, but the IDE is too resource intensive for my liking.
is Kotlin any good with VS Code? I heard the tooling is not too good there, or any other IDE beside Jet Brain's in general.
Yes vs code's Kotin support is trash idk why it didn't get support for it
If you want to do native android development then sadly, Android Studio is all you got.
If the IDE really is to slow to actually write in it, then you can mix them.
For example, write the code in VS Code, and then go back and forth to Android Studio only for build and debug.
I like the idea of Kotlin multiplatform, but not the focus shift to Compose Multiplatform, running UI on Skia doesn't make sense when Flutter is already dropping that.
If they had a native component library/package, it would be much better than knowing how to interoperate with each platform to create the UI (e.g. a simple button) if I dont want to use Compose Multiplatform.
It's already very possible to just use native controls, without including Compose at all, because interop is pretty seamless.
However, Compose's ergonomics (IMHO) are much better than Flutter's, in part due to Kotlin's slick syntax, and the fact that it's a compiler plugin that does some compile-time magic to make it all work with minimal code. Aside, it's the main UI framework for Android (and even there it doesn't use the native system components because they're too limited), which opens Android developers to a plethora of other platforms without too much overhead.
I've been using Kotlin for a few years and I have to say, it is definitely an improvement over Java. One issue I encounter is that most Java libraries weren't built for Kotlin, which can lead to a strange developer experience.
Fair!
Anything is better than public static void main string[ ] args 😛
True :))
But no good resource to learn kmp
I wish my company could let me use it
You can start by using in in personal projects, then you can propose it for internal tools inside your company.
That's how I did it, and it is now the main language we use on the backend :)
@@awesome-coding sadly I already did that and they wouldn't let us use kotlin because we have the whole ecosystem in Java. Moreover we have a custom framework on top of spring boot and it would be a nightmare to migrate it to kotlin
@@guglielmobartelloni Ah, I understand :( Sorry to hear that
damn i might learn kotlin... looks a lot like c# and ruby
C# and Ruby are my dream programming languages😊
To be it looks very much like the good parts of Python and Ruby brought onto JVM.
I still love Scala more. 😃
Anyway, nice video!
Thanks!
In modern IT landscape Java VM is obsolete. All you really need - run one Go binary inside scratch image under any container environment. End of story.
Cool video, it would be interesting to see one on dart/flutter
It's on the short list!
awesome
kotlin multiplatform vs Flutter ?
I think you mean one of these:
1. Kotlin Multiplatform vs. Dart (the language)
2. Compose Multiplatform vs. Flutter (the UI frameworks)
I think one cool thing about KMP in comparison to Dart is that it blends in with the target framework.
It's not running in some sort of VM (nor is Dart), but it also doesn't need a "bridge" (and the overhead that comes with that) to interact with the underlying platform.
For example, Kotlin interacting with Java is literally just Java bytecode calling into a normal JVM function, no bridge, no walls, no conversions.
Same with Kotlin/Native. It builds to LLVM bytecode, which then gets merged with C/C++/Swift/Obj-C bytecode, and from there LLVM links everything such that a call from Kotlin to native (or vice versa) is one jmp machine instruction, no other abstractions!
And the same applies to JS or Wasm.
Great intro to Kotlin!
Thank you!
?: elvis operator xD
yep! that's how they call it because it kind of resembles Elvis Presley 😂
@@awesome-coding love the name, should be that
For kotlin to take off, we first need to see spring boot running
Isn't android leaking DNS?
kotlin seems like a great language, but i really don't like oop and inheritance. i prefer composition through data structures.
Inheritance is not imposed by design in Kotlin.
@@awesome-codingthat's good to know, thanks
Do elixir next
Erlang, Elixir and Gleam ar on the short list!
@@awesome-coding But Elixir first... right? 😅
isn't dart also a write once run anywhere ?
pretty much, but i don't know about server end though
Expect dart to lose support soon, google is addicted to abandoning projects
@@tabletuser123so is kotlin made by Google and go as well
@hamzakhiar3636 Kotlin is developed by JetBrains.
3:34 Maan I've been using Kotlin for more than 2 years and never knew about object expressions, thought I knew everything!
I used them before to implement a specific interface, but didn't think they could be used just like that! Super cool for one-off operations where creating a class is overkill!
Yep! Very similar to object literals in JS, which is really useful!
same here.
kotlin is well positioned to be the main language for pretty much everything... jetbrains are #1 when it comes to producing tooling for coding and no matter how good your language if it has no proper tooling its doomed...
kotlin native will take over low level stuff (so C/C++,Rust,Zig)
kotlin jvm already dominates JVM so (see you java)
kotlin wasm/js will ultimately cover web
they just need to not screw up and continue as they were doing before, the appeal of writing very readable code but having it work for any platform without a VM is going to be huge
The only thing Kotlin dominates and will continue to dominate is Android development, there are much better options for other applications
I don't think low level is achievable because:
1. JVM is "huge" in that space;
2. Garbage collection is a big no no since it is an unpredictable process.
He's talking about the Kotlin Native runtime (which utilizes LLVM) rather than the JVM, so low level stuff is feasible in that. However, Rust and Zig are inherently better suited for this purpose, as they were designed from the ground up for low-level programming
its time for php my brother
I know I know! 😂
I like Kotlin, but it's a deadborn. 1. I/O is very slow, even slower than Java, i had a lot of problem with Competitive programming usually converting the same code to Java solves everything. 2. Way to much useless features. Val and Var are stupid concept, there is no risk of null or memory safety with simple types, but when you define mutableListOf or unMutableListOf - you basically write something twice. I saw a lot of code in Kotlin, there is absolutely no need for Val and Var. But there are a lot more redundant or useless features. 3. Language still in active development, it's not a C++ specifications, Kotlin recieve new updates that breaks old code, and over all it's not improving anything. 4. Compose is promising, but it's a half baked, i don't see real market for it, it don't solve any new problems, it's just as bad as any other option. 5. Kotlin is way to much focused on Android, as i observe wat Google is doing with ChromOS and FlexOS, they probably will abandon Java and Kotlin in development pipeline in future.
Do C# video as well!!
I have little experience in C#, so I could't confidently talk about it :(
Way better than Kotlin
First ❤
☝️
Second 🎉
✌️
Kotlin took everything from scala
It kind of did 🥲
Do one for Swift
Wow, a copycat of C#.
Why the lambda expressions look so bad
What do you mean? because of the () being dropped?
@@awesome-coding yes in js, and c# even in cpp and even in dart it is between () and it is just really strange to look at it in kotlin, I am thinking about trying out kotlin, the multplatform with compose looks nice, but will see...