“Global data” by M. Fowler & K. Beck

Since our earliest days of writing software, we were warned of perils of global data - how it was invented by demons from the fourth plane of hell, which is the resting place of any programmer who dares to use it. (C) Refactoring, 2nd Edition

July 13, 2019 · 1 min · anvyst

PHP: Array vs ArrayObject benchmarking

Some measurements on Arrays vs ArrayObjects found among gist users. Just going to bring it here, in case gist dissappears. # php -v PHP 5.3.6 (cli) (built: Mar 17 2011 20:58:15) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies # echo '<?php $s = array(); for($x=0;$x<1000;$x++){ $s[] = array("name"=>"Adam","age"=>35); }; echo memory_get_peak_usage(); ' | php 655040 # echo '<?php $s = array(); for($x=0;$x<1000;$x++){ $o = new ArrayObject; $o->name = "Adam"; $o->age = 35; $s[] = $o;} echo memory_get_peak_usage(); ' | php 887984 # time echo '<?...

November 16, 2016 · 2 min · anvyst

Code elegance: one of those days

Ah, it’s just one of those days! It seems that I can wail about this topic in non-stop mode. Why do people overcomplicate problem domain with sophisticated solution. Have you tried to read what you wrote the day after? A week after? No? Then, read it, and try to guess what you’ve been trying to achieve! And at the meantime, read this Programmers Stackexchange topic on Code Elegance. Not enough?...

March 5, 2015 · 1 min · anvyst