danieldietrich on v1.0.0
Fixes malformed .travis.yml (#2… (compare)
danieldietrich on v1.0.0
Simplification (#2367) (compare)
danieldietrich on travis-yml-fix
Fixes malformed .travis.yml (compare)
Personally, I think the most confusing part of Java is that it does not allow us to formulate concepts using structures. Java requires us to formulate concepts using names.
For example, a functional interface might have the apply
method. But it could be also foo
, bar
or baz
. But it really is just an application of arguments, like we do it with methods (arg1, ..., argn)
. That is really evil and makes Java hard to read.
var e = fn(e1)(e2)(e3)(e4)(e5)
For
. Eventually I think I'll go with nested flatMaps, as it doesn't look too bad and does the short circuiting on intermediate errors, which is the most important thing to me in this case
Array
?Hi @danieldietrich I found these ideas interesting
http://blog.vavr.io/opinionated-database-access-in-java/
Did it have any continuity? Just for curiosity :)
But I see JDBI still uses String to describe DB queries, which is not safe:
jdbi.withHandle(handle -> {
handle.execute("CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR)");
while the Daniel's post shows an API to do it programatically in a safer way:
cust.insert(
cust.NAME.set(name),
cust.NUMBER.set(number)
);
I think it has a similar approach like jOOQ but Lukas Eder once talked about differences - years ago, I can’t remember it. But I think it had to do with dialect support. jOOQ supports them all. But Oracle support for example is a paid feature, which is ok!
In fact, it would be tempting to create a SQL DSL with tight Vavr integration. The same applies to GraphQL and Neo4j.
Congrats, Gerard :))
Kotlin also seems to have pretty mature solution, like https://github.com/JetBrains/Exposed
There is nothing wrong with if/else. Your save method returns nothing, we say it performs a side effect (otherwise it would do nothing). Using if/else is the Java way.
Functional programming is about values and expressions. A ternary operator we be fine solution then. Or you refactor your logic to a function.
Also take a look at the new switch expression of Java 14+ version!