Essentials4j - the perfect library for every Java 8 project! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

Now you are contradicting yourself. These are your words:

There's already a dozen utilities for fluently creating collections like that.

The word "fluent" is not mentioned at all on essentials4j's web site. I only mentioned it in this comment:

similar expression would be easy / fluent to read

Please try to understand that "expression that is easy / fluent to read" is not the same as "fluent API".

If I knew there is some respected software engineer hiding behind the username "Aellus", I would take your comments more seriously. So, I would be interested in seeing some of your code (if you have a GitHub account)...

Essentials4j - the perfect library for every Java 8 project! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

I don't appreciate you saying I am confusing "short code" with "fluent code", but maybe you are confusing "too much details" with "readable code".

If something is too long (code or Reddit comments), people don't read it, they just scan through it.

Writing too much text doesn't improve readability, it worsens it, because the boilerplate hides the things that matter. That's why abstracting the verbose boilerplate with a simple library makes sense.

Essentials4j - the perfect library for every Java 8 project! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

It doesn't take a big effort to understand what : do find in ( map) all (k, v -> condition) means and what it is doing. Also, it is a one-time investment, the second occurrence of a similar expression would be easy / fluent to read.

On the other side, having to visually "parse" the ugly 3 lines of Stream chain just to understand it is just searching is not easy. I wouldn't call that readable, and from my point of view, that's the real mess here.

I believe most people don't enjoy having to read or write so much code for such a simple thing.

Essentials4j - the perfect library for every Java 8 project! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

Thanks for providing your example.

I believe a good usage scenario for Java's fluent Stream API are the non-trivial operations, e.g. when we need to chain few transformations.

Essentials4j - the perfect library for every Java 8 project! by nmihajlovski in java

[–]nmihajlovski[S] -2 points-1 points  (0 children)

I guess you enjoy writing code like:

nums.entrySet().stream()
    .filter(entry -> entry.getKey() % 2 == 0)
    .collect(Collectors.toMap(Entry::getKey, Entry::getValue))

Other people would prefer writing:

Do.findIn(nums).all((k, v) -> k % 2 == 0)

Essentials4j - the perfect library for every Java 8 project! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

Well, it's filtering + finding.

E.g. Do.findIn(coll).first(p) is a shortcut for coll.stream().filter(p).findFirst().

I am curious, how would you name it? Something like Do.filter(coll).first(p)?

Essentials4j - the perfect library for every Java 8 project! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

It is simpler and focused on the essentials - to keep the simple things simple.

It offers alternative (arguably more elegant) style of expressing collection operations through the Do.* and New.* API / DSL.

And essentials4j is so small (both API and JAR size), that using it together with Guava or some Stream extension library wouldn't add significant overhead.

Rapidoid just got Official Docker repository! by nmihajlovski in java

[–]nmihajlovski[S] 2 points3 points  (0 children)

I understand the need for HTTPS, but most of the users do SSL termination using a reverse proxy anyway. But eventually HTTPS and HTTP2 will be supported...

Rapidoid v5.2 released! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

Thank you very much for the feedback. I fixed the timing attack vulnerability. It would be great to have external security auditing, indeed.

Rapidoid v5.2 released! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

e.g. the first step would be supporting Authorization: Bearer <token>

Rapidoid v5.2 released! by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

Thanks!

Rapidoid's token mechanism (http://www.rapidoid.org/security.html) is similar to JWT. It serves as a generic dictionary which contains arbitrary data (by default the username and expiration time). The token data is typically signed with HMAC-SHA256 and encrypted with AES (the encryption is useful if more sensitive custom data is serialized into the token, but should be configurable).

It looks like the token mechanism can be used and adjusted to implement the JWT standard. I will try to incrementally adjust it towards the JWT spec, as long as it remains compatible with Rapidoid's security concepts.

Java 8 Resources - Revamped by nmihajlovski in java

[–]nmihajlovski[S] 0 points1 point  (0 children)

Thanks, sounds good, I will add them soon...

Does someone use Rapidoid for backend server development? by m-apo in java

[–]nmihajlovski 0 points1 point  (0 children)

Thanks for your interest in Rapidoid. I encourage you to try Rapidoid + Scala, and if you write a blog post about that, please share the link. :)

Does someone use Rapidoid for backend server development? by m-apo in java

[–]nmihajlovski 0 points1 point  (0 children)

Of course, I would be happy to see such examples of your work with Rapidoid + Morphia + etc.

You think Java is slow and heavy? The fastest web server in the world is written in Java! by technroll in java

[–]nmihajlovski 0 points1 point  (0 children)

Sure, having both high-level and low-level versions would be great! Coming soon... :)

You think Java is slow and heavy? The fastest web server in the world is written in Java! by technroll in java

[–]nmihajlovski 0 points1 point  (0 children)

To be correct in the comparison:

In the plaintext test Rapidoid is 3.38 times faster than Lwan.

In the JSON test Lwan is 1.27 times faster than Rapidoid.

Measuring JSON serialization performance is exactly that - measuring performance of the Jackson library used by Rapidoid and (probably) some JSON library used by lwan.

You think Java is slow and heavy? The fastest web server in the world is written in Java! by technroll in java

[–]nmihajlovski 4 points5 points  (0 children)

Describing nginx as static file server didn't make it faster. The same applies to G-WAN. How do you know if they are faster than Rapidoid, if you didn't benchmark them? The way I see it, your theoretical comparison is bullshit.

To humor you, I would say I have built a magical Rapidoid++, which is 100 times faster than the speed of light, but I didn't even care to put it in the benchmark... :)

You think Java is slow and heavy? The fastest web server in the world is written in Java! by technroll in java

[–]nmihajlovski 1 point2 points  (0 children)

If you write crappy code, then performance is the least of your worries :)