The Joy Of Greenfield Project Coding - Part 3

This is a continuation of part 1 and part 2.

Interested in the whole serie?
part 1
part 2
part 3
takeaways

Proof of Concept

I decided to implement a proof-of-concept for one very important business requirement. I decided it was no use working on anything else until I prove this one is possible.

I made it work, which means the design is capable of handling such business requirements. Which is a very good thing. :)

Friends Help

I initiated another valuable discussion with my colleagues. I intended to show my team mates why something can't be done, and they proved me wrong in a minute. :)

(picture from http://whitepaintedwoman.wordpress.com)

What About TDD?

I'm doing much more testing right now (and very often it is test-first). It is much easier now, when I have (at least rough) understanding of the purpose and place of each piece.

Database

I moved some of my services from in-memory fakes to real database. I was surprised how easy it was to transform my unit tests to integration tests. Of course, the new test classes need to extends AbstractTestNGSpringContextTests and have the

@TransactionConfiguration(defaultRollback = true)

annotation, but apart from this, only one thing had to be changed.

Let us take this test:

@Test
public void shouldNotReturnProcessedEvents() {
    // given
    RawEvent event = mock(RawEvent.class);

    // when
    service.storeEvent(event);
    service.markAsProcessed(event);
    List<RawEvent> eventsForProcessing = service.getEventsForProcessing();

    // then
    assertThat(eventsForProcessing).isEmpty();
}

When changed into IT test, the only change was to create a real object of RawEvent and not the mock.

Documentation Is Useful

Not sure if anyone is going to read my documentation, but it definitely helps me now. First, it allows me to clarify my thoughts and to look from a different perspective (while coding it is easy to loose the big picture). It also helps me to find out what tasks still lay ahead.

TODOs Hunting

I have left a lot of TODOs in my code and now I spent a lot of time hunting them down. I find it fine. There was no point to deal with tiny details, and TODOs help me to remember about them.

 
 
 
This used to be my blog. I moved to http://tomek.kaczanowscy.pl long time ago.

 
 
 

Please comment using