-
Interface means strategy
If you see an interface in the source code: what do you expect? I expect many (at least two) implementations: which we choose depending on certain conditions – such a mechanism is called a strategy pattern. Why am I writing about this? Because I have seen in many projects such code: Yes, interface and only…
-
Prefer Set over List
When you look at this code what do you think, what do you expect? I expect a collection of people with possible duplicated elements: but I saw in many projects that developers use List to store unique objects: Photo Ryan McGuire from Pixabay, Photo by Alvin Balemesa on Unsplash You may ask: is that really a problem? Yes, it is. Why…
-
Do not put elephant into function
Is it possible to put an elephant in a refrigerator? Hmmm, with the right approach, anything is possible. But why would I want to put an elephant in a refrigerator? Many programmers do not ask themselves this question and pass the elephant – a large class/object to a function and then use only one or…