Home » Archives for Calen Legaspi

Author Archives: Calen Legaspi

Calen is CEO and founder of Orange & Bronze Software Labs (http://orangeandbronze.com), an outsourcing, consulting & training firm based in Manila, specializing in Agile Software Development, Spring Framework and Grails. He is an advocate and trainer of Test-Driven Development, Object-Oriented Design, and Domain-Driven Design.

Spring MVC Binding w/o Setters


You can bind form parameters to a domain model object even if the domain model object does not have setters. Just add a @ControllerAdvice class with an @InitBinder method that configures your application to field binding via the initDirectFieldAccess() method package boottests.controllers; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; @ControllerAdvice class BindingControllerAdvice { @InitBinder void initBinder(WebDataBinder binder) { binder.initDirectFieldAccess(); } } Here’s how ...

Read More »

The Importance of Cadence

Thousands of years ago, military thinkers realized that the only way they could effectively move thousands of troops in the battlefield was through cadence. Individual skill and bravery were often defeated by armies that were better coordinated. The reason we have Sprints or Iterations (however you want to call it) in most Agile methodologies is so that business and development move in ...

Read More »

TDD in an Economically Sensible Way

On TDD, we’re often at two extremes: At the start of a project, we’re as idealistic as many TDD authors would have us do – writing tests for almost everything. Then, as deadlines near, we drop TDD altogether, and then deliver a product with ticking production-issue time bombs. The right attitude be somewhere in the middle: Apply TDD in an ...

Read More »

Is the Service Layer Obsolete?

A few months back, I had a conversation with my colleague, Lorenzo Dee, about Service classes. “In many cases, you don’t need them… you can just have inject your Repositories straight into the Controller.” I was shocked! What kind of heresy is this! This is a violation of Separation of Concerns! Your codebase will be cursed with rigid, tightly-coupled code that ...

Read More »

Agile Myth #7: “Agile Means No Documentation”

The Agile Manifesto says, “Working software over comprehensive documentation”, and many people assume that Agile means little to no documentation. That’s not true. A well-run Agile project actually produces a lot of documentation. The difference is that Agile practitioners are conscious to create documentation that is actually readable & useful. Common sense, right? But for a lot of software development ...

Read More »

Separating Integration Tests from Unit Tests Using Maven Failsafe & JUnit @Category

Why Unit Tests Should Run Separately From Integration Tests TDD at the Unit Testing level is fairly straight-forward, since classes in unit testing either do not have complex dependencies, or you mock-out the dependencies with a mocking framework (ex. Mockito). However, TDD quickly becomes difficult when we get to Integration Testing. Integration Testing is basically testing a component with some or all ...

Read More »

Agile Myth #6: “Agile Means No Upfront Design”

This is my 7th post in my 13-part series, “Agile Myths and Misconceptions”, It’s based on the talk I gave at the first PSIA Softech Philippine Software Engineering Conference. I am striving to correct 12 common misconceptions about Agile Software Development. First of all, let me correct the notion that Agile has little to no concern about design. Many if not most of ...

Read More »

Template Method Pattern Example Using Java Generics

If you find that a lot of your routines are exactly the same except for certain sections, you might want to consider the Template Method to eliminate error-prone code duplication. Here’s an example: Below are two classes that do similar things:                 Instantiate and initialize a Reader to read from a CSV file. Read ...

Read More »