Home » Author Archives: Sebastian Malaca

Author Archives: Sebastian Malaca

Sebastian is an OOP enthusiast. He constantly deepens his knowledge in topics related with clean code and code quality. He's also speaker and contributor to several blogs about software development.

Lazy-loading is a Code Smell

Have you ever seen those huge objects with many attributes? These domain objects where we are using lazy-loading because we do not want to retrieve too much information from the database? I bet you’ve had this doubtful pleasure. Today I want to share with you my impressions about them – using lazy-loading should be treated as a code smell! Let me ...

Read More »

Do you really need instanceof?

Using instanceof is a code smell. I think we may agree on that. Whenever I see a construction like that I’m sure that something went awry. Maybe someone just didn’t notice a problem when making a change? Maybe there was an idea, but it was so complex that it required so much effort or time that a developer made a ...

Read More »

Pair Programming for the rescue!

Those of you who’ve already read some of my articles have probably noticed that I’m sort of a developer that is extremely passionate about code that is clean. The reason behind this fanaticism is not my fascination with pure beauty because I’ve never treated code as art as such. I’m so much focused on writing clean code and maintaining code ...

Read More »

Many parameters and lost information

The less code, the better? The fewer objects, the better? Is it true? As usual, it depends. There are cases when by adding something more we are adding unnecessary complexity. It happens when we are creating interfaces or other abstractions just because “we may need this additional flexibility in future”. It happens when we forget about YAGNI principle and we are writing ...

Read More »

Conjunctions we… hate

Recently I’ve written about implementation-related names and I’ve presented a few examples where the method name was incorrect because of its strong relation with the body. At one moment, we had the following code: boolean isComplexOrUnreadableWithTests() { return (complex || unreadable) && tests.exist(); } Just to remind you of the context: it was supposed to find out whether we may ...

Read More »

The name should express the intention

This time I will start with a code sample. Take a look at this: if (code.isComplexOrUnreadable()) { refactor(code); } Can you tell me what is wrong with this code? No? Let me ask you another question then. How do you think the implementation of isComplexOrUnreadable() method looks like? I assume that many of you would imagine something similar to this: ...

Read More »

Should you follow the rules?

In the last article I wrote that I’m a big fan of tools for static analysis. Those tools help you follow established rules. To be more specific, they’re yelling at you through red builds whenever you break these rules. Isn’t it great? Before your code gets under the review, we are already sure that many things have already been checked and ...

Read More »

Code Review and Single Responsibility Principle

According to the Single Responsibility Principle each unit in our code should have only one reason to change. Code Review, on the other hand, is a technique that helps us improve the quality of our code and increase its readability. I believe that you know both the principle and the technique. The question is: why do I juxtapose them in one article? Well, if ...

Read More »

First for test, second for implementation!

Test-Driven Development is a great technique, isn’t it? Today I want to propose you an experiment that may help you convince all of those struggling developers that writing code in such manner really improves your code and development. What is the experiment about? It’s about only one, tiny commit which will force you to practice this technique for some time. ...

Read More »

@Autowired all the things!


Recently I have written that @Autowired annotation make our lives easier in that it allows us to write less code. However, using it may often make your design more complicated. Especially when we are talking about using it on class’s properties. It makes it easier to violate Single Responsibility Principle. It makes it easier not to notice that. It is ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns