tags:

views:

294

answers:

4

From the current version (0.98) of the Moose::Manual::MooseX are the lines:

We have high hopes for the future of MooseX::Method::Signatures and MooseX::Declare. However, these modules, while used regularly in production by some of the more insane members of the community, are still marked alpha just in case backwards incompatible changes need to be made.

I noticed that for MooseX::Method::Signatures the change log for September 2009 mentions the removal of the "scary ALPHA disclaimer".
So, are these still "alpha"?
Would I still be considered one of the "more insane" to use them?

+4  A: 

It depends on what you mean by "production ready". I wouldn't depend on them until their velocity slows down quite a bit. I like my production stuff to not need frequent care from external code changes, API adjustments, and so on. That's not something particular to Moose, but any young project.

You have to judge how much that matters to you. In some situations, pushing stuff into production is a lengthy process, so you must be circumspect with such things. At the other extreme, some places let you edit files directly on the production server. That is, you have to define your tolerance before anyone can tell you which side a given MooseX module is on.

brian d foy
Thanks for your answer. It sounds like you are reluctant to even use `Moose`.
molecules
I think Moose is really cool. I'm just reluctant to pay attention to it every day to see if I have to redo lots of stuff. I have to get things done, and not relying on a quickly changing set of modules isn't the way to make progress. As I said, it's not particular to Moose.
brian d foy
Thanks. That makes sense. So, do you build all of your objects from scratch?
molecules
I make most of my objects by calling constuctors in CPAN modules. :)
brian d foy
Very wise!!!!!!
molecules
+5  A: 

There are people who feel that the maturity and stability of MooseX::Delcare, Devel::Declare on which it's based, or even Moose itself are not yet ready for "prime time". I also know of two large companies with millions of visitors a month, who have MooseX::Declare in their production environment. I personally am happy with the stack I am provided with Moose and do not see a need yet to bring in MooseX::Declare. I know people who's opinion I deeply respect who refuse to write new code without the declarative sugar from MooseX::Declare.

All of this is to say, the decision on whether something is or is not production ready is highly dependent upon your production environment, your development needs, and taste for risk. Without being in your shoes we can't possibly give an informed decision as to how well any given tool matches that profile.

perigrin
Thanks. It is probably good for me to remember that not everyone is as thrilled about `Moose` as I am. I use it so much, I had forgotten that fact.
molecules
It's not that people aren't thrilled by Moose, but they just value stability more. I think Moose and MooseX is really cool. I just need it to stabilize. :)
brian d foy
+7  A: 

I think it's a matter of differing perspectives as much as anything -- rafl is one of the aforementioned "more insane members of the community" while Rolsky is more conservative. It's up to you to decide who you agree with, and really I think that the most important variable is your own code.

MooseX::Declare is good code. It won't randomly blow up your machine, it's not awful for performance, and it offers a lot of nifty stuff while reducing the amount of boilerplate that you have to write. But it might change in the future, making your code refuse to compile until it's updated; it might make your editor and other development tools confused when it sees syntax that it can't parse, it might piss off your collaborators by making them learn a new module to work with your code, or it might piss off your boss by making it so any future maintainer has to learn a new module to work with your code. Which of those things apply to you, and to what degree? You know better than I do, I hope.

hobbs
Thanks. My eventual replacement will probably have to learn Perl from scratch, so your comments on maintainability are particularly pertinent.
molecules
+1, but let me note that "more insane members of the community" is really conveying something other than what I think you're trying to say. Florian writes good and generally stable code. It's just that he also experiments a lot. Great things have come of that. As with all external dependencies, it's just important that one spends some time deciding when it's a prototype quality library or when it's considered tried and true.
tsee
+9  A: 

I'd say they are production ready - I'm using them in production - but there are several things to consider:

Performance

MooseX::Declare and dependencies do almost all of their magic at compile time. Depending on the size of your program, you might find anywhere from half a second to several seconds of additional initialization overhead. If this a problem, don't use MooseX::Declare.

At runtime, the main overhead is type and argument checking, which you should (ideally) be doing anyway. That said, Moose type constraints have some overheads, namely coercion and the more complex (MooseX::Types::Structured-style) constraints. Don't use these if performance is an issue.

Stability

MooseX::Declare and MooseX::Method::Signature's external syntax is now stable. But it is important to know that the internals are subject to extreme change. (fortunately, changes for the better)

To give you an idea, the signature itself is grabbed using a big block of C code stolen from the Perl tokenizer (toke.c). This can break in some situations since it isn't actually parsing anything. The bit inside the brackets is parsed using PPI, which is designed for pure Perl, but the resulting PPI tree is then hacked up to get something useful. Devel::Declare itself is a hack - after it sees specific keywords (e.g. 'role', 'class', 'method') the Devel::Declare-using module must rewrite the source code by hand, with no interaction with the real Perl parser.

Corner cases may cause Perl to segfault. Or rewrite the source code badly, so you get syntax errors but have no idea what's causing them without -MO::Deparse. If you mess up the MooseX::Declare syntax by accident, there is no guarantee that the module will detect this and give you a sensible error. The ALPHA message may have gone, but this is still doing dark and scary things internally, and you should be prepared for that.

rjh
I'm not sure you can guarantee that the external syntax is stable since Moose has no such promises of stability itself.
perigrin
Note that while `does coerce` has a speed penalty, it's also one of the most *awesome* things around. Use it as appropriate, just don't use it for *no* reason :)
hobbs
Thanks. Rewriting the source code does sound scary.
molecules
For the code-writing stuff, I've talked to some Moose people about using Moose in a pre-processor type workflow. A distribution processes Moosified.pm.PL, resolves all the Moose stuff, spits out non-Moose Perl code, and installs that. You can then look at the output to see what went wrong without having to wait until you run a program. If you don't need the dynamic, runtime stuff, I think that's the best way for Moose to go.
brian d foy