Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: Main routines, unit tests, and sugar

by BrowserUk (Pope)
on Jun 16, 2013 at 16:50 UTC ( #1039226=note: print w/replies, xml ) Need Help??


in reply to Re^3: Main routines, unit tests, and sugar
in thread Main routines, unit tests, and sugar

Any important code resides under one App::MyApp namespace, and not split across App::MyApp and myapp.pl

It was mostly humour, but ... you still need myapp.pl in order to invoke your application.

Which means you added an extra file (your App::MyAPP.pm) -- and an extra level of callback trace to every error message, etc. etc. -- and made the (still) required file almost empty and what did you gain?

IMO nothing. You added the need to chase off and track through where this module file lives -- not always obvious with lib, site/lib, site/vendor/lib, use lib et al. -- just in order to see what it does; what its dependencies are ...

That almost empty file, the .pl, is still used. What is the point in adding an extra file in order to make this one almost empty? There is no logical justification for it.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^4: Main routines, unit tests, and sugar

Replies are listed 'Best First'.
Re^5: Main routines, unit tests, and sugar
by vsespb (Chaplain) on Jun 16, 2013 at 17:22 UTC

    Well, if the application is small enought to fit to one file, your arguments are valid

    If application already consists of several files (i.e. it's not a small 500 lines script), the benefits I described outweigh that fact that you need another file

    You added the need to chase off and track through where this module file lives -- not always obvious with lib, site/lib, site/vendor/lib

    It must be irrelevant if we talk about CPAN deploy. More that that, if user has a mess with @INC dir, it's actually better to have all application files in one @INC dir, than having half of application is @INC and half in bin (/usr/bin, /usr/local/bin/ ~/bin /opt/myapp/bin etc) (if we assume that there is a mess with @INC, we can assume there is a mess with $PATH too)

    Having site/lib, site/vendor/lib is actually a feature, so people can deploy with CPAN or with OS package manager at same time, it's an advantage

    extra file

    Minor issue, if you already have several files

    an extra level of callback trace

    There won't be extra level of stacktrace if you just split code to files. Extra level added if you split it to subroutines

    So it's valid argument if we talk about having some startup code in one "main" subroutine vs having some code unwrapped to subroutine in main package

    callback trace to every error message

    Imho stacktrace should appear if unexpected/programmer error happened (assertion, like "confess"), otherwise there should be clear error message and no stacktrace is needed. But it's probably matter of script quality

      the benefits I described

      You had not -- and still have not -- described any "benefits".

      At best you've outlined your personal preference for adding an extra layer to your applications for no good reason.

      But they are your applications, so do as you will. (Just don't try to feign some CompSci justifiction for it. )


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039226]
help
Chatterbox?
[Marshall]: stevieb wish you well with water problems, my water was off all day Monday for repairs. Any more progress on .exe info problem?.
[stevieb]: Marshall: no. I commented on the thread yesterday. Visual Studio updates the tags ok, but corrupts the exe
[stevieb]: I advised the OP that a possible workaround would be to add a version function/flag that displays the required copyright/license info instead
[Marshall]: Darn! I'll look at the thread. Must not be updatinga byte count somewhere. The .exe format is a complex critter.
[stevieb]: that way, it's still "hard coded" into the exe at least, despite not being visible via Properties
[Marshall]: I also looked into PerlApp from Active State, but they don't sell their Dev Kit independent of a very expensive ($1,200) per year license anymore.
[Corion]: I would assume that the PE format hasn't changed that much since the days of yore, but it seems that I would be wrong in that assumption
[Marshall]: When I bought my copy 15+ years ago, it was just a couple hundred bucks.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2016-12-08 18:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (144 votes). Check out past polls.