Checked vs. Unchecked Exceptions: The Debate Is Not Over

  • 1313 words
  • five minutes to read
  • comments

Do we need checked exceptions at all? The debate is over, isn't it? Not for me. While most object-oriented languages don't have them, and most programmers think checked exceptions are a Java mistake, I believe in the opposite—unchecked exceptions are the mistake. Moreover, I believe multiple exception types are a bad idea too.

Hourly Pay Is Modern Slavery

  • 613 words
  • three minutes to read
  • comments

What is the difference between a slave and a free man? A slave has a master. That master, a cruel and ruthless villain, is telling the slave what to do and punishing him at will. However, at the same time, the master guarantees food and a roof over the slave's head. A slave understands this exchange of freedom for food as a fair trade, while a free man values freedom more. That's the difference. That's how it was in the Roman empire centuries ago. But isn't that how it is now too? Aren't we ancient slaves in our offices and in front of our monitors?

Fools Don't Write Unit Tests

  • 564 words
  • three minutes to read
  • comments

"We don't have time to write unit tests" or "We don't have the budget for unit testing" are complaints I hear very often. Sometimes it may sound like, "We don't use TDD, so that's why there are no unit tests," or even "TDD is too expensive for us now." I'm sure you've heard this or even said it yourself. It doesn't make any sense to me. I don't get the logic. In my understanding, unit testing is not a product; it's a tool. You use tests to develop a product faster and better. How can you say you don't have time to use the tool that makes your work faster? Let me show you how.

Meetings Are Legalized Robbery

  • 2142 words
  • 8 minutes to read
  • comments

Software development is all about creativity, right? It's an art, not a science. As software engineers, we solve complex problems, and often our solutions are absolutely not obvious. We experiment, innovate, research, and investigate. To do all this, we talk. We sit together in our meeting rooms, Skype conference calls, or Slack channels; we discuss our solutions; we ask our coworkers for their opinions; and we argue about the best ideas. There's no doubt meetings are the key component of the modern software design discipline ... and it's very sad to see it.

Catch Me If You ... Can't Do Otherwise

  • 612 words
  • three minutes to read
  • comments

I don't know whether it's an anti-pattern or just a common and very popular mistake, but I see it everywhere and simply must write about it. I'm talking about exception catching without re-throwing. I'm talking about something like this Java code:

try {
  stream.write(data);
} catch (IOException ex) {
  ex.printStackTrace();
}

Public Static Literals ... Are Not a Solution for Data Duplication

  • 557 words
  • three minutes to read
  • comments

I have a new String(array,"UTF-8") in one place and exactly the same code in another place in my app. Actually, I may have it in many places. And every time, I have to use that "UTF-8" constant in order to create a String from a byte array. It would be very convenient to define it once somewhere and reuse it, just like Apache Commons is doing; see CharEncoding.UTF_8 (There are many other static literals there). These guys are setting a bad example! public static "properties" are as bad as utility classes.

The Better Architect You Are, The Simpler Your Diagrams

  • 1020 words
  • four minutes to read
  • comments

I don't even know where to start. Let's begin with this: If I don't understand you, it's your fault. This has to be the most basic, fundamental principle of a good software architect (well, of any engineer), but most of the architects I've met so far, in many companies, don't seem to believe in it. They don't understand that the job of a software architect is to make complex things simple, not the other way around. They use diagrams, which are the most popular instruments of an architect, to explain to us, programmers, what he or she has in mind. But the diagrams are usually very cryptic and hard to digest. What's worse is that the complexity goes up in line with their salaries—it's disgusting.

XML Data and XSL Views in Takes Framework

  • 701 words
  • three minutes to read
  • comments
badge

A year ago, I tried to explain how effectively data and its presentation can be separated in a web application with the help of XML and XSL. In a few words, instead of using templating (like JSP, Velocity, FreeMarker, etc.) and injection of data into HTML, we compose them in the form of an XML document and then let the XSL stylesheet transform them into HTML. Here is a brief example of how all this can be used together with the Takes framework.

A Few Valid Reasons to Reject a Bug Fix

  • 911 words
  • four minutes to read
  • comments

A bug exists when something doesn't work as expected. A bug fix is basically a patch (a pull request) to the existing code base that is supposed to solve the problem and make sure that "something" works as expected. Very often, such a patch fixes one thing and breaks many others. I believe that sometimes it's necessary to reject a bug fix and ask its author to re-do the patch in order to protect the project from bigger problems. There are a few valid reasons for such a rejection, according to my experience.

Good Programmers Write Bug-Free Code, Don't They?

  • 509 words
  • two minutes to read
  • comments

Good programmers create fewer bugs while bad programmers cause more. Sounds logical, doesn't it? However, there is a lot of criticism of this way of thinking. Take this one, for example: Bugs are inevitable, and instead of expecting fewer bugs from us, let us focus on the right design and let testers find and report bugs; then we'll fix them. Or this one: Being afraid to make a mistake makes me write slower and experiment less, which translates into lower-quality software. Read more about that here and here. But allow me to look at this from a different perspective and assert that yes, indeed, good programmers create fewer bugs.