Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by Anonymous Monk
on Apr 21, 2015 at 22:44 UTC ( [id://1124198]=note: print w/replies, xml ) Need Help??


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

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

  • Comment on Re^4: How do I go from PROCEDURAL to object oriented programming?

Replies are listed 'Best First'.
Re^5: How do I go from procedural to object oriented programming?
by jeffa (Bishop) on Apr 22, 2015 at 15:23 UTC

    "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)
    

      and here I thought you were well aware of her hosting situation ...

        Why should anyone be well aware of any such thing?

        Anyone who is successful knows that they need to understand certain technical details (or hire professionals). Using hosted solutions is very much not ideal. You seem to be trying to hold Lady_Aleena back and keep her scared from using new technologies. Nothing you have said has been helpful. All you are doing is ranting and raving because you don't like Moose.

Re^5: How do I go from PROCEDURAL to object oriented programming?
by Anonymous Monk on Apr 22, 2015 at 03:10 UTC
    Eschew new technology so that you may cling to the past. That is not wise.

    http://perldancer.org

    There. Problem solved. :D

      Eschew new technology so that you may cling to the past. That is not wise. http://perldancer.org There. Problem solved. :D

      What does that have to do with the bloat that is Moose?

      The future runs on old technology, upgrades aren't free, pretending constraints don't exist is boring

        Anonymous Monk, my only constraints are Perl 5.8.8*, current versions of modules which still work with 5.8.8., and my own understanding of perl and programming in general. My goals for the present of still the same as you see on my home node and the list of things I need to get a grip on on my scratchpad.

        * I have begged my web host and cPanel to use a newer version of Perl to no avail. Even 5.10 would be a big improvement. I loathe having to work under 5.8.8.

        No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
        Lady Aleena
        Perhaps YOUR future runs on old technology, but my future is so bright that I gotta wear shades.

        Your attitude works well against Perl, by the way. In case you didn't notice those antiquated (and most likely monolithic) CGI scripts are being replaced around the globe with technologies based on Java, Python, Ruby and C#. What you suggest would further cause Perl to lose market share.

        How you like them constraints?

        A reply falls below the community's threshold of quality. You may see it by logging in.
Re^5: How do I go from PROCEDURAL to object oriented programming?
by Anonymous Monk on Apr 22, 2015 at 16:15 UTC
    "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

      Anonymous Monk, using other people's objects is easier than writing them which takes a very different mind set from what I have now. What else should I use for my params if CGI is on its way out? I have not seen any suggested substitutes for CGI's param.

      No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
      Lady Aleena
        I am not the Anonymous Monk that was attacking jeffa for using Moose. Did you know that CGI.pm has been removed from the Perl core? This means that your hosting provider could one day perform a major upgrade that results in you no longer having access to the CGI.pm they provide for you today. Now is the time to find alternatives: CGI::Alternatives.

        Maybe all you need is CGI::Lite.

      ... the only time she actually uses CGI.pm is to gather query params ...

      Who mentioned CGI.pm?

      I was talking about Common Gateway Interface, the non-persistent execution environment

        You meant something barely anyone uses anymore and no one should use for at least ten years already.

        Using Common Gateway Interface, the non-persistent execution environment, should be considered a misconfiguration.

        Jenda
        Enoch was right!
        Enjoy the last years of Rome.

        You did. You clearly never mentioned Plack, which is where everyone now is.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-25 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found