-
Notifications
You must be signed in to change notification settings - Fork 5
Tasks_To_Do
OK, let´s start with the workshop. First of all, we need the basic structure for this workshop. Please clone the basic structure from the given link to the git - repo.
- add to the project
- add the dependencies to the projects
- create some tests into the class called
HelloWorldServiceTest
- let the mvn clean test run inside the docker container
- check the coverage report
- create the mutation coverage report
- check the coverage report
We are now ready to work with the different jdk´s in parallel.
Extract the logic from and formulate it generic;
-
Replace all anonymous classes with lambda expression.
-
Replace for-loops with Streams
-
create an interface with the name ImageFunctions
-
transform the oo style ImageUtils to a functional style ImageFunctions
-
byte[] failedImage(String imageID)
toFunction<String, byte[]> failedImage()
- replace the usage of the method failedImage with the function
- convert methods for filename creation into functions
- convert
imageAsStreamRessouce
into a function and replace the usage - convert
ImageUtils
intoImageFunctions
completely including usage
-
-
refactor the filter classes to functions
- create an interface called
FilterFunctions
- create
Function<BufferedImage, byte[]> toByteArray()
to extract repetitive code from filters - create
Function<byte[], BufferedImage> toBufferedImage()
to extract the image read- use the function
toBufferedImage
- remove the try catch block, exception will lead to a failed image
- use the function
- convert all filter classes to filter functions at
FilterFunctions
- convert method imagePanel -> function imagePanel
- move factory function into ImagePanel (static)
- create
Function<String, StreamResource> imageAsStreamRessouceNonCached()
- create an interface called
-
start using
Result<T>
,Case
, data classes and checked functions- switch Info to extends Sext<String, String, Boolean, Boolean, Boolean, Boolean>
- convert the thumbnail creation to a functional style based on
Case
andResult
- convert if - blocks for image creation into a functional style
- don´t optimize, write it clean even if you are calculating something twice
- use now Memoizing to remove unnecessary calculation for example done by filters (grayscale/points/..)
-
compare your result with others, start discussing
-
first refactorings
-
replace all if statements inside the stream int ?: statements if possible
-
extract the part that is building the transformation function
- use the functions from the functional JDK8 version
- extract a function that will build the transformation function
- build first the function that will use grayscale/pointerize and rotate
- add a curried version of the resize function
- decide what will be the right input Type
- move the method for creating the transformation function into the interface
FilterFunctions
- reuse or create new a Function to read the Image itself from HDD
-
extract the CPU and IO intensive parts into a Function that will transform into a
CompletableFuture
-
-
serverless monolith
- create the following modules
- init the monolith module
fn init --runtime=java --name javaevents/frp-jdk09-monolith
Vaadin UI -> reduce code with var connect to FnProject
FRP is possible since JDK8 JDK9 is not a big thing, maybe locale pub/sub JDK10 with var - good for oo style JDK11 will var for lambdas - good for FP style
for feedback or questions :
- Twitter : @SvenRuppert
- email: sven.ruppert (a) gmail.com