The agile waterfall

Sounds like a BS post, doesn’t it? Agile processes are like XP, Scrum, Kanban, etc. Waterfall is not an agile process, period.

Well, actually… The agile manifesto values Individuals and interactions over processes and tools. Then, let’s take a look beyond processes! Continue reading

Posted in programming, soft skills | Tagged , , , | Leave a comment

Why you should lie on a job interview?

This is an old advice: don’t lie on a job interview. The reasoning goes like this: don’t lie on a job interview because you’ll get caught and id impairs your relationship with your employer. They might even fire you.

This is a really good advice, as long as you’re seeking a job. If you’re an employer, then this doesn’t apply to you. You should lie instead. Here is why:

Continue reading

Posted in soft skills | Tagged , | Leave a comment

The ultimate java Tuple

The idea came to me via this SO question. The is a question about generics. Probably it’s too much foreshadowing in a technical blog, but this post is about generics too.


First thing first: what’s a tuple? It’s a mathematical buzzword for ‘one-thing-and-another’. We call it a pair, right? Mathematicians like to have their definitions generalized. No wonder, the Tuple is a little more than a simple pair. Continue reading

Posted in java, programming | Tagged , , , | Leave a comment

Can anyone write clear specification?

I’m a skeptical engineer who thinks, specification / documentation is never ever obvious. I believe the unambiguous and comprehensive stuff is code, not documentation. When I say unambiguous, I mean the computer can interpret it in only one way, yet people can easily misunderstand it.

We can observe this problem in mathematics too! Continue reading

Posted in java, programming | Tagged , , | Leave a comment

Testing a subclass-as-wrapper

The problem

I’m working with an oldie-but-goodie framework. This framework has some interesting naming conventions. Say for instance, they call subclasses wrappers. We can use subclasses and wrappers for the same thing. However, one of them is more testable than the other.

Let’s see the similarities first. Suppose you have a MessageProcessor class and that has a transformMessage method: Continue reading

Posted in java, programming | Tagged , , , , , , , | Leave a comment

Just a little scripting

Scripting on Windows

There’s this flame war between Linux and Windows. Like Linux is user-friendly, it’s just more selective with its friends. Another one is, that it’s easy if you don’t mind clicking. Windows 10 contains a bash shell, still, this won’t end just now.

So, there is this flame war, old and still funny. But this post is about something else. I’m trying to explain why I always install a cygwin / mingw on a corporate windows box.

Obviously, I install them because we’re not using Windows 10 yet. Also, I’m installing mingw because git-bash is based on that. Still, this isn’t the real reason.

Why is it useful?

The real reason is that I can solve complex problems quickly. Say for instance, the jd-gui had some problems. It couldn’t decompile some classes and it wouldn’t save all the decompiled sources either. I could’ve downloaded some other versions and played with them. However, I already had mingw and procyon on my machine so I started to write a for loop. In a couple of minutes I had this:

cp -r classes sources # this creates a paralel directory structure
find sources -name '*.class' | xargs rm # this removes the class files

# a for loop through the classes. I could've excluded the inner classes too..
for f in `find classes -name '*.class'`; do
  # creating the name of the destination java file
  j=`echo $f | sed -e 's/^classes/sources/g' -e 's/.class$/.java/g'`; 

  # invoking the decompiler
  java -jar /f/Programs/decompilers/procyon-decompiler-0.5.30.jar $f > $j;

The point here isn’t the code. Bash can do loops, branches, and other stuff in a weird way. The point is that I could substitute some gui functionality with some code in a couple of minutes. It took as much as starting up eclipse and creating a new project.

It’s not only useful. Writing code seeing it run instantly – it’s almost magical. Others might prefer the REPL for Lisp, python, powershell or ruby. Still, bash is the most ubiquitous from all above.


So, I wrote this one-time script. There are a few enhancements I could’ve made.

I.e. this is how you can filter out the inner classes from the decompiler loop:

for f in `find classes -name '*.class' | grep -v '\$'`; do

But deleting them isn’t much harder either:

find . -name '*.java' | grep '\$' | xargs rm

I can also mass-edit the decompiled classes:

# a loop for the java sources
for j in `find src/ -name '*.java'`; do
  # retrieving the java class name from the path
  f=`echo $j | sed -e 's/^.*\///g' -e 's/.java$//g'`;

  # creating the command - it will be useful for debugging
  cmd=`echo "sed -i 's/\b$f\.//g' $j"`;
  echo $cmd; # some feedback during the script run
  eval $cmd; # invoking the actual command

Other approaches

As you can see, I’m using sed and command substitution extensively. There might be other approaches that I’m unfamiliar with. Still, these tools help me a lot to solve complex problems quickly.

What now? We can follow @climagic. We can learn how to parametrize procyon to do what we want. I could learn awk.

What are your favorite command-line tools? How could you improve these scripts?


Posted in programming | Tagged , , , , | Leave a comment

How to deal with criticism

In the previous post we saw how we can help a low performer to work better. In this post we’ll see the flip side of that story. Sometimes you’re at the receiving end of this help. Which is, very bluntly, criticism. You need to be able to deal with that.

There are several types of feedback. I’ll show you here how to deal with them. Continue reading

Posted in programming, soft skills | Tagged | Leave a comment

How to help a teammate up

Software is a crazy industry. Requirements are changing quickly. Technologies are changing even faster. Customers generally cannot specify what they want. No wonder some of us fail to do their job well.

Salaries are high, professionals are valued high, which attracts people with various personality disorders. Programming is some sort of trance, which attracts people with other kind of problems. No wonder we usually cannot help the ones who are left behind. Continue reading

Posted in soft skills | Tagged , , | Leave a comment

How to program by coincidence – five techniques to ruin your programming carrer

No idea what I’m doing

The Pragmatic Programmer book popularized a term: programming by coincidence. According to the book, it means that you write code that you don’t understand. So it works but you don’t know why. Consequently, if when it fails, you don’t know why either.

I used to believe that the only use of this term was to insult your coworkers. Saying “You’re programming by coincidence.” literally means this meme.

I don’t believe that anymore. I discovered a couple of techniques that help smart programmers like yourself to program by coincidence. I’m sharing them with you for $200. Here they are:

1. Copy and paste

This is a classic one. Whenever you find a problem, then google it. If you find a page, copy the code and paste it into your IDE. See if it works.

If you see two lines of code, you will have the urge to look up the idioms in the API docs. Don’t do that. Just add the code and see if it works.

More advanced users can copy code from the current code base. This is very useful because you can copy tens of lines of code. You can keep deleting stuff until it works.

Pro tip: you can paste SQL code to a jdeveloper connected to the production machine.

2. Ignoring stack traces

What do you do when your code fails? You have a stack trace that doesn’t fit into the screen. Ignore it.

Never ever read the stack trace. You can read the first line if absolutely necessary. So you’ll know see whether it’s a NullPointerException or just AnyOtherException.

If it’s a NullPointerException, just add some null checks. Otherwise you can tweak a loop index. Or paste something. Or comment out a method.

Do whatever you have to do to make the exception go away. That something can break a feature – but hey, that’s somebody else’s problem.

Pro tip: never ever learn, how to read an exception.

3. Ignorance is bliss

Don’t learn the frameworks you use.

If you don’t learn your frameworks then you can think out of the box. Say for instance, you can paste JPA queries into your jdeveloper, then complain that this SQL doesn’t work.

You shouldn’t learn your version control systems either. Just find a good UI that helps you to get by. When you really messed up, somebody will help you clear up the mess.

4. Confidence

When you don’t know how a framework works, then you can guess. You can call these guesses assumptions so you’ll sound smart. The trick is that you never ever need to test your assumptions. Just say aloud what you think and program accordingly.

If your assumption fails then blame the framework. It’s difficult to understand, isn’t it?

5. No automated tests

You shouldn’t write unit tests either. Unit tests give you quick and accurate feedback. Unit tests could tell you which method does what.

Pro tip: if you have to write unit tests, then make them long. It can be more complicated than the code its testing.


Yes, it’s sarcasm. If it hurts then probably you need to revise your practices.

Unless you’re a beginner. It’s OK for a novice programmer to make these mistakes. Just try to get over them in a couple of years.

More antipatterns

Did I miss an antipattern? Please let me know in comments.

Posted in programming | Tagged , | Leave a comment

Preparing too much for a job interview

Everybody agrees that we should prepare for a job interview. We shouldn’t be shocked by questions like “What’s your five greatest weakness?” or “What’s your salary target?”. Refreshing our memories about frameworks that we haven’t used for years – that can be useful too.

On the other hand, if you need to prepare for a month or so – that looks too much for me. Maybe you’re trying to cover too much. Maybe you want to sell yourself as more expert than you actually are. E.g. learning trick questions and answers in a language you hardly used – it’s cheating. Continue reading

Posted in soft skills | Tagged , | 2 Comments