Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Building Enterprise Web Applications with Maypole

by Ovid (Cardinal)
on Mar 02, 2004 at 15:28 UTC ( #333276=perlmeditation: print w/ replies, xml ) Need Help??

I've been hearing a bit about Maypole (think "Struts for Perl"). In a nutshell, it's designed to allow you to write complex database driven Web applications very quickly. For example, how long would it take you to build a Friendster/Orkut type web application that does the following?

  • login
  • logout
  • view users
  • browse users
  • search for users
  • edit profiles
  • mail out invites to new users
  • accept invites
  • reject invites
  • sign up new users
  • offer friend connections
  • accept friend connections

Simon Cozens writes that it took him just over a week with only 300 lines of Perl. Maypole runs under mod_perl and is available on the CPAN. It's built on top of Class::DBI, Template Toolkit, DBI and Apache::MVC.

This is something that I think Perl has long been needing. Whether or not Maypole is the way to go is not something that I can say, but I do feel that something like this would be a Good Thing for several reasons. First, my job boils down to providing maximum value for minumum cost and the less code I have to write, the fewer bugs I will create. Second, Perl has long been lacking an enterprise level Web application framework. Regardless of your views on frameworks, this has been an issue which has led many outside of the Perl community to dismiss Perl.

Maypole is being actively developed, it has a mailing list and, with Simon Cozens being behind it, I think it has a chance to go far so long as people get behind it. It's also being built on top of solid, proven technologies.

Any thoughts? Are there problems with his approach? Are there competitors worth checking out?

Cheers,
Ovid

New address of my CGI Course.

Comment on Building Enterprise Web Applications with Maypole
Re: Building Enterprise Web Applications with Maypole
by borisz (Canon) on Mar 02, 2004 at 15:52 UTC
    I recommend Apache::PageKit it is also a database driven MVC framework. It has already solutions for most web programming problems like session management, language localization, authentication, form validation, skins and more. It works with HTML::Template and DBI.
    Read the Userguide.
    www.pagekit.org
    Boris
•Re: Building Enterprise Web Applications with Maypole
by merlyn (Sage) on Mar 02, 2004 at 17:11 UTC
Re: Building Enterprise Web Applications with Maypole
by perrin (Chancellor) on Mar 02, 2004 at 17:16 UTC
    Now I'd like to see a comparison between Maypole, OpenFrame, OpenInteract, PageKit, and a homegrown CGI::Application + TT + Class::DBI approach. I suppose I'll get around to it eventually, if no one else does one.
      I'd like to see a comparison between Maypole, OpenFrame, OpenInteract, PageKit, and a homegrown CGI::Application + TT + Class::DBI approach

      Simon's started just such a comparison on the Maypole Wiki. Not much there yet. I'm sure patches would be welcome :-)

Re: Building Enterprise Web Applications with Maypole
by lachoy (Parson) on Mar 02, 2004 at 20:58 UTC

    (I posted this on Ovid's use.perl journal as well...)

    I haven't taken a detailed look at Maypole yet (no tuits), but just off the top of my head there are a number of similarities between Maypole and OpenInteract (I'll focus on the still-in-beta OpenInteract2 because it's got a lot more going for it). Generally OI2 is much more heavyweight and designed to adapt to more environments than Maypole. But that doesn't mean it's better -- as usual flexibility comes at a price, in this case complexity. And as usual whether this complexity is worth it really depends on what you're doing.

    • OI2 is very big. The HTML doc snapshot for the next beta weighs in at 1.3 MB -- and some parts need better docs :-) As a result you need to do more work to startup a new system, although the quick start guide helps out with that.
    • Both rely on the Template Toolkit, although OI2 supports additional content generation methods (pluggable, and it's distributed with support for HTML::Template and Text::Template)
    • Both are tied to an object-relational mapping solution -- OI2 uses SPOPS while Maypole uses Class::DBI. But I think both can use other solutions without too much problem (that is, using SPOPS objects in Maypole and Class::DBI objects in OI2). Class::DBI is generally simpler than SPOPS but SPOPS also does LDAP and some mildly interesting stuff with security.
    • OI2 seems to be more internally declarative. (Keep in mind, this is based on a cursory look at Maypole -- I wouldn't be surprised if under the covers they did much the same thing.) So in Maypole you map a URL to an action (represented by a PerlHandler) using Apache. In OI2 a package (or distributable application) contains an 'action.ini' file which registers classes (and optional parameters) with the framework and tells it what names it will respond to. Another component is responsible for mapping incoming URLs to names. You also declare if an action is secured, what methods are not allowed, and more. In fact comparing the beer DB example from Simon's weblog entry to the OI2 package development tutorial is pretty useful -- note that the first part of the tutorial does things the "longer" way, the second part introduces the 'common' actions and does it more declaratively.
    • You can use OI2 under multiple environments. Currently Apache 1.x, CGI and LWP are supported, with a working (but probably suboptimal) version using Apache 2.x in the next beta.
    • OI2 focuses on creating distributable, standalone applications. So I can send you a zip file (foo-0.01.zip) and you can run:
      $ oi2_manage install_package --package_file=foo-0.01.zip $ oi2_manage install_sql --package=foo
      and have it install that application's database structures, initial data, templates, static HTML pages and images, configuration, classes (including actions, TT plugins, normal Perl classes), localized messages (in the next beta), etc.

    There are almost certainly more differences, but I have a non-Perl day job to get back to :-) That said, I think the application server problemspace is sufficently complex that having multiple solutions are extremely useful.

    Chris
    M-x auto-bs-mode

Re: Building Enterprise Web Applications with Maypole
by Anonymous Monk on Mar 03, 2004 at 03:34 UTC
    Are there competitors worth checking out?
    You already know all the competitors, at least a lot of them (AxKit, Mason, Everything, OpenInteract, OpenPlugin/OpenThough .... they're all competitors more or less).
Re: Building Enterprise Web Applications with Maypole
by Anonymous Monk on Mar 03, 2004 at 03:40 UTC
    Are there problems with his approach?
    Yes, it's nothing new, so lets just keep the excitement level down :)
Canonical example
by zby (Vicar) on Mar 03, 2004 at 13:02 UTC
    What would be nice is if someone wrote a simple application in all of those frameworks, so that we could compare them in the works. How about working out here the basic functionality list and then sending it to the authors of those packages to implement? Here is my proposal:
    • register user
    • login/logout
    • browse records from some database table (with paging)
    • modification of a selected record
    • creation of a new record
    • select multiple records for deletion
    All with proper locking etc.

    By the way there is another one: Gestinanna (not much info in the core package - but you can look at StateMachine::Gestinanna), jsmith journal entry.

Re: Building Enterprise Web Applications with Maypole
by danb (Friar) on Mar 03, 2004 at 16:59 UTC
    Another web application framework to consider is Interchange.

    -Dan

      I looked into Interchange a couple of months ago and I found it very painful to install and set up. I finally got it running because I was too stubborn to give up but the experience made me reject Interchange for the project. I figured if it was that difficult to install and configure, maintenance wasn't going to be any better. My point here is that I don't think Interchange meets Ovid's description of Maypole as "designed to allow you to write complex database driven Web applications very quickly".

        I'm glad you have already looked at Interchange. I'm sorry you had trouble with it -- a lot of people share your frustration. Specific suggestions on improving it are welcome, we have had a hard time getting such feedback.

        In my experience, it is difficult to have complexity of features without a steep learning curve.

        If you are doing a one-off web app, lesser tools may do the job faster, since they do not require the initial learning investment.

        But if you will be spending years and years on web apps, then the initial investment in Interchange will pay off in the long run.

        -Dan

Re: Building Enterprise Web Applications with Maypole
by NodeReaper (Curate) on Nov 04, 2004 at 19:16 UTC
Re: Building Enterprise Web Applications with Maypole
by Anonymous Monk on Nov 04, 2004 at 19:20 UTC
    Is it possible to use some other database package besides DBI with Maypole ?
      I would imagine that if you wrapped your other database package so it worked like DBI then you could do that. What other database package are you hoping to use? DBI is the central module for nearly all perl database interactions and in general it is foolhardy to use RDBMSes without using DBI.
        We use Sybase::DBlib.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://333276]
Approved by particle
Front-paged by mattriff
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-08-30 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (292 votes), past polls