-
Recent Posts
Archives
Recent Comments
Author Archives: Eric Lefevre-Ardant
Cyber Dojo for teaching TDD
I’ve been teaching “Agile Projects” (yes, the title does feel a bit strange) to undergraduate students for a few years, and I’ve always took that opportunity to spend half a day on TDD. That meant me demo’ing a test-first implementation … Continue reading
Posted in tdd
Comments Off on Cyber Dojo for teaching TDD
Introducing computers to kids in kindergarten
A couple of weeks ago, I organized a workshop based on MaKey MaKey from the 20 children in my daughter’s class in kindergarten. The children were born in 2009, so were around 5 years in age. The plan was to demystify computers … Continue reading
Posted in personal
3 Comments
Avoid branches in test code
Tests should describe a linear story, as opposed to production code. What things we start with, what we do with them, and what we get. Some call this the Given/When/Then pattern, others the Arrange/Act/Assert pattern. This means that the code … Continue reading
Posted in java
Comments Off on Avoid branches in test code
Test with a test framework idiomatic to your programming language
Code in Java, test in Java. With JavaScript, test in JavaScript. Ideally with a test framework that lets you write your unit tests in a way that does not feel contrived or constrained compared to writing production code. For example, … Continue reading
Posted in test
Comments Off on Test with a test framework idiomatic to your programming language
Name test methods with underscores
In production code, common coding standards for Java recommend writing method names in CamelCase. retrieveUserDetails() createABankAccount() This makes sense when those methods are called from our own code. It feels as if requests are being made to these objects (dear … Continue reading
Posted in java
Comments Off on Name test methods with underscores
Default JDK file encoding and Eclipse, running on Mac OS X
File encoding is notoriously a difficult problem for developers to fully grok. Development environments and IDEs do not always help. I recently had a test failing under Eclipse, whereas the same test was passing fine in the command line using … Continue reading
Posted in java
Comments Off on Default JDK file encoding and Eclipse, running on Mac OS X
A classic case of Data Envy
TL;TD: Refactoring classes that have data envy is easy. Do it. Here is a snippet extracted from the last project I worked on: // somewhere in a class asset.setHasAssociatedImage(!StringUtils.isBlankOrNull(imageName)); asset.setImageName(imageName); // in another class if (asset.hasAssociatedImage()) { image.setUrl(categoryName + “/” … Continue reading
Posted in java
4 Comments
Avoid annotations with Mockito
On the Mockito mailing list and on Stackoverflow, there are a significant number of questions that actually reveal that the person asking did not perfectly understand what the Mockito annotations do. Indeed, the annotations are rather magical and their behavior … Continue reading
Posted in java
8 Comments
[Musings] Hot Chocolate for the Busy
I used to think that the only way to heat milk properly for preparing hot chocolate was by using a saucepan. I eventually decided to experiment with a microwave oven.
Refactoring to Fantom
This post in an introduction to Fantom via the refactoring of Java code. TL; DR: Fantom is basically a better Java with a very similar syntax, but with lots of little simplifications and some powerful features such as functions.
A novel way to spam blogs for SEO
On March 18th, I received the following email: On 18 March 2012 16:26, Jen Rhee <thisisjenica@gmail.com> wrote: Hi Eric, I came across your site and wanted to share my infographic about Wikipedia and how it’s redefining the way we research. … Continue reading
Posted in misc
Comments Off on A novel way to spam blogs for SEO
Io Language: adding slots to messages
Week 2 of the Seven Languages in Seven Weeks book is about the Io Language. Day 3 is more specifically on how the flow of control (how messages are passed to an object or to its parent) can be hijacked … Continue reading
Posted in misc
Comments Off on Io Language: adding slots to messages
Create hidden files in Apache VFS with the RAM filesystem type
Apache VFS is a great way to access different file systems in the same way. I particularly like the custom RAM filesystem in my unit tests in order to check code that eventually accesses the actual file system. For example: … Continue reading
Cleaning up test code
My former colleague David just posted an example of verbose test code on his blog (the parts in French have been translated to English by myself): /** * */ @Test public void testGetCustomerOK() { LOGGER.info(“======= testGetCustomerOK starting…”); try { CustomerDTO … Continue reading
Posted in java
3 Comments
More data on productivity of small teams
“Adding manpower to a late software project makes it later”. The so-called Brooks’s Law on productivity of software project is well known, since Fred Brooks’ seminal work The Mythical Man-Month, first published in 1975. That is one of the reasons … Continue reading
Posted in java
3 Comments