Home » Author Archives: Marco Castigliego

Author Archives: Marco Castigliego

Friday-Benchmarking Functional Java

java-logo

Lets image our product owner goes crazy one day and ask to you to do the following : From a set of Strings as follows : "marco_8", "john_33", "marco_1", "john_33", "thomas_5", "john_33", "marco_4", .... give me a comma separated String with only the marco's numbers and numbers need to be in order. Example of expected result : "1,4,8"     ...

Read More »

Migrate your project from SVN to Git Stash in few steps

git-logo

Step by step guide on how to migrate your SVN repository with all its history to the Stash, the Atlassian git manager.                   Only once : add the ssh key open a terminal create the authors.txt file in ~/Documents/ git config svn.authorsfile ~/Documents/authors.txt authors.txt format : username = Name LastName <email> example ...

Read More »

Java 8 : Functional VS Traditional

java-logo

The business logic is the same : Given a String expression composed of visits / time like : “1/24h,1..3/3h,5/*” Then the result should be the following list of Strings: “1/24h”, “1/3h”,”2/3h”,”3/3h”, “5/1h”,”5/2h”,”5/3h”,”5/4h”,”5/5h”,until ,”24/1h” So, 2 things need to be solved, the dots and the stars for the visits and for the time. I will use Java 8 , but  I’ll ...

Read More »

Why you should not work extra hours

software-development-2-logo

There are pros and cons in working extra hours or over time regularly, here is an attempt to list them all. Some are well known, some are taken from my experience, if you know other reasons just comment and I’ll include them in the list.                 CONS: You are going to introduce bugs  ...

Read More »

Funny Bugs types

software-development-2-logo

Incompatible classes when you try to deserialize files generated with old code… Wrong URL setting when you put a wrong rest url in your property file and you receive no messages… Too verbose xml messages when SLAs are not met because your XML messages are too big wasting time in serialization and deserialization… Production with no tests when you go ...

Read More »

Access private fields in unit tests

junit-logo

First of all, let me say out louder, you need to design your code to be testable, so you test your private fields through your public methods. But, (“buts” are the reasons why humans are still programming instead of the computer itself, so be happy here) sometimes you want to and should alter some private fields in order to test ...

Read More »

Testing Spring components with Mockito

mockito-logo

Be able to unit test your spring components without the need of loading the full spring-context with its ad-hoc test configurations it is ,in my opinion, a great advantage because it’s clean, easy to maintain, faster to write, smooth to alter. A way to achieve this goal is to use Mockito and tell him to replace the @Autowired components in ...

Read More »

Garbage Collector guidelines and tips

java-logo

These are some of the guidelines and tips I usually look at when I need to tune the GC. Are mostly taken by the following 2 books and few of them from my experience: Java Performance JBoss AS 5 Performance Tuning Hopefully they will be useful for someone else out there! Garbage Collector XX:+AggressiveOpts sets a HotSpot internal boolean variable ...

Read More »

Building smart Builders

java-logo

When building an API, you should always think about who is going to use it. When the API is simply and clear to use, then the users are happy. When the users are happy then everyone is happy too. But great usability is not always easy to achieve. There are patterns that help on this, on this post I will ...

Read More »

Even in the jdk there is bad code

java-logo

Java 7, TreeSet and NullPointerException. Recently I tried to compile with java 7 a project developed with java 6. Lot of fun happened during tests execution, tests that in java 6 were  running smoothly, with java 7, they were strangely failing! So, I had to understand why and this is what I discovered… The context first: In that project I have a ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close