Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: A use strict confession, with real questions.

by eyepopslikeamosquito (Archbishop)
on Jun 05, 2015 at 04:23 UTC ( [id://1129158]=note: print w/replies, xml ) Need Help??


in reply to A use strict confession, with real questions.

So I've got a ton of code right now (a well built system) that does not use strict, has tons of subroutines and is very well organized that uses my $var, at every occassion, and, uses return(); when no return $var is required. It's clean, efficient and it works.
How much of this "well built system" has regression tests around it? I'm afraid refactoring working production code without the safety net of a comprehensive test suite is tantamount to suicide. So your first step may be to write a comprehensive regression test suite for your system.

Since this may be a daunting task, can you break your large system into smaller components that can be tested in isolation? (sounds problematic due to your heavy use of globals). If you can do that, at least you can then convert the system to be strict-safe one component at a time.

It uses a lot of requires IE 'process.pl', 'whatever.pl'. (files required only when necessary)
Does your system currently use Perl modules? You might consider converting some of your scripts to modules, see for example How a script becomes a module.

Update: See also: So I'm in a bit of a quandary

Replies are listed 'Best First'.
Re^2: A use strict confession, with real questions.
by perlidiot123 (Acolyte) on Jun 05, 2015 at 04:50 UTC

    If you can do that, at least you convert the system to be strict-safe one component at a time.


    yes, this... I think I've got it.

    How much of this "well built system" has regression tests around it?


    Never been that route, but probably About 20 million dollar wise in transactions to date; hundreds of thousands of transactions.

    What's a regression test? I don't do corporate perl, I just do perl.

    write a comprehensive regression test suite
    Ok I was looking for some real world stuff to deal with this but I think I got what I needed based on your 'one component at a time' comment. Thanks much for your input. :-)

      What's a regression test?
      Currently, how do you test your software? Is it ad-hoc manual testing? Or do you have formal manual test plans you run through? Or do you use automated testing?

      As you change your code to use strict, there is a risk that you may accidentally break a working system. If you have an automated regression test suite in place, you can:

      1. Run the automated test suite. It passes. Good.
      2. Make your code changes to make the code strict-safe.
      3. Re-run the automated test suite. If it now fails, you know that your code change broke the system.

      Of course, if your automated regression test suite is mickey-mouse, passing all the tests doesn't mean much. But if you have a comprehensive test suite in place it gives you much greater confidence that you haven't accidentally broken the system while cleaning up the code.

      BTW, note that Perl itself has a comprehensive automated regression test suite (run with "make test" when you build Perl). This test suite is an invaluable safety net to Perl developers as they change the (fragile) perl C source code.

      Welcome perlidiot123,

      Try using <ul><i> and </i></ul> around comments from a previous post like this:


        If you can do that, at least you convert the system to be strict-safe one component at a time.

      yes, this... I think I've got it. ( your comment )


      IMHO, It helps the readers understand your responses.

      About your real question, I think its a slow process of fixing existing scripts one at a time.

      About 8 years ago I had the same situation. I starting using strictures, but only if I needed to update an existing process. Many of the old are running in production without re-write, but if I add something new or need to update a process, you can be sure I use strictures plus better Perl techniques.

      Every time you look at older code, you can see a better way. Good Luck!

      Regards...Ed

      "Well done is better than well said." - Benjamin Franklin

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-28 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found