Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Two years ago I open sourced my application framework, Basset. Why's it called Basset, you ask? Well, it's very agreeable, easy to get along with, and likes set routine, just like basset hounds. Besides, I wanted something catchy and snappy and not JASA (just another silly acronym) and was inspired by Maypole's name.

Plus I just like basset hounds.

A year ago, I put it on CPAN. I'd refrained at first, for several reasons, but opted to finally put it on there, cluttering up the namespace though it does. Ho hum.

And the question that comes to mind is...now what?

What Basset is

Basset is the set of tools that I've been using internally for years and years and years and years. It has the advantage of a lot of maturity behind it, but the disadvantage of being exactly what I want it to be, which may not be what you want it to be. This is not a new, immature product. It's been around a long time and is pretty battle hardened. Good chunks of most modules even have really good test coverage. I think it's perfectly easy to use, but I'm biased. A former co-worker described it as cumbersome, but functional.

He also described it as "There's only one way to do it." My goal was to establish a set of tools and routines for myself to ensure solid consistency across my software. One of the gripes I have with CPAN is that everything is done differently to the point that tying disparate modules together can be a real pain in the ass. If your root object class uses inside out objects and your persistent layer uses arrayrefs and your logging module uses exceptions and your email rountines use error codes, then knitting it all together is a real nuisance.

With Basset, I was guaranteed that everything always plays together by the same set of defined rules. But I took it a step further - I made the rulebook user definable. So if I want to use error codes and you want to use exceptions, that's cool - flip a bit and it transparently swaps. If you want to use Class::DBI for your persistent layer and I want to use DBIx::Class, that's cool - flip a bit and it transparently swaps. Basset wants to ensure that you always play by the rules, and it suggests a rulebook, but doesn't care if you change the rules as you go along.

It's a generic application framework. Documentation is decent, though not outstanding, I don't think. There's a reasonably good tutorial up on my website at Basset Software to introduce you to things, but the introduction assumes that you use my rulebook and doesn't yet go into defining your own.

So you start off by subclassing off of Basset::Object. That gives you constructors and error handling and abstract factory capability and a few other things. You hang your class hierarchy off of here and you know that everything inside of it behaves the same way.

You don't like something? You change it. You can even change it inline and have your other subclasses care about it. The term I use is "injected inheritance", which may or may not be common. Apple calls it "isa swizzling" in their frameworks. For example,

Say when an error occurs, you also want to log it to a file. You simply subclass the root object and add on logging.

package My::Object; our @ISA = qw(Basset::Object); sub error { my $self = shift; #log interesting things return $self->SUPER::error(@_); }

Or words to that effect. This works swimmingly, unless you download another object created by another user. They'll subclass directly from Basset::Object and bypass your logging. So you're back where you started - error handling works differently for different objects.

Basset gets around this by subclassing off of object types, not objects. So instead, you define My::Object as the root object type in your config file, and have your objects inherit from the root object type, not a particular class. Blamo! Your newly downloaded module gets your error handling, too.

There's more neat stuff like that throughout the framework, for my definition of "neat", of course.

What Basset isn't

Basset isn't just another persistence layer, though it has its own persistence class included. Sure, I could have just used Class::DBI or Tangram or Alzebo or whatever else, but I wrote my own (years ago) and refined it to my current liking. If you want to use it, that's great. If you don't and want to wrapper Class::DBI and drop that in instead, that's great. Again, Basset doesn't demand you follow its rules, it just demands you follow rules. But don't dismiss it because there's a persistence layer, it's just a bundled example of one that you can try.

Ditto on the templating system. Don't use it, I don't care. But I think they're both useful pieces of code, so I distributed them with the framework. I look at other app frameworks and templating engines and persistence layers for concepts and ideas, maybe someone else would like to look at mine. Share and share alike.

It's not a speed demon. It's fast. Really fast, I think. Especially compared to how it behaved years ago. But it's still a framework with some overhead and you can do things faster on your own if you do it directly, but the slowdown is manageable. Basset hounds are also a little slow, but manageable. Plus, the speed that they can produce in some instances can surprise you.

Basically, it's not just its individual parts, it's how the parts operate together that's the neat part.

So now what?

I feel like I'm throwing a party and nobody's coming. So how can I drum up support? While it's my project and I'm always going to be the gatekeeper, I really want to open it up to the world and get feedback and suggestions from everyone.

For example, Basset::Object::Persistent used to have an old, clunky, ugly (I say now) concept of attaching multiple tables to an object. The same former colleague I'd mentioned above made a big fuss about it and sang the praises of Class::DBI's has_a syntax. I looked it over, thought about it, decided he was right, and implemented something similar. Along the way, I added in transparent multi-table support so that one object can transparently map to multiple tables, not the 1-1 constraint you usually have.

And I never would have made that modification without his prodding. Now, he had to use it (we were using it at work), so he's a special case. But the rest of the world? You guys have a choice. Sure, I think it's neat, but I'm the proud father here. What, if anything, could get you guys interested in looking at it? I know that right now it's just Yet-Another-App-Framework. What'd be exciting? What would make you think, "Hrm, that might be worth checking out?"

I want to grow this thing into a community and hopefully make a lot of people's lives easier, but I haven't a clue how to do it.

Where should I start?


In reply to Basset. Now what? by jimt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-05-20 16:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (75 votes). Check out past polls.

    Notices?