Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: How do I go from PROCEDURAL to object oriented programming?

by Anonymous Monk
on Apr 20, 2015 at 23:17 UTC ( [id://1124086]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I go from procedural to object oriented programming?
in thread How do I go from procedural to object oriented programming?

Moose under CGI? Just say no

Replies are listed 'Best First'.
Re^3: How do I go from PROCEDURAL to object oriented programming?
by Anonymous Monk on Apr 21, 2015 at 21:59 UTC
    Moose under C G I? Just say no

    What a completely pointless comment. Are you suggesting that one cannot use Moose because they are still using C G I? The reason I put spaces in "C G I" is because if one searches for C G I without spaces, the only match is yours. This means you are the only one who mentioned it at the time. Why? So which is it: use C G I or use Moose?

      Moose under C G I? Just say no What a completely pointless comment. Are you suggesting that one cannot use Moose because they are still using C G I? The reason I put spaces in "C G I" is because if one searches for C G I without spaces, the only match is yours. This means you are the only one who mentioned it at the time. Why? So which is it: use C G I or use Moose?

      Lady_Aleena is writing code to run under CGI, Moose is too slow when run under CGI -- too much overhead for no benefit

        "Lady_Aleena is writing code to run under CGI ..."

        I was wondering what you were on about there. My code is not meant to replace what the OP already has. This code is meant to demonstrate just one of the many ways you can translate the original code into objects. You don't have to use Moose. The OP doesn't have to use Moose. CGI was never mentioned and the only reason i chose to use Moose is because i am familiar and comfortable with it and i have no problem writing scalable applications with it. To borrow a quote: "In other words, I saw no good reason to expose novices to the core mechanism of object orientation."

        Additionally, rather than merely dismissing a technology you should offer at least two replacements. You could have mentioned Moo or Mouse, or Class::Tiny or Role::Tiny ... but you offered no alternatives. You didn't even discuss using "the core mechanism," AKA:

        package Object; sub new { bless {}, shift } 1;

        One of the key components in great software design is loose coupling -- if you think about, you are practicing tight coupling by adhering to some artificial requirement that the OP has to use CGI. That is 20th century technology and we are indeed living in the 21st century. Care to join us?

        jeffa

        L-LL-L--L-LL-L--L-LL-L--
        -R--R-RR-R--R-RR-R--R-RR
        B--B--B--B--B--B--B--B--
        H---H---H---H---H---H---
        (the triplet paradiddle with high-hat)
        
        Eschew new technology so that you may cling to the past. That is not wise.

        http://perldancer.org

        There. Problem solved. :D

        "Lady_Aleena is writing code to run under CGI, Moose is too slow when run under CGI"

        Her code just spits out HTML using methods that she wrote. The only time she actually uses CGI.pm is to gather query params, which is done by instantiating an OBJECT (oh the irony), not by importing into her namespace. She avoids CGI.pm generation methods in favor of her own home rolled ones -- which have a high potential for being more of a bottleneck than Moose under CGI. Moose under CGI is not going to have anywhere near the negative impact you are suggesting on her code. Making your classes immutable can often speed things up, by the way. The suggestion to use Dancer was spot-on.

        Really -- what you should be preaching is:

        JUST SAY NO TO CGI.pm

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1124086]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-29 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found