The long way through Software Craftsmanship

Packing your own maven dependencies

Jul 30, 2015 - 2 minute read - Comments - mavenprotipjitpack

Lately, I’ve found myself repeating always the same dependencies for my pet projects and katas. Usually, I prefer maven to hold my java dependencies, organized in a java project. This is how most of them look like: <project xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <modelVersion>4.0.0</modelVersion> <groupId>com.gmaur.legacycode</groupId> <artifactId>legacyutils</artifactId> <version>0.0.1-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.3</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <scope>test</scope> <version>2.0.2-beta</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.

Tool to Find Duplicate values in Constants

Jul 30, 2015 - 2 minute read - Comments - sampletooljavaduplicategmaurlibrary

Imagine having this java class: private static class RepeatedConstants { public static final String A = "A"; public static final String A_1 = A; public static final String A_2 = "A"; public static final Integer _3 = 3; public static final Integer THREE = 3; } I wanted to remove the repeated values in the constants, in an automatic way, because the file was big (> 4000 constants). A way of doing this is basing the differences on the values, directly.

Exploring Testing with Java 8 Lambdas

Jul 30, 2015 - 4 minute read - Comments - draftjavalambdaexplorationclient

At a client, we were testing a simple feature, but the resulting tests had much subtle repetition: (source code is here) @Test public void log_when_sending_greeting_letters() { sut.send(mock(GreetingLetter.class)); verify(logger).sentGreetingLetter(); } @Test public void log_when_sending_love_letters() { sut.send(mock(LoveLetter.class)); verify(logger).sentLoveLetter(); } and the production code: public class MailSender { private final EventLogger eventLogger; public MailSender (final EventLogger eventLogger) { this.eventLogger = eventLogger; } public void send (final GreetingLetter letter) { // more business logic eventLogger.

Craftsmanship analogy

Jul 27, 2015 - 3 minute read - Comments - analogycraftsmanshipsarah-meistage

I’ve found this set of tweets about the craftsmanship analogy by Sarah Mei: Just put my finger on why the craft/workshop metaphor for software development doesn't quite fit. — Sarah Mei (@sarahmei) July 25, 2015 "Craft" doesn't build any collaboration into the process, except in a top-down control-oriented way (master, journeyman, apprentice). — Sarah Mei (@sarahmei) July 25, 2015 "Craft" casts software development as an individual achievement, just as in a workshop, the master did all the important work on each piece.