Happiness and money


I recently read an interesting book about happiness. This book made me think seriously about what’s the purpose of life, and put myself other existential questions. Tonight we’ll talk about the relation between money and happiness. By the time I read this book I thought that the happiness grows linear with the money. I always thought that the richer, the better… Now I have a different opinion.

But one thing I know for sure: the lack of money brings unhappiness!

I’ll show you a chart drawn yesterday. It describes the relationship between the money and the happiness.

Happiness(Money) function

Happiness(Money) function

There are three ares in the chart, named 1, 2 and 3, delimited by 2 green lines. We can observe that we can approximate the first part of the chart with a linear function… this was the part I have always thought completely describes the happiness(money) function, maybe because as a kid I was situated in this part of the chart… and till now I haven’t imagine or haven’t had the occasion to imagine the whole “pie”. This particular area represents the poor people, people that an extra amount of money would make them happier, people who spend most of the salary on primary goods. People who don’t afford a holiday abroad or to eat at least once a week at the restaurant.

The second area of the chart represents the middle class. More money, fewer worries… In my opinion, the percent of people from a country within this category, gives the happiness of that country. If the most people from a country are situated in the second part of the chart, we have a happy country… else not…

The third part of the chart are the rich people. They have lot more money than the other two categories, but are not lot more happy… I think for all countries, the happiness(money) chart looks the same, except the values under the two green lines. Let’s take for example my country, Romania: I think under the first line I could put the value of 500E and after the second line the value 3000E, or Germany where I’d raise the first line to 1500E and the second to 4000…

I’ll continue with the happy country idea comparing two countries: one of the happiest on earth, Holland and one in the middle of the hierarchy, my sweet contry, Romania.

Let’s draw another chart, based on my perception of situation, not on some rigorous study:

Comparation between Romania and Holland based on income

Comparation between Romania and Holland based on income

There are two charts, one for every of the two countries: any of the two pies are split in three zones: every zone corresponds to the areas from the first chart. For example Zone 1 from the comparative chart, represents the poor people. Zone 2 from the “pies” represents the middle class etc.

We can easily see that most Romanian people are located in the first part of the comparative chart, and I can explain why: most of the people paid from the country’s budget have the income between 100E – 500E and of course the country is poorer than Holland. Sad thing, in this zone we can find social categories that in other countries are located in other zones, like doctors, teachers, book authors.

That’s one of the reasons that Holland is happier than Romania: in Romania, the number of people belonging to the first part of the chart is bigger than the number of people in other zones.

Finally advice to the government: if you want a happier country, try to move people from the fist section to the second, start with the social categories that don’t belong there!

The web framework of your dreams

Leave a comment

For some time I’ve been wondering which are the characteristics that make a web framework great. Why to use one web framework and not another… Why to use a technology or another… Now I reached a conclusion. There are a few essential things a web framework must have, and also must respect some basic principles.

First of all, a web framework must be easy to use!

A web framework must be programmer centric, everything must be done with minimum effort.┬áThe framework’s designer must help the framework’s user to write functionalities with as few as possible lines of code.

The convention over configuration is necessary to be used here. Of course, this makes the framework harder to learn, but after the learning is done, the development effort is minimized. The learning curve should be adjusted using examples. Maybe a medium to complex application could be made available for study.

The framework must be based on the defaults principle. When declaring a component, it must have the most used proprieties. If the user wants to customize it, he could add some configuration. But in most cases the defaults should be enough.

The web framework must guide the developer to use the best practices and design patterns.

At this section we can put the documentation. The framework must be well documented… The easiness of development is for nothing if the people don’t know hot to do it!

Second, it must be fast!

Everyone of us waited for web sites to load, everyone knows how frustrating this waiting can be. If facebook would be slow, it wouldn’t have so many users.

The speed of a web application depends of many factors like the internet connection, the server the application is deployed, the technologies used for the application.

As framework designers we can influence a few of them:

  • we can write the framework with as few lines of code as possible and as optimized as possible. With fewer lines the framework becomes faster
  • we can choose and recommend technologies to the developers
  • we can recommend a web server

Third, it must be testable!

Anyone knows the benefits of automated testing… but few use them…

A web framework must be complete

It must offer a complete solution for developing web applications. There already are many frameworks specialized on different layers of a web application, but the developer will waste precious time to integrate these different technologies. Frameworks like RubyOnRails are so popular, because are complete solutions for the web application development problem.

It must be flexible

The developer must have the control of everything happening in the application. Typical technologies that takes the control from the developer are SQL code generators, or ORMs that generate SQL code. When complex things are needed, it is easier, faster and more flexible for the developer to write his own SQL code.

Finally I want to say that at some point, the principles stated below are contradictory and it’s up to the framework designer to find the balance between them. Like in life, the hardest thing thing to keep is the equilibrium.

Freemarker collection size comparation


Today I got frustrating errors related to finding how many elements exists in a Freemarker collection. And of course seeing if the collection is empty or not. The solution is simple:

<#if (project.tasks?size > 0) >

So you have to use parenthesis and the “>” will be escaped!

Gmail & Evolution

Leave a comment

Yesterday i tried to configure Evolution to work with Gmail… Everything went well, the mails were downloaded from the server, but when I wanted to send an e-mail… didn’t work.

Finally I found the solution: when setting the SMTP you have to put the port after the address and use the TSL with Login options for security:

SMTP address: smtp.gmail.com:587
Security: TLS
Authentication Type: Login