Intro to Libraries - raisercostin/software-wiki GitHub Wiki
Intro to Libraries
Must know
Collections
- Java
- Guava
- vavr
- eclipse - https://www.infoq.com/articles/Refactoring-to-Eclipse-Collections/
- RichIterable in jedio (https://github.com/raisercostin/jedi-io)
VAVR
Vavr is a functional collection library. Is inspired by scala but is idiomatic to java.
- PROS
- all collections are monadic: map, flatMap, filter
- all collections have fluent interface
- CONS
- heavy (a lot of supporting operations - handling redblack trees for example)
- see https://github.com/raisercostin/software-wiki/wiki/Coding-Style#java
References
-
1st Log - The Essence of Vavr One - http://blog.vavr.io/vavr-one-log-01/
-
2nd Log - Simplifying Vavr - http://blog.vavr.io/vavr-one-log-02/
-
3rd Log - Purifying the API Surface Area - http://blog.vavr.io/purifying-the-api-surface-area/
-
vavr.io - java immutable collections - Intro to Functional
Others
Standard Java
- io (File) -
- nio (Path) - https://docs.oracle.com/javase/tutorial/essential/io
- nio2 (starting with jdk7) - https://docs.oracle.com/javase/tutorial/essential/io/fileio.html
- exceptions - https://docs.oracle.com/javase/tutorial/essential/exceptions
- concurrency - https://docs.oracle.com/javase/tutorial/essential/concurrency
- collections & streams - https://docs.oracle.com/javase/tutorial/collections/interfaces
- lambda expressions (jdk8) - https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
- java OO - https://docs.oracle.com/javase/tutorial/java/javaOO
- java language - https://docs.oracle.com/javase/tutorial/java
- springframework
- see properties - https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
- spring boot - https://start.spring.io/
- good resource - https://www.baeldung.com/rest-with-spring-series
Reactive Streams
There are multiple reactive-stream implementations
- CONS
- anti-reactive - https://nurkiewicz.github.io/talks/2018/reactive-lessons
- too hard to read
- raisercostin experience
- To many breaks of principle of least surprise.
- Operations have too many gotcha, quirks, strange or un-intuitive behaviour.
- how concat, merge differ?
- how subscribeOn, publishOn differ?
- when and how to execute subsequential, parallel
- these are also influenced by schedulers/executors
- Publishers(Flux, Mono) that aren't subscribed to do not execute and is easy to miss on this
- Operations have too many gotcha, quirks, strange or un-intuitive behaviour.
- To many breaks of principle of least surprise.
- anti-reactive - https://nurkiewicz.github.io/talks/2018/reactive-lessons
- short intro - https://www.baeldung.com/reactor-core
- slides - https://www.slideshare.net/Pivotal/project-reactor-now-and-tomorrow
- reactor https://projectreactor.io/ - best if jdk8, supported by springframework/pivotal, support in kotlin too
- nice reference - https://projectreactor.io/docs/core/release/reference/
- nice intro - http://alexsderkach.io/comparing-java-8-rxjava-reactor/
- advanced comparison of reactive streams versions - http://akarnokd.blogspot.com/2016/03/operator-fusion-part-1.html
- https://projectreactor.io/docs/core/release/reference/
- https://www.reddit.com/r/java/comments/6acxe3/spring_reactor_vs_rxjava/
- reactive streams manifesto - http://www.reactive-streams.org/ (edited)
- performance analysis - https://kamilszymanski.github.io/resources-utilization-in-reactive-services/
Commons
- apache - https://commons.apache.org
- commons-io
- last: commons-io:commons-io:2.6 - Apache Commons IO 2.6 (requires JDK 1.7+)
- https://commons.apache.org/proper/commons-io/bestpractices.html
- commons-lang - https://commons.apache.org/proper/commons-lang/javadocs/api-release/index.html
- commons-io
- guava - a utilities library used by google in android too
- last - com.google.guava:guava:26.0-jre
- https://github.com/google/guava/wiki
Logging
- best:
- logback-classic - uses slf4j - https://logback.qos.ch/manual/index.html
- slf4j - generic API implemented by logback - https://www.slf4j.org/manual.html
- second best
- log4j - deprecated by slf4j & logback - see https://www.slf4j.org/legacy.html
- not recommended
- jul - java util logging - see https://www.slf4j.org/legacy.html
- jcl - Jakarta Commons Logging - see https://www.slf4j.org/legacy.html
Configuration files
- https://12factor.net/config
- https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
- use
hocon
- https://github.com/lightbend/config - http://javaeeconfig.blogspot.ro/2014/08/overview-of-existing-configuration.html
- compare & samples
- https://github.com/Netflix/archaius/wiki/Features
Working with time
java3
-java7
- use
joda-time
library:
- use
>java8
=> use java.time package (JSR310)- http://mattgreencroft.blogspot.ro/2014/12/java-8-time-choosing-right-object.html
- Joda Time author explains some design decisions in JSR-310 - https://blog.joda.org/2009/11/why-jsr-310-isn-joda-time_4941.html
Testing Libraries
- assertj
- junit5
- junit5 + hamcrest - https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-writing-assertions-with-hamcrest/
- mockito - https://site.mockito.org/
- mutation testing - http://pitest.org/
- Intro to Tests
- deprecated
- junit4 - junit5 much more features, extensibility etc
Others
- Dependency Injection: spring/guice
- mapstruct - http://mapstruct.org/
- client app: command line interpretor - CLI
- suggested by guava - https://github.com/google/guava/wiki/FriendsOfGuava
- standard java - https://docs.oracle.com/javase/tutorial/
- https://github.com/a36069/theBestOfJava