Better HN
topnewbestaskshowjobs
Log inSign up

driver733

163 karma · joined Dec 23, 2018 (7y ago) · 14 submissions

Kotlin/Java developer, blogger, OOP and EO (elegantobjects.org) evangelist.

Blog: https://www.driver733.com GitHub: https://github.com/driver733

Submissions

1.

OOP and FP – friends or foes? Neither!(driver733.com ↗)

2 points · by driver733 · 6y ago · discuss

comment 6y ago · link · parent

That's not always the case, since Kotlin can generate Java 6 compatible bytecode.

comment 6y ago · link · parent

I completely agree. I'll make that change soon.

Thanks for the feedback.

comment 6y ago · link · parent

It can be done this way:

  result = Optional.ofNullable(nullableVariable)
                   .map(NullableType::someMethodCall)
                   .orElseGet(() -> fallbackIfNullMethodCall());

comment 6y ago · link · parent

My goal is to compare Kotlin with the current version of Java along with any Java libs that are commonly used (such as Lombok). I have mentioned the fact that some teams are still on older versions of Java just to highlight that not every developer can access the features of the latest Java release.

comment 6y ago · link · parent

You might find this article interesting. https://www.pragmaticobjects.com/chapters/001_checked_except...

comment 6y ago · link · parent

I leave it to the reader to decide whether the advantages are clear or not.

For instance, in Kotlin you can perform operations on collection without converting them to a stream first, and collecting them with a certain collector afterwards. So in order to perform a single filtering operation on a collection, you need to do three steps in Java and just one in Kotlin.

Another advantage is coroutines, which not only allow you to write asynchronous code in a common, synchronous manner, but also get rid of shared mutable state, since coroutines can send/receive shared state through channels.

comment 6y ago · link · parent

Sure, but you have take into account that Android devs are limited to Java 6, most enterprise devs (based on my experience) are still on Java 8 and some are still on Java 5 or below.

comment 6y ago · link · parent

It is, however, even in the scope of the "Hello world" app, Kotlin performs much better than Java in terms of bringing out business logic to the front.

comment 6y ago · link · parent

You are right, but you still have to catch the checked IOException.

comment 6y ago · link · parent

They will. I am in the process of updating Java code snippets to Java 11.

comment 6y ago · link · parent

To be more precise, I would say that expressive code == good code

13.

Kotlin vs. Java(kotlinvsjava.com ↗)

305 points · by driver733 · 6y ago · 321 comments

14.

Elegant Event Triggers(silasreinagel.com ↗)

1 points · by driver733 · 7y ago · discuss