Programming is a lifestyle
There are two kind of programmers. Good programmers, and normal programmers. Normal programmers program because they have to program; they do it for a living, do it because they have to pass a certain subject, trying to impress someone, etc. A good programmer however, lives his life in a unique way. A good programmer doesn’t just program because he has to, a good programmer is a person that uses programming to solve his every-day life (if applicable of course), programs when he’s bored and he wants to have some ‘quality’ time.
Okay, fine. A good programmer is what the mass population tend to call a computer geek.
Anyway, I discovered today I am a geek. Here’s how it all started.
As some might know, I have (well, now past tense, had) a German exam at 10:30am today. So I was learning the vocabulary and came across the word ‘Zahlen’ which means numbers, and the first thing that comes to my mind is that I want the verification mechanism that is installed on my contact form to ask for 1+2 for example, and the ‘human’ should enter 3 (instead of questions which weren’t really nice to have: ex. What is the colour of grass? green). I knew the settings needed to be in the form Question=Answer each on a separate line, and I knew I wanted lots of combinations in that list, with no duplicates (1+2 and 2+1 shouldn’t co-exist), AND, to do that quickly because I have to continue studying! (I knew I wasn’t going to continue studying until I get it over with.)
So I head over to my laptop quickly and fire up my localhost’s www directory to my blob.php file (it’s the file I do all my experiments in) and start coding right away. I ended up with this:
<?php
$min = 1;
$max = 10;
$arr = array();
for( $i = 1; $i <= 1000; $i++ ){
$_1 = mt_rand( $min, $max );
$_2 = mt_rand( $min, $max );
if( ! in_array( array($_1, $_2), $arr) && ! in_array( array($_2,$_1), $arr) ){
$arr[] = array( $_1, $_2 );
print $_1 . ' + ' . $_2 .' ?=' . ( $_1 + $_2 ) . '<br>';
}
}
print '<br><br>total combinations: ' . count($arr);
?>
I http://localhost/scripts/blob.php and tada, here it is!
What do we learn? We learn that a good programmer (also known as a geek) is a programmer that involves programming in most of his day-to-day life. Period.
About this entry
You’re currently reading “ Programming is a lifestyle ,” an entry on My Days. My Life.
- Published:
- jun 15th, '08 / 12pm
- Number of comments:
- 16
- Number of views:
- 473
- Category:
- Development, Personal














?





