Robust API communication with exponential backoff

Every API fails at random points of time and that’s unavoidable. Sadly, it’s not taken care correctly during integrating third party API’s. I see it very often. „Hey there! But I’m using try-catch and handle errors, sometimes even I log them to the file…” one might say. Well, so what? What happens when it fails and you miss data which needed to be fetched during the daily ETL process? Or your business partner misses information if you send data to their API and for some reason, it fails. What then? As long as you use cron and have output emailed to some mailbox, which is being monitored – you’ll notice. Maybe you use Sentry or any other application monitoring/error tracking software and you’ll spot some anomaly. But imagine having dozens of such jobs running on a daily basis – it’s easy to lose track.

I think you get my point now. API errors occur quite often. Most of them are due to temporary service unavailability, caused mainly by having too much traffic at the moment. The simple solution is to retry. In this post, I’ll show how to easily implement efficient retry mechanism.

Read more

Commarize – publicly available and open-sourced

TL;DR: changes multi-line input into the comma-separated output.

Full story: around 6 years ago I created a simple tool to speed up my daily job. The problem was – our Affiliate Manager has been giving me excel file with one column – the IDs of customers to change their affiliate association in the database. There was a simple query behind it:

UPDATE clients
SET affiliate_id = 100001
WHERE id IN (<here goes comma separated list of clients>);

Of course, you can do that somehow in Excel. I often pasted that column to VIM and put the commas using a macro. But that was becoming a hassle, when I’ve been asked a couple times per week, sometimes a day.

I decided to create a simple tool, which looked ugly, but worked just fine.

Read more

Immutable value objects in PHP

Value objects are one of building blocks in Domain Driven Design. They represents a value and does not have an identity. That said, two value objects are equal if their values are equal.

Other important feature is that Value Objects are immutable, i.e. they can not be modified after creation. Only valid way to create Value Object is to pass all required informations to constructor (and should be validated somewhere there). No setter methods should take place.

Read more

Software developers care too much about tools

Lately I see perilous situation in software development area. There are plenty of good devs so much bounded聽to tools. By tools, I mean mostly frameworks. I would like to elaborate a bit about that, but those are my personal opinions and they aren’t here to offend anyone.

First of all, we all need to admit, that quality of modern MVC framework raised a lot, comparing with state of things few years ago. Speaking about PHP – at the time, when I attracted my attention to this language, there were pure wilderness. We did not have any strong framework (unlike Ruby On Rails, which were sine qua non choice for Ruby web development). That caused multiple projects development, some of them are dead now (or should be), some hasn’t got good market adaptation and some of them are industry leaders at the moment (Symfony and Zend).

Read more

Android Meteoapp released as an Open Source

More than year ago I’ve played a little with Android Java SDK and I’ve created proof of concept of Meteoapp application. It fetches an meteograms from, cuts them into 6 parts and displays choosen parts for a given city. Meteoapp uses meteo library to interact with This library has been also open sourced.

Read more

Always use most latest versions for benchmarks

In my previous post Modern framework comparison I presented performance tests, which compared Ruby On Rails, Django and Symfony2. After recieving a feedback in comments I decided to run this benchmark one more time on my own laptop (instead of on my hosting). The reason was simple: enviroment was outdated. I installed mod_python and configured it easily and struggled about one day with phussion passenger (AKA mod_rails) with ruby 1.9, but finally everything works. The results is compared in table below.

Read more

Modern frameworks comparison

How many times were you curious which one of, modern web frameworks is the best? For developers who have their favourite, answer is simple. But there are plenty of questions from begginers or devs who want to learn new technology, wondering which one should take, to stay on the edge.How many times were you curious which one of, modern web frameworks is the best? For developers who have their favourite, answer is simple. But there are plenty of questions from begginers or devs who want to learn new technology, wondering which one should take, to stay on the edge.

Read more

Year 2011 summary on my blogPodsumowanie roku 2011 na moim blogu

As year 2011 is going to end very soon I did a little recap of things occured on this blog during this year. I wrote 18 posts, which is more than in a previous year (it was 11). Readers left total number of 43 comments. This blog has been visited 58% often than in the previous year with 200% more actions performed. In the December I switched layout (with help from Chilid team), which made it more readable and easy to use.
To sum things up: that was good year, but next is going to be better 馃檪 Thank you for reading my articles and don’t hesistate to leave comments and suggestions about improvements that you can see.Jako聽rok 2011 wkr贸tce si臋 sko艅czy, zrobi艂em ma艂e聽podsumowanie rzeczy, kt贸re mia艂y miejsce聽na tym blogu.聽Napisa艂em聽18 post贸w,聽czyli wi臋cej ni偶聽w poprzednim roku (by艂o聽11).聽Czytelnicy聽zostawili聽og贸lnie 43聽komentarzy.聽Ten blog聽odwiedzono聽58% cz臋艣ciej ni偶聽w roku poprzednim, wykonuj膮c 200% wi臋cej聽czynno艣ci.聽W grudniu zmieni艂em聽layout (z pomoc膮聽Chilid), poprawiaj膮c czytelno艣膰 i przejrzysto艣膰 bloga.

Podsumowuj膮c: to by艂聽dobry rok,聽ale w przysz艂ym聽b臋dzie jeszcze lepiej聽馃檪聽Dzi臋kuj臋 za czytanie聽moich artyku艂贸w聽i nie聽wahajcie聽aby zostawia膰 komentarzy聽i聽sugestii na temat ulepsze艅, kt贸re聽mo偶na wprowadzi膰.

Read more

Brand new blog layout

Today I proudly present a brand new blog layout. Thanks to Chilid New Marketing Agency from Gliwice, Poland now blog is more readable and minimalistic. I need to admit that cooperation with Chilid was awesome – they clearly understand my needs, did great graphics and creation and communicated very well. Thanks again to Ania, Tomek, Patrycjusz, Marcin and Adam!

Read more

Kr贸tka relacja z InternetBeta2011

Wczoraj wr贸ci艂em z InternetBeta2011, kt贸ra odby艂a si臋 w Rzeszowie. Trzeba przyzna膰, 偶e poziom organizacji by艂 na naprawd臋 wysokim poziomie, podobnie jak poziom ludzi, kt贸rych tam spotka艂em. Wiele znanych osobisto艣ci, wiele pasjonat贸w i mn贸stwo nowych znajomo艣ci. Jako architekt oprogramowania mia艂em obawy o trudno艣ci znalezienia wsp贸lnego j臋zyka z przedstawicielami medi贸w, marketingu, agencji interaktywnych czy PR, ale te w膮tpliwo艣ci szybko zosta艂y rozwiane.
Szczeg贸lnie do gustu przypad艂 mi panel technologiczny, na kt贸rym prelegenci byli聽doskonale przygotowani i z kt贸rego wynios艂em najwi臋cej (sam osobi艣cie te偶 wyg艂osi艂em prelekcj臋 na tym偶e). Oczywi艣cie nie ujmuj臋 tutaj pozosta艂ym przemowom, bo na g艂贸wnej auli prezentacje w wi臋kszo艣ci by艂y 艣wietne. Poza tym warto tu pochwali膰 warstw臋聽audio-wizualn膮 imprezy oraz doskonale przygotowane programy wieczorne 馃檪
Troch臋 brakowa艂o mi interakcji pomi臋dzy prelegentami a widowni膮 po prezentacjach. Pytania z publiki zawsze stawiaj膮 kropk臋 nad „i”, tutaj agenda by艂a wype艂niona do艣膰聽szczelnie i nie by艂o na to czasu. Drug膮 kwesti膮, kt贸ra troch臋 zawiod艂a to catering, ale nie samym chlebem cz艂owiek 偶yje 馃檪
Wa偶nym wydarzeniem by艂 te偶 wernisa偶 Oli Anzel, kt贸ry przedstawia艂 najwa偶niejsze osoby w polskim Internecie, a kt贸remu towarzyszy艂a r贸wnie偶 cyfrowa edycja Wi臋cej o tym projekcie, mo偶na przeczyta膰 na blogu Marcina Dryki, kt贸ry by艂 g艂贸wnym developerem projektu.
Podsumowuj膮c: wielkie s艂owa uznania dla Matuesza Tu艂eckiego i jego dru偶yny za organizacj臋 InternetBeta, mam nadziej臋, 偶e w przysz艂ym roku znowu b臋dzie mi dane tam by膰.

Read more