3 ms·
Agreed. A major red flag is the omission of generics usage on their methods. Just using List or Collection without type parameters is just dangerous and very ba
by b15h0p 10y ago
Agreed. A major red flag is the omission of generics usage on their methods. Just using List or Collection without type parameters is just dangerous and very bad advice for a novice programmer seeking enlightenment for Java 8 programming.
- misja111 10y agoIt looks like the generics used to be there but have been removed. Because there is one generic type 'T' left in the implementation of ClassUtils.setIfNotNull. So about this setIfNotNull: I don't understand why this method is used in updateEntity. To me it seems the accountType property in the dto can be set with whatever is in the entity, null or not null. And of course, Java 8 has introduced the Optional class as a better way of dealing with null values, so why bother writing a workaround at all?
- hepta 10y agoI see now, probably just something to do with formatting/escaping, the <> are being swallowed. Yes, it's strange. I'd prefer to map a null in a DTO to an empty optional. I'd like even more to never have nulls in the dto in the first place.
- hepta 10y agoI assumed the omission was for brevity, but there are annotations and 'final' in a lot of places. Similarly, methods for mutation (compulsory, no less!) are red flag in FP.
- john_reel 10y agoAs someone who isn’t familiar with functional programming at all or too familiar with Java, where do I start?
- odabaxok 10y agoHow about https://www.coursera.org/learn/progfun1 https://www.coursera.org/learn/progfun1 ?
- hepta 10y agoDepends on your goals, Java isn't the best if your aim is to learn FP.
- ptero 10y agoUnless you have a strong reason to use Java, I'd stay far out of it in learning FP. Pick a language where FP model fits well into the language core (e.g., ocaml, Haskell; google for other options), not glommed on as an afterthought to a general purpose language.