Badger
view release on metacpan or search on metacpan
lib/Badger/Modules.pm view on Meta::CPAN
sub some_code {
my $widget = Your::App::Widget->new;
$widget->do_something;
}
One of the benefits of object oriented programming is that objects of
equivalent types are interchangeable. That means that we should be able to
replace the C<Your::App::Widget> object with a different
implementation as long as it has the same interface in terms of the methods it
implements. In strictly typed programming languages this equivalence is
enforced rigidly, by requiring that both objects share a common base class,
expose the same interface, implement a particular role, or some other
mechanism. In loosely typed languages like Perl, we have to rely on duck
typing: if it looks like a duck, floats like a duck and quacks like a duck
then it is a duck (or is close enough to being a duck for practical purposes).
For example, we might want to use a dummy widget object for test purposes.
use Your::App::MockObject::Widget;
sub some_code {
pod/Badger/Intro.pod view on Meta::CPAN
The Badger is a I<toolkit>, not a I<framework>. What's the difference? Good
question. For the purpose of this discussion, a framework is something that
requires you to structure your code in a particular way so as to fit into the
framework. In contrast a toolkit doesn't concern itself too much with how you
write your code (other than some basic principles of structured programming).
Instead it provides a set of tools that you can add into your applications
as you see fit.
You can use all, some or none of the Badger modules in a project and they'll
play together nicely (convivial play is a central theme of Badger, as is
foraging in the forest for nuts and berries). However, there's no rigid
framework that you have to adjust your mindset to, and very litte "buy-in"
required to start playing Badger games. Use the bits you want and ignore the
rest. Modularity is good. Monolithicity probably isn't even a real word, but
it would be a bad one if it was.
Of course nothing is ever black and white (henceforth known as the "even
badgers have grey fur" principle). There's a good deal of overlap between
the two approaches and benefits to be had from them both. We embrace
a bit of frameworky-ness when it makes good sense, but generally try and
keep things as toolkit-like as possible.
( run in 1.019 second using v1.01-cache-2.11-cpan-97f6503c9c8 )