Meet Henri Tremblay, Senior Software Engineer – Terracotta, Software AG. He is Java Champion and Oracle Developer Champion. He leads EasyMock and Objenesis and contributes to Ehcache open source projects.
Find out more about his amazing story from him.
It is a great honor. You suddenly feel surrounded by highly knowledgeable people. It is also a moment mixed with pride and humility. You look with pride at what you’ve accomplished to get there. And at the same time feel humble setting aside of your new peers who made the Java ecosystem what it is now.
There are three sides of me. The open source guy who was hacking by night because he thoughts mocking easily was an important pillar of testing. The technical leader and architect who helped to build many applications. This guy tries to be a mentor. He tries to learn as many things he can. And finally, the manager, the executive that thinks at a higher level. That wants to put everything together and make it work. We tend to think people are supposed to do only one thing. That’s not true. I try to do whatever feels useful at a given moment. It can be debugging. It can be managing. It can be fun. It can be boring. It doesn’t matter. What matters is that it works. In a pragmatic and efficient way.
A long time ago, we thought abstraction was always a must. So Java was built with interfaces. These interfaces were used over pretty much any concrete class. To have a dependency on another concrete class was forbidden. The mocking frameworks are following that trend and were even trying to enforce it by only allowing interface mocking.
But pragmatic people like myself soon discovered that this practice was involving a lot of boilerplate code for interfaces that would only have one concrete implementation ever after. One day, on the EasyMock Yahoo mailing list, someone (Bob Lee) gave a “hey, we might be able to mock a class using this”. I jumped on the idea and hastily coded the first prototype. Which evolved year after year while I was discovering the JVM hidden features. Of course, I had help by many wise men and women along the way. Now, class mocking is considered normal and the techniques initially added to EasyMock are now reused in all other mocking frameworks.
The same thing happened with partial mocking. At first, someone had a badly crafted class and needed to mock only some methods on it. Most people were telling him to refactor. But if you’ve been in the field, you know we can’t always refactor everything. So I added the feature and gave it a name. There was probably some collaboration here again but I’m forgetting the details. The feature was documented with a big flag telling folks not to abuse it. I am pragmatic. When someone needs something for a peaceful purpose, I can’t see why he shouldn’t have it. Being a purist has never built a real-life application. Later on, and this frequently happens, we discovered some genuine usage for partial mocking. Today, it is seldomly used. But still, you are happy to have it in your toolbox.