Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Convincing management for OO

by pwagyi (Monk)
on Mar 02, 2017 at 05:49 UTC ( [id://1183348]=perlquestion: print w/replies, xml ) Need Help??

pwagyi has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

The company I am working in relies heavily in perl scripts to do data extraction, validation, report generation, process automation.

Unfortunately, these scripts are written in procedural/shell scripting style. There are a lot of duplicates.

Here is an example. There is a script (let's call it script A) to read data (there is a specification for this data), and generates some output.

When another report is needed with some minor difference in output, script A is copied and modified!

Senior developer insists that modifying/refactoring existing code is a lot of efforts and Object Orientation is just a fancy. So how can I convince management that adopting OO/Moose will benefit?

Replies are listed 'Best First'.
Re: Convincing management for OO
by choroba (Cardinal) on Mar 02, 2017 at 06:00 UTC
    Make a proof of concept. Take several scripts that are similar to each other, rewrite them into modules, write tests. Show them how the number of lines to maintain was reduced, how easy it is to extend it. Shorter time to deliver, less bugs to appear, and if so, most of them caught before the code goes to production. That should convince them.

    You might need to talk to your manager to get their support to do it during working hours, otherwise, you'd have to sacrifice your spare time.

    I've been in a similar situation. My manager supported me a lot in the effort, but in the end, the best solution was to quit the company. May you be luckier!

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

      Yes, I'll try to write some common scripts into modules and demonstrate the benefits. :)

      But it is very unlikely since some old developers are too used to scripting approach with 100+lines of subroutines.

Re: Convincing management for OO
by soonix (Canon) on Mar 02, 2017 at 09:00 UTC
    OO scripts can be copied and modified as easy as procedural ones. What you should introduce is modularity. They are different concepts. They work hand in hand and favour each other, but they are different concepts.

    choroba's advice about proof of concept is good in any case. Show your managers (and/or your Senior colleagues) how building a library of modular, reusable routines can help. If you then still want to further OO, you can build upon how it supports modularity.

      yes, you are right. OO is just one way of achieving modularity. Reading data, processing, outputting/formatting are in a single script...for all existing scripts. :(

        That's your starting Point: compare the variants of those functions that you want to centralize by your module to find out how you should parametrize them. Then, instead of copying and modifying, set a good example by copying and creating a module (and, of course, eventually using that).

        This will take more time, so you might have to do it alongside, but once it is usable, you can use it to convince your colleagues (I don't think your management mandates copy-paste-programming) to take this road.

        Of course, further adaptations/modifications of the new "central" module can break those scripts that already rely on it, so it's important to include at least rudimentary tests, lest it will be turned into an argument against modularization…

Re: Convincing management for OO
by huck (Prior) on Mar 02, 2017 at 09:49 UTC

    modifying/refactoring existing code is a lot of efforts . That may be true, but do you have to? Propose this as a way forward. Like choroba mentioned Re: Convincing management for OO having a good set of modules makes future tasks easier. You may be able to just start doing it Find the common parts of a whole bunch of prior art and make some real good reusable modules. Use them in the next project. Then projects after that too. If prior art needs to fixed refactor/rewrite then.

Re: Convincing management for OO
by Your Mother (Archbishop) on Mar 02, 2017 at 22:28 UTC

    Why Moose? Data munging is one of the places OO is probably least likely to help and Moose has a pretty big startup cost and a fairly big object inflation overhead.

    You already got good advice about it. I’m strongly with soonix here. You want modularization. OO? Maybe, maybe not but there are plenty of options there besides Moose and I don’t know your needs but data munging tends to be an area where performance matters.

Re: Convincing management for OO
by soonix (Canon) on Mar 03, 2017 at 08:43 UTC
    Senior developer insists that modifying/refactoring existing code is a lot of efforts
    You don't need to prove them wrong (you can't, because, done right, it is a lot of efforts).

    You can win them over by showing that these efforts are a "one-time high", and that they pay off (within a reasonable future, which you should also take into account).

Re: Convincing management for OO
by Anonymous Monk on Mar 02, 2017 at 18:14 UTC
    Move on. Your talents are being wasted at that gig.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found