Isolation with jMockit: Stub out System from Java JRE

In general I prefer to wrap up system functions so that I can inject test doubles and test drive my designs easily. In general is not a good idea to mock objects you don’t own. But this time I was doing some research, preparing one edition of my Online Training...

Do not create unnecessary methods

Methods should be short, from 1 to 7 lines of code, maximum 10 in some cases (with the exception of some algorithms). Because a method does just one thing its name should describe it precisely. But it should not contain implementation details (like data types). The...

Return: get out as soon as possible

I believe the idea of a single exit point for functions comes from the 70’s. A function used to have only one exit point, a single return statement. I still see some developers doing this but it’s not a good idea. As soon as you have found what you were...

WebSockets and Android

I didn’t know that the default browser installed on Android is called Webview. I haven’t created any native Android app ever. But I wanted my web app to run on Android using Websockets. Unfortunately, websockets are not implemented in Android Webview. In...

London Tester Gathering Workshops

Next week, I’ll be taking part in the London Tester Gathering Workshops at SkillsMatter. I’ll be giving a 4 hours workshop on JavaScript aimed at software testers on Thursday. Inspired by the workshop, I am working on a JavaScript manual for testers...

A week in the UK

Talking at SkillsMatter Last week was very intense indeed. I gave my first talk at Skills Matter (video here). BDD for RIAs with JavaScript – Skills Matter from Carlos Ble I must say I am not content with my talk because my English was rubbish but on the other...

Push the query down: Tell, don’t ask

“Feature envy” is a typical code smell in Object Oriented Programming. It can be appreciated when code talking to an object accesses directly to that object’s fields or properties, from the outside, breaking the encapsulation. // feature envy:...