Covariant return types

After today’s lecture of “Effective Java” from Joshua Bloch, I can share some knowledge! Looking at the previous post about Recursive Builder Pattern, You may see interesting pattern – self() method. The idea is, to override self()from an abstract/superclass and change its return type to the current type. Current means, that it is the type of the child class, which overrides the method. Well, that is the simplified definition of covariant return types in JAVA.

Recursive Builder Pattern

How to mimic self keyword in JAVA? First, check out our tutorial about Recursive Builder Pattern to understand why it is even needed.

We all know how handy is the builder pattern. Stop. Maybe not all? Do not worry, builder pattern is well explained in “Design Patterns” from O’Reilly. You will get it in 10 mins. The most important reason why it is good to have a builder is to avoid numerous parameters being passed to the constructor. The builder pattern has many variations, but for the sake of this tutorial, we will use the simplest possible form – static inner class. Take a look:

Sorting algorithms visualized – reference material

At some point in time, everybody needs to remember basic (sorting) algorithms. But how to do that? It is quite easy:

  • learn it,
  • code it,
  • from time to time, recall it – for example, by watching an awesome visualization.

The “awesome visualization of sorting algorithms”? Yes, that is the goal of this post. I found something old, but gold. Please take a look, how different sorting algorithms look like in action. Enjoy and thank You Timo Bingman for bringing such a great material.

15 sorting algorithms in 6 minutes

Remember to learn – simple?

It is sad – at first at least. You have been doing something for years, just to find out, that it is a boilerplate code. The conception was not the best, or You have reinvented the wheel. The outcome is simple – You have spent too much time on monetizing, instead of learning new, robust tech.

Don’t worry tho, on the other hand, it is a sign of progress. Sign, of going out of Your comfort zone, which actually is bad for You in the long run.

A friend of mine told me, that it is normal, and it will always be like that – devs should progress, but should not be overwhelmed by the feeling. Accept Your learning curve, admit that we make mistakes, but try to think about it in the future, to avoid stupid repetitions.

Have a good day, keep learning new things and enjoy opening Your favorite IDE 🙂