Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

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


in reply to Re^2: 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?

Replies are listed 'Best First'.
Re^4: How do I go from PROCEDURAL to object oriented programming?
by Anonymous Monk on Apr 21, 2015 at 22:44 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?

    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)
      

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

      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

          A reply falls below the community's threshold of quality. You may see it by logging in.
      "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

        ... 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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-03-29 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found