I really liked your 3 part series. Thank you for sharing. I'm not a java developer myself, but I like how java is getting onto this functional hype and the code seems a lot cleaner.
Also, from a design patterns perspective you could of used a decorator patterns with all the validations?
To encapsulate change, would you move the creation of checkWidgetTransfer to its own file so if you have to add a predicate your not changing it in the main code?
I reiterate, this is such a great example of Clean Code.
Saving fish by writing code! Applications developer in fisheries, specializing in webapps and moving 'enterprise-y' legacy systems to modern agile systems - Email or tweet me if you want to talk!
You certainly could use the decorator pattern with the validation. I'm not sure how it would play with the functional approach, but it would be interesting to take for a test drive and see.
Another pattern I thought of trying out is the chained filter pattern in the Validator class. I think that could give some richer possibilities for linking business rules together.
If I were doing this for real, I would have the related functions all in one empty class, and the methods like checkWidgetTransfer in a different class, yes. I've found functional Java tends to collect a couple classes that are empty except for functions, which felt weird at first, but where else are you going to put them?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I really liked your 3 part series. Thank you for sharing. I'm not a java developer myself, but I like how java is getting onto this functional hype and the code seems a lot cleaner.
Also, from a design patterns perspective you could of used a decorator patterns with all the validations?
To encapsulate change, would you move the creation of checkWidgetTransfer to its own file so if you have to add a predicate your not changing it in the main code?
I reiterate, this is such a great example of Clean Code.
You certainly could use the decorator pattern with the validation. I'm not sure how it would play with the functional approach, but it would be interesting to take for a test drive and see.
Another pattern I thought of trying out is the chained filter pattern in the Validator class. I think that could give some richer possibilities for linking business rules together.
If I were doing this for real, I would have the related functions all in one empty class, and the methods like checkWidgetTransfer in a different class, yes. I've found functional Java tends to collect a couple classes that are empty except for functions, which felt weird at first, but where else are you going to put them?