-
Protected: Clear method invocation (avoid null parameters, different logic based on params)
There is no excerpt because this is a protected post.
-
Protected: @NonNull
There is no excerpt because this is a protected post.
-
Protected: How to avoid null?
There is no excerpt because this is a protected post.
-
Avoid null collections
I saw in the code patterns like this: We can use the Optional for fluent null logic: The better approach is to avoid null checking by collection initialization: Yes, more cleaner. No NullPointerException problems. The most important thing is that the code will work on non empty collection and also on empty collection! We do…
-
Protected: The ‘null’ problem
There is no excerpt because this is a protected post.
-
Protected: How to properly name the packages? – to finalize – replace picture after refactoring with more packages
There is no excerpt because this is a protected post.
-
Use the ‘final’ everywhere!
The use of the keyword ‘final’ should be the rule/best practice and the default behavior: Let’s see why: In the case of ‘simple’ types (primitives, wrappers), this is easy because we can prevent value changes. In the case of objects, we can prevent reference changes, but not to the object content. Better than nothing. In…
-
Extract a logic from collections processing
Once again, you as a developer, get a task to simplify the below code: You can simplify a little with streams: but this is not what we want to achieve, because the logic/condition is sunk in collection processing and testing is not easy and as you see, leads to testing many cases (good client, bad…
-
Functional programming styles
Your task as a developer is to write a code for selecting clients that have a good credit history and age is above 30 and live in NY city. You wrote a code like this: A senior programmer seeing your code: You know that programmers don’t express any emotion, so you start to think that…
-
What is the functional programming style
What do building blocks and programming have in common? Nothing and everything. In the programming world, we have various paradigms. For simplicity, we can call them styles. One of them is functional style. The functional style is similar to building a tower from building blocks: The basic element (building block) is a function: Functions are…