Archive for the ‘Programming’ Category


In order to achieve productivity and robustness of our applications, we are constantly introducing new coding practices, new tools, new frameworks. Consequently, with every new introduction of additional complexity we are permanently raising a bar for newcomers in programming business.

Trough time, process of learning is getting longer, required effort amount increases and we are failing to provide beginners with tools and/or methods for getting from point of not knowing anything to knowing something.

In that learning process – they are often left alone to choose any method to go trough that path by them selves. Very often, they choose wrong.

(more…)


Vast majority (if not every) good development practice is established based on empirical studies and personal experience. One of those is “YAGNI“, as we do tend to develop more functionality and over-engineer a solution for a problem that does not exist. However, it seams that “You aren’t gonna need it” does not apply to localization.

(more…)

PHP: Void and Null are (not) same thing

Posted: December 13, 2016 in Programming
Tags: ,

Sloppy code is not always a result of bad and lazy developers, sometimes, language runtime can be the one who to blame. One of the examples is PHP and how it treats “void” and “null” in non-strict mode.

(more…)


There are several ways to construct object instance. Most common way is to use, of course, a ‘new’ keyword, however, as anything else, both theory and practice have decide to make this more complicated, and invent new fancy terms for it.

(more…)


I remember that when I started to work as programmer/developer, I hated exceptions and errors. I thought that, in that point of time, everything is better than having your application run into exception message with some nasty error screen.

Today, development goal is the same, application should work flawlessly, as per design, without appearance of any error screen.

However, difference is technology advancement nowadays as well as in my maturity as a developer and acceptance of the fact that exceptions and errors have key role in achievement of application quality and development productivity. Today I appreciate exceptions and errors, I almost get excited when I see one. (more…)

Private class callbacks

Posted: January 10, 2016 in Programming

PHP can be considered as hybrid language, mostly OOP language with support for some of the functional programming features. Most praised functionality is possibility to work with closures.

There are unlimited possibilities how to exploit closures, here, I will show you how to use them to encapsulate class methods when you are implementing  method callbacks for any reason.

(*UPDATE: Idea from this article resulted with library: https://github.com/RunOpenCode/sax)

(more…)


The client requested the display of cities in ascendant order by title, but first 5 cities has to be cities according to his choice. I had over 130 cities in table, fields: [city_id, title, position]. The solution was to either fetch all sorted by title and to extract those 5 and put them on top, or to update position of each city according the title ascendant order. The second solution is better, but I had to do that for over 130 rows.

(more…)