by Alberto Savoia Early one morning, a programmer asked the great master: “I am ready to write some unit tests. What code coverage should I aim for?” The great master replied: “Don’t worry about coverage, just write some good tests.” The programmer smiled, bowed, and left. … Later that day, a second programmer asked the […]
Category: code
What I’ve learned in 365 days @ Pivotal Labs
365 today! Today is my first year at Pivotal Labs and for that reason I decided to write down my experience. After a year it makes me more clear to me to think all the good things I’ve been experiencing here so far. Big and small Pivotal Labs was founded in 1989 and it’s an agile software development consulting firm […]
Kotlin: Statically typed programming language for the JVM, Android and browser
Hello! I’m writing these series of articles as I learn the language – My plan is to cover some aspects like: what, why, pros, cons, highlights on the language reference, functions / lambdas and some practical examples using spring boot. So lets start from the basic in this first post (sorry, no code at this time). What is […]
Curry and Groovy
No, this is not about a dish originating in the cuisine of the Indian Subcontinent. It’s about Groovy Closures. Yeah, science! Currying is the Groovy’s partial function application making clones of functions, fixing values for some of the parameters and producing new functions with smaller arity* – in other words: new function accepting less argument(s). It’s possible to fix one or more parameters […]
Spock test framework, live long and prosper.
Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers. Spock is inspired from JUnit, jMock, RSpec, Groovy, Scala, Vulcans, […]
Groovy functional sugar: Trampoline
Based on Gr8-Docs, recursive algorithms are often restricted by the maximum stack height (physical limit). If you call a method that recursively calls itself too deep, you will eventually receive a StackOverflowException. An approach that helps in those situations is using Closure and trampoline capability. The trampoline() method on a closure is wrapped in TrampolineClosure […]
Cookie code: overriding and getting back the method behavior
Working with Stub and Mock objects in Groovy has been a very interesting (and fun) task to me. Today I needed to modify a method’s behavior for an integration test avoiding unnecessary remote calls however the next test should be performed using the remote behavior (strange, but…). So, for this solution I simply changed the […]
Meet JHipster!
Meet JHipster, a new (or not) generator with all modern/hype frameworks to create your web app! Main goals { A high-performance and robust Java stack on the server side with Spring Boot; A sleek, modern, mobile-first front-end with AngularJS and Bootstrap; A powerful workflow to build your application with Yeoman, Bower, Grunt and Maven / Gradle. } 20 minutes […]
Managing dependencies in groovy scripts
Imagine you want to write a Groovy script and this script uses a the 3rd party library. How to do? There are some solutions, such as: 1) Bootstrapping groovy with bash in the groovy script: #!/bin/bash //usr/bin/env groovy -cp extra.jar:some-spring-jar.jar:etc.jar -d -Dlog4j.configuration=file:/etc/myapp/log4j.xml “$0” $@; exit $? import org.springframework.class.from.jar //… code goes here… println ‘Wicket!’ 2) […]