Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Taffer
Oct 15, 2010


Plorkyeran posted:

Native support for Lists of any supported datatype is actually what I'm working on Right Now, although it'll be a while before it makes it to the Java SDK.

In Realm? If so, I love you. That will clean up my data objects by a ton.

Adbot
ADBOT LOVES YOU

John F Bennett
Jan 30, 2013

I always wear my wedding ring. It's my trademark.

How is Realm actually pronounced? Is it like 'the defence of the realm', or is it more like Real-M?

I've been using the former.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Taffer posted:

In Realm? If so, I love you. That will clean up my data objects by a ton.

Yes.

John F Bennett posted:

How is Realm actually pronounced? Is it like 'the defence of the realm', or is it more like Real-M?

I've been using the former.

It's the english word realm.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
https://blog.jetbrains.com/kotlin/2017/05/kotlin-on-android-now-official/
Kotlin is now officially supported for Android by Google.

Taffer
Oct 15, 2010



Greatest thing about IO this year

FAT32 SHAMER
Aug 16, 2012



What is Kotlin going to improve with Android development? I've only recently heard of it

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Kotlin is a much better Java. There's a comparison here: https://kotlinlang.org/docs/reference/comparison-to-java.html
I'd recommend just trying it out, it took me like a day to become productive in Kotlin

Volguus
Mar 3, 2009
So far, Kotlin looks like just another fad. Nothing particularly wrong with it, but there's nothing that stands out that screams: gotta have this now. At least the Scala fad back in 2009-2012 brought FP to the JVM.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Volguus posted:

So far, Kotlin looks like just another fad.
it's six years old

FAT32 SHAMER
Aug 16, 2012



I was really hoping that they would announce that Android would be written in open source swift from here on out so it'd be easier to port my apps to Android but noooooooo

Angryhead
Apr 4, 2009

Don't call my name
Don't call my name
Alejandro




Yeah, using Kotlin mostly just makes me sad I can't use Swift instead.

Don't get me wrong though, it's a great step onwards from Java, would recommend it to everybody.

Volguus
Mar 3, 2009

Malloc Voidstar posted:

it's six years old

It is. So? Scala was even older until it picked up a bit of steam. And even after 6 years, I am not aware of any other IDEs (than JetBrains) supporting this language. Not saying is bad (it isnt). It's just ... meh. Nice for a couple of personal projects for sure, but more of a curiosity, nothing else.

FAT32 SHAMER
Aug 16, 2012



The way it's written kind of reminds me of the way Swift is written at least, just more java-like instead of ObjC/C like

FAT32 SHAMER
Aug 16, 2012



Has anyone tried using Kotlin to write UiAutomator tests? I'm working on that right now and if I can get some Kotlin practince in doing that it would be good practice

Taffer
Oct 15, 2010


Angryhead posted:

Yeah, using Kotlin mostly just makes me sad I can't use Swift instead.

Don't get me wrong though, it's a great step onwards from Java, would recommend it to everybody.

Can you explain why? I use both Kotlin and Swift daily and I vastly prefer Kotlin. Swift is better than Java obviously, but It's far behind Kotlin IMO.

And Kotlin Native is in the works, which would potentially allow Kotlin code to be used on IOS in the future.


Volguus posted:

It is. So? Scala was even older until it picked up a bit of steam. And even after 6 years, I am not aware of any other IDEs (than JetBrains) supporting this language. Not saying is bad (it isnt). It's just ... meh. Nice for a couple of personal projects for sure, but more of a curiosity, nothing else.

It's not a fad. It's been picking up huge steam as a Java alternative, and now with JS and Native capabilities it's expansion is accelerating. And Google officially endorsing it cements the fact that it won't be a fad. Anything that can use the JVM can be written in Kotlin, which is an absolutely enormous segment of deployed code. Jetbrains knows what they're doing, they're not going to repeat the failures of scala.

Taffer fucked around with this message at 21:40 on May 17, 2017

FAT32 SHAMER
Aug 16, 2012



Taffer posted:

Can you explain why? I use both Kotlin and Swift daily and I vastly prefer Kotlin. Swift is better than Java obviously, but It's far behind Kotlin IMO.

And Kotlin Native is in the works, which would potentially allow Kotlin code to be used on IOS in the future.

What makes you prefer Kotlin over Swift?

Taffer
Oct 15, 2010


funny Star Wars parody posted:

What makes you prefer Kotlin over Swift?

Better collections. Iterating and filtering is cleaner and easier
Has c-style for loops ( for(var i=0;i<num;i++)
Has much better for loop / iterable syntax in general.
Has ++/-- (lol @ swift removing these)
Doesn't use absurd function parameter naming schemes, allowing you to include or exclude any/all of your parameter names when calling
Way more concise and memorable lambda and function reference syntax. I literally have to look up how to do function references in Swift every single time i use them because they're so bizarre.
when and run keywords


But honestly, the biggest thing by a very huge margin is IDE support. All those things I listed are nice conveniences but none are that big of a deal. Kotlin is completely first-class in AS, and Swift in Xcode is.... not. It's actually shocking how horrendously bad Swift support in Xcode is, considering it's the language Apple is pushing so hard. It's syntax handling and autocomplete is so slow to the point of being nearly unusable, it doesn't support refactoring of any kind, and its interoperability with ObjC is sloppy at best. When compared to Kotlin/Java in AS it's complete night and day. Writing in Kotlin with AS is pure pleasure, but writing Swift in Xcode is an exercise in suffering.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Volguus posted:

It is. So? Scala was even older until it picked up a bit of steam. And even after 6 years, I am not aware of any other IDEs (than JetBrains) supporting this language. Not saying is bad (it isnt). It's just ... meh. Nice for a couple of personal projects for sure, but more of a curiosity, nothing else.

This is a weird position you're taking.

It sounds like you're saying it's an improvement, but...well I don't know what goes after the "but" here.

Are you actually saying its worse than Java?

Tunga
May 7, 2004

Grimey Drawer
I thought it was a fad and then I went to Londroid last year and everyone there was talking about Rx and Kotlin. It was just those two things everywhere. So when our hackathon came around at work two of us did a project in Kotlin. Took me about ten minutes to be convinced. The IDE support is arguably even better than for Java and the language is just beautiful. We've been thinking about starting to use it properly at work and official Google support is the last thing that was holding us back.

Volguus
Mar 3, 2009

Thermopyle posted:

It sounds like you're saying it's an improvement, but...well I don't know what goes after the "but" here.

I am not saying is an improvement, I am saying it is not bad (à la Javascript/VB levels of bad). It is meh. The features that it does bring to the table are nothing to write home about. At the end of the day, when looking at this language the only thing that's nice is the null-safety part. The rest are either no-longer relevant (java has lambdas too now) or not really that interesting (Singletons, String templates, etc.)

Thermopyle posted:

Are you actually saying its worse than Java?

It is not worse than java, but I am not able to come up with a reason to use it over ... Groovy for example. The variable type specification doesn't do it any favors either " var name: String = ". In English one reads from left to right. "var String name" would seem appropriate, unless we're dealing with OCD developers who absolutely must have everything lined up. But, since Kotlin is not the only language out there who does that, i can't really fault them too much on it (although it is fundamental and annoying).

Actually, now reading a bit more of the Kotlin documentation, it looks a lot like Groovy. Pretty much everything that groovy had can be found in Kotlin. Plus, Groovy can be used with many other IDEs, while the same cannot be said for Kotlin (as far as I know).

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

They have a nice interactive tutorial / set of coding challenges for anyone who wants to see what it's about

https://try.kotlinlang.org/

FAT32 SHAMER
Aug 16, 2012



If it's running using the JVM doesn't that mean it's going to have all the same issues as Java, specifically its performance compared to languages like Swift/ObjC?

I'm down for easier to write Java but if it does essentially the same thing at the end of the day, I'm not sure there is much to celebrate here other than google pushing yet another shiny new thing that doesn't really change much

Volguus
Mar 3, 2009

funny Star Wars parody posted:

If it's running using the JVM doesn't that mean it's going to have all the same issues as Java, specifically its performance compared to languages like Swift/ObjC?

I'm down for easier to write Java but if it does essentially the same thing at the end of the day, I'm not sure there is much to celebrate here other than google pushing yet another shiny new thing that doesn't really change much

Or, you can look at it this way: it can use all the huge set of existing java libraries/frameworks. There's a reason why a lot of languages have been targeting the JVM in the last 10+ years or so. as for: the language doesn't really change much, I agree with you here, of course.

FAT32 SHAMER
Aug 16, 2012



Hell, even Go would be a huge performance improvement for android, though I understand the attachment to existing libraries. Pretty much any performance upgrade will require a language switch and a port of all the languages.

Edit: after looking at some benchmarks I guess Go wouldn't be as good of a performance upgrade? Idk I heard it was fantastic compared to Java for serverside stuff

Taffer
Oct 15, 2010


funny Star Wars parody posted:

If it's running using the JVM doesn't that mean it's going to have all the same issues as Java, specifically its performance compared to languages like Swift/ObjC?

I'm down for easier to write Java but if it does essentially the same thing at the end of the day, I'm not sure there is much to celebrate here other than google pushing yet another shiny new thing that doesn't really change much

Language performance on frontend applications on a platform as complicated as android or iOS is not that relevant. Most apps are doing minimal processing and when they need to do a lot there's an army of threads at their beck and call, only the truly intensive applications need to care about this at all (ones doing realtime video processing or extensive rendering i.e. high-end games), and in those cases c++ is available on all platforms. Nobody obsesses over performance in Java on Android, because if they needed to obsess about performance they wouldn't be using it in the first place, and the same is true on iOS. Swift is mostly a sibling to java as far as performance goes, and if you need high performance you skip it and go straight to c++. Source: At my work we do highly resource intensive apps that require a c++ SDK on all platforms because platform languages do not provide nearly enough.

More to the point though, it's not "easier to write java". It provides null safety and type inference which are the two single largest sources of exceptions in Java code literally everywhere. Null safety alone will wipe out nearly 50% of all application crashes. That is enormous. You can say that Java allows null safety with @NonNull and "if (var != null)" but that's dodging the issue because almost no one does that until after they specifically realize a object being null has caused a crash. Compilers forcing devs to do things right is a good thing, provided suitable tools are provided to easily do things write, which is one of the primary points of Kotlin. On top of that its collections and stdlibs and extension functions allow much more concise and performant code, which while not of profound importance is still a big improvement and is another thing that's more than just Java with a better syntax.

FAT32 SHAMER
Aug 16, 2012



I guess that's a fair point that I really didn't consider :shobon:

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Besides, AFAIK, the JVM is widely considered to be pretty performant.

I don't think anyone serious is really thinking the performance of Java or the JVM is holding back Android, but I'll admit I don't follow Android dev too closely.

FAT32 SHAMER
Aug 16, 2012



I only recently started following it after being assigned three android app dev projects at work since I'm the only one with mobile dev experience (in iOS)

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

What would keep me from using Kotlin is (I'm assuming) the dearth of examples and SnackOverflow questions and blog posts about doing X in Android compared to doing the same in Java.

The same thing that keeps me from using Elm (which is awesome) on web frontend projects.

I'm too dumb and need lots of help.

Splinter
Jul 4, 2003
Cowabunga!
I feel like someone needs to mention Android code doesn't run on the JVM.

Taffer
Oct 15, 2010


Thermopyle posted:

Besides, AFAIK, the JVM is widely considered to be pretty performant.

I don't think anyone serious is really thinking the performance of Java or the JVM is holding back Android, but I'll admit I don't follow Android dev too closely.

That is a common complaint by people not intimately familiar with the Android dev situation "Java is slow, they should ditch the bad language!", but that is a relatively minor problem in the development scene. A move away from Java can provide a lot of very nice things, like null safety as mentioned above, but that's a bonus for app developers - at the system level these things are tested and annotated thoroughly enough that NPE's are not a problem. Also as you said, the JVM can be surprisingly performant given well-optimized code, but again that's not particularly important because anything performance-critical, especially at the system-level is already written in native code. A small twitter thread talking about this

The bigger problem with Android development is architectural. It's a massive bloated beast with hastily-designed API's that are used as the foundation for an army of other API's, app development is all built around a god-object that is required everywhere and distasteful to everything it touches. Its core functionality was not designed to be what it is today, and as a result has blindingly glaring problems that every single developer is constantly at war with, especially around data persistence, view and data handling for configuration changes, and a painfully terrible lifecycle that governs all of this. The new system Google is working on (Fuchsia) is almost certainly being built specifically to address these concerns, building a new mobile OS that's built from the ground up with a strong understanding of what challenges it's going to need to account for.

But there is good news that's nearer term, Google just released a couple of hours ago multiple frameworks specifically made to help handle lifecycle, persistence, and app architecture. And for the very first time ever (!!!!) Google has finally released opinionated app architecture guidelines, using the new libraries just released, to help alleviate these issues.

Volguus
Mar 3, 2009
I hope that whatever language/framework they'll choose for Fuschia (Dart?) they will have a nice and opinionated application architecture. Until then, java or kotlin it doesn't make any difference. Same poo poo just with a different color.

Taffer
Oct 15, 2010


Volguus posted:

I hope that whatever language/framework they'll choose for Fuschia (Dart?) they will have a nice and opinionated application architecture. Until then, java or kotlin it doesn't make any difference. Same poo poo just with a different color.

Good news, they finally (finally!) have opinionated application architecture with the necessary libraries to support it.

https://developer.android.com/topic/libraries/architecture/index.html

Taffer
Oct 15, 2010


Thermopyle posted:

What would keep me from using Kotlin is (I'm assuming) the dearth of examples and SnackOverflow questions and blog posts about doing X in Android compared to doing the same in Java.

The same thing that keeps me from using Elm (which is awesome) on web frontend projects.

I'm too dumb and need lots of help.

I realizing I'm spamming the thread at this point but this is another awesome thing about Kotlin (or to be more specific, Kotlin tooling in JetBrains IDE's). You can copy Java code from anywhere, paste it into the IDE, and it will convert it instantly to Kotlin. Any syntax differences you are unfamiliar with are no issue because they're all handled automatically.


From https://medium.com/@magnus.chatt/why-you-should-totally-switch-to-kotlin-c7bbde9e10d5 (A good article)

But a sad reality is that to code in Kotlin, at least for Android, you also need to be very familiar with Java because all of the API's you're building an application on top of are written in Java, so you need to know how to handle that.

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

so it's just a different syntax? if so, lol @ u nerds spurtin about it

Taffer
Oct 15, 2010


No, it's more than that. See previous posts.

Tunga
May 7, 2004

Grimey Drawer

Lutha Mahtin posted:

so it's just a different syntax? if so, lol @ u nerds spurtin about it
Everything is just different syntax at some level. Write all your apps in machine code, it's just different syntax.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Lutha Mahtin posted:

so it's just a different syntax?
no, idea's java->kotlin translator is just really good

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Lutha Mahtin posted:

so it's just a different syntax? if so, lol @ u nerds spurtin about it

That's what every different language boils down to.

Adbot
ADBOT LOVES YOU

brap
Aug 23, 2004

Grimey Drawer

Lutha Mahtin posted:

so it's just a different syntax? if so, lol @ u nerds spurtin about it

It's a JVM language designed to interop seamlessly with Java. It's not really that surprising that Java can be automatically converted to Kotlin. You're just going to receive Kotlin code that doesn't make use of Kotlin-specific language features. You should find out what Kotlin offers instead of just posting zingers. https://kotlinlang.org/docs/reference/comparison-to-java.html

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply