Why “Agile” and especially Scrum are terrible

Michael O. Church

It’s probably not a secret that I dislike the “Agile” fad that has infested programming. One of the worst varieties of it, Scrum, is a nightmare that I’ve seen actually kill companies. By “kill” I don’t mean “the culture wasn’t as good afterward”; I mean a drop in the stock’s value of more than 85 percent. This shit is toxic and it needs to die yesterday. For those unfamiliar, let’s first define our terms. Then I’ll get into why this stuff is terrible and often detrimental to actual agility. Then I’ll discuss a single, temporary use case under which “Agile” development actually is a good idea, and from there explain why it is so harmful as a permanent arrangement.

So what is Agile?

The “Agile” fad grew up in web consulting, where it had a certain amount of value: when dealing with finicky clients who don’t know what they…

View original post 3,300 more words

Advertisements

EAGER fetching is a code smell

Vlad Mihalcea's Blog

Introduction

Hibernate fetching strategies can really make a difference between an application that barely crawls and a highly responsive one. In this post I’ll explain why you should prefer query based fetching instead of global fetch plans.

Fetching 101

Hibernate defines four association retrieving strategies:

Fetching Strategy Description
Join The association is OUTER JOINED in the original SELECT statement
Select An additional SELECT statement is used to retrieve the associated entity(entities)
Subselect An additional SELECT statement is used to retrieve the whole associated collection. This mode is meant for to-many associations
Batch An additional number of SELECT statements is used to retrieve the whole associated collection. Each additional SELECT will retrieve a fixed number of associated entities. This mode is meant for to-many associations

These fetching strategies might be applied in the following scenarios:

  • the association is always initialized along with its owner (e.g. EAGER FetchType)
  • the uninitialized association…

View original post 717 more words

Logical vs physical clock optimistic locking

Vlad Mihalcea's Blog

Introduction

In my previous post I demonstrated why optimistic locking is the only viable solution for application-level transactions. Optimistic locking requires a version column that can be represented as:

  • a physical clock (a timestamp value taken from the system clock)
  • a logical clock (an incrementing numeric value)

This article will demonstrate why logical clocks are better suited for optimistic locking mechanisms.

System time

The system time is provided by the operating system internal clocking algorithm. The programmable interval timer periodically sends an interrupt signal (with a frequency of 1.193182 MHz). The CPU receives the time interruption and increments a tick counter.

Both Unix and Window record time as the number of ticks since a predefined absolute time reference (an epoch). The operating system clock resolution varies from 1ms (Android) to 100ns (Windows) and to 1ns (Unix).

Monotonic time

To order events, the version must advance monotonically. While incrementing…

View original post 638 more words

A beginner’s guide to JPA/Hibernate flush strategies

Vlad Mihalcea's Blog

Introduction

In my previous post I introduced the entity state transitionsObject-relational mapping paradigm.

All managed entity state transitions are translated to associated database statements when the current Persistence Context gets flushed. Hibernate’s flush behavior is not always as obvious as one might think.

Write-behind

Hibernate tries to defer the Persistence Context flushing up until the last possible moment. This strategy has been traditionally known as transactional write-behind.

The write-behind is more related to Hibernate flushing rather than any logical or physical transaction. During a transaction, the flush may occur multiple times.

The flushed changes are visible only for the current database transaction. Until the current transaction is committed, no change is visible by other concurrent transactions.

The persistence context, also known as the first level cache, acts as a buffer between the current entity state transitions and the database.

In caching theory, the write-behind synchronization…

View original post 414 more words

Setting up Wildfly8 Cluster in 5 minutes with Chef and Vagrant

Hi! This is my first post of this blog and I would like start with my last cookbook “wildfly-clu”.   We will create a simple Wildlfy cluster(domain mode) composed by 3 servers. For this test I will use CentOS release 6.3 (Final).

Final result:

You can reach the app directly from the nodes:
http://myserver1:8080/helloworld/
http://myserver2:8080/helloworld/
http://myserver3:8080/helloworld/

WILDLFYCONS

haproxy

Quick HowTo:
check if the vagrant-berkshelf plugin is installed. If not, launch ” vagrant plugin install vagrant-berkshelf”
git clone https://github.com/EugenioMarzo/cookbook-wildfly-clu
cd wildfly-clu
vagrant up

Detailed Description:

Node1 (myserver1) =>Domain controller –  Application Server – Reverse proxy

Node2 (myserver2) => Slave – Application Server

Node3 (myserver3) => Slave – Application Server

Prerequisites:  Virtualbox 4.3.10 ,Vagrant 1.4.3 , Ruby 1.9.3,Git

Let’s start..

1. Configure your /etc/hosts in order to resolve locally the name of…

View original post 733 more words

Caching best practices

Vlad Mihalcea's Blog

Introduction

There is an irresistible attraction to writing custom caching solutions, since it seems to be the easiest path to “improving” the overall application performance. Well, caching is a great technique, but there are few steps to consider before even considering it.

Best practices

  1. A key/value collection is not a Cache

    Almost all projects I worked on have been using some sort of custom caching solutions, built on top of Java Maps. A Map is not an out-of-the-box Caching solution, since a Cache is more than a key/value store. A Cache also requires:

    • eviction policies
    • max size limit
    • persistent store
    • weak references keys
    • statistics

    A Java Map doesn’t offer these features and you shouldn’t spend your customer’s money to write a custom cache solution either. You should choose a professional cache like EHCache or Guava Cache, which are both powerful and simple to use. Those tools are constantly tested…

View original post 476 more words

Hibernate Facts: Multi level fetching

Vlad Mihalcea's Blog

It’s quite common to retrieve a root entity along with its children associations on multiple levels.

In our example we need to load a Forest with its Trees and Branches and Leaves, and we will try to see have Hibernate behaves for three collection types: Sets, Indexed Lists, and Bags.

This is how our class hierarchy looks like:

Image

Using Sets and Indexed Lists is straight forward since we can load all entities by running the following JPA-QL query:

and the executed SQL query is:

But when our children associations are mapped as Bags, the same JPS-QL query throws a “org.hibernate.loader.MultipleBagFetchException”.

In case you can’t alter your mappings (replacing the Bags with Sets or Indexed Lists) you might be tempted to try the something like:

But this is inefficient generating a plethora of SQL queries:

So, my solution is to simply get the lowest level children and fetch all needed associations…

View original post 281 more words