Tuesday 10th October 2006

Meeting at 19:30 - location: The Amiado (Students.ch) offices

Drinks at the Bar Penalty around the corner.

Agenda

"Javascript vs. PHP" - Harry (in the Javascript corner) vs. Maarten (in the PHP corner)

Who's attending?

Slides

Results: Javascript sucks harder than PHP(!?!)

Individual Topic Ratings

  • Syntax: PHP - Sucks, JS - Sucks Hard
  • Data Types: PHP - Sucks, JS - Sucks
  • Scope / Namespaces / Packaging: PHP - Annoys, JS - Sucks Hard
  • Standard Library: PHP - Sucks, JS - Sucks Hard
  • Extension Libraries: PHP - Sucks, JS - Annoys
  • Procedural Programming: PHP - Annoys, JS - Annoys
  • Object Oriented Programming: PHP - Sucks, JS - Sucks
  • Functional Programming: PHP - Blows, JS - OK
  • Meta Programming: PHP - OK, JS - OK
  • AOP: PHP - OK, JS - OK
  • Networking: PHP - OK, JS - Sucks
  • Error Handling: PHP - Sucks Hard, JS - Sucks
  • Multi Tasking: PHP - OK, JS - Sucks
  • Reflection: PHP - OK, JS - Sucks
  • Garbage Collection: PHP - Blows, JS - Blows
  • Security: PHP - Blows, JS - Sucks
  • Garbage Collection: PHP - Blows, JS - Blows
  • Security: PHP - Sucks, JS - Sucks
  • Tools: PHP - Sucks, JS - Sucks Hard
  • Server Side: PHP - OK, JS - Sucks
  • Client Side: PHP - Sucks Hard, JS - OK
  • Final Rave: PHP - Sucks, JS - Sucks

Overall Suckage

PHP: ******************************************************************** (68)

Javascript: ************************************************************************** (74)

Javascript sucks harder!

The Suckometer

#!/usr/bin/perl -w
use strict;
use QWizard;
use IO::File;
 
my $RESULTF = $ENV{HOME}.'/suckometer.txt';
if ( -f $RESULTF ) { `rm $RESULTF`; }
 
my $TOPICS = [
	      'Syntax',
	      'Data Types',
	      'Scope / Namespaces / Packaging',
	      'Standard Library',
	      'Extension Libraries',
	      'Procedural Programming',
	      'Object Oriented Programming',
	      'Functional Programming',
	      'Meta Programming',
	      'AOP',
	      'Networking',
	      'Error Handling',
	      'Multi Tasking',
	      'Reflection',
	      'Garbage Collection',
	      'Security',
	      'Tools',
	      'Server Side',
	      'Client Side',
	      'Final Rave',
	      ];
 
sub score {
    my $answer = shift;
    $answer = lc($answer);
    my $answers = {};
    $answers->{'ok'} = 0;
    $answers->{'annoys'} = 2;
    $answers->{'sucks'} = 4;
    $answers->{'sucks hard'} = 6;
    $answers->{'blows'} = 10;
    return $answers->{$answer};
}
 
sub record {
    my $in = shift;
    my $fh = IO::File->new;
    $fh->open(">> $RESULTF");
    print $fh "$in\n";
    $fh->close;
}
 
my %primaries = 
  (
   'topprimary' => {
		    title => 'The SuckoMeter',
		    introduction => 'What sucks harder - PHP or Javascript?',
		    questions => 
		    [{ type => 'label',
		       name => 'justalabel',
		       text => 'Please answer the following questions...'}],
 
		    post_answers => 
		    [sub {
			 my $wiz = $_[0];
			 foreach my $t ( @{$TOPICS} ) {
			     $wiz->add_todos(-late, "primary_$t");
			 }
			 $wiz->add_todos(-late, "last");
			 return 'OK';
		     }],
 
		    actions => 
		    [sub {
		       
		       my $add = sub {
			 $_[0] += $_[1];
			 for(1...$_[1]){$_[2].='*'};
		       };
		       
		       my $php_total = 0;
		       my $js_total = 0;
		       my $php_bar = '';
		       my $js_bar = '';
		       
		       foreach my $t ( @{$TOPICS} ) {
			 $add->($php_total,
				score(qwparam("php_$t")),
				$php_bar);
			 $add->($js_total,
				score(qwparam("js_$t")),
				$js_bar);
		       }
		       my $result = 'PHP and Javascript suck equally!';
		       $result = $php_total > $js_total ?
			 'PHP sucks harder!' :
			   'Javascript sucks harder!'
			     unless $php_total == $js_total;
		       my $result = ['',
			       '-------------------------',
			       "Overall Suckage",
			       '-------------------------',
			       '',
			       'PHP:',
			       "$php_bar ($php_total)",
			       '',
			       'Javascript:',
			       "$js_bar ($js_total)",
			       '',
			       "$result",
			      ];
		       record(join("\n",@{$result}));
		       return $result;
		     }],
		   },
  );
 
foreach my $t ( @{$TOPICS} ) {
    $primaries{"primary_$t"} = {
	title => "$t",
	introduction => "$t : which sucks harder?",
	questions => [{ type => 'radio', 
			name => "php_$t",
			text => "PHP $t:",
			values => [
				   'Blows',
				   'Sucks Hard',
				   'Sucks',
				   'Annoys',
				   'OK',
				   ],
			    default => 'OK'
			       },
		      { type => 'label',
			name => 'seperator',
			text => sub {
			    my $s = '';
			    for(1...30){$s.='-'};
			    return $s
			    },
			    },
		      {	type => 'radio', 
			name => "js_$t",
			text => "Javascript $t:",
			values => [
				   'Blows',
				   'Sucks Hard',
				   'Sucks',
				   'Annoys',
				   'OK',
				  ],
			default => 'OK'
		      },
		     ],
				post_answers => [
					sub {
					    my $res = 
						   sprintf(
							   "%s: PHP - %s, JS - %s\n",
							   $t,
							   qwparam("php_$t"),
							   qwparam("js_$t")
							  );
					    record($res);
					    return "OK";
					}
					   ],
 
	};
}
 
$primaries{'last'} = {
		      title => 'Ready to calculate',
		      introduction => 'The Suckometer is ready to process the results',
		      questions => 
		    [{ type => 'label',
		       name => 'justalabel2',
		       text => 'Ready to find out?'}],
		     };
 
my $qw = new QWizard(primaries => \%primaries,
		     title => 'The SuckoMeter',
		     no_confirm => 1);
 
# $QWizard::qwdebug = 1;
 
$qw->magic('topprimary');
 
 
meetings/20061010.txt · Last modified: 2006/10/11 07:42 by harryf