2009-02-13から1日間の記事一覧

Bridgeパターン

use strict; use warnings; { package Display; use strict; use warnings; sub new { my ($class, $impl, ) = @_; my $self = { impl => $impl, }; return bless $self, $class; } sub open { $_[0]->{impl}->rawOpen(); } sub print { $_[0]->{impl}->rawP…

Builderパターン

use strict; use warnings; { package Director; use strict; use warnings; sub new { my ($class, $builder) = @_; my $self = { builder => $builder, }; return bless $self, $class; } sub construct { my $self = shift; $self->{builder}->makeTitle(…

Prototypeパターン

use strict; use warnings; { package Interface::Product; use strict; use warnings; sub use { die; } sub createClone{ die; } } { package Manager; use strict; use warnings; use Data::Dumper; sub new { my ($class,) = @_; my $self = {}; return …