Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Trudging along the learning perl path. -- wrong path? :=)

by Anonymous Monk
on Apr 15, 2017 at 20:53 UTC ( #1188020=note: print w/replies, xml ) Need Help??


in reply to Re: Trudging along the learning perl path. -- wrong path? :=)
in thread Trudging along the learning perl path.

Hi Disciplus

So can I safely assume that the good Perl developers use these modules and these are not training wheels for new learners? Meaning professional Perl guys too use modules and they rarely roll their own stuff (unless needed)?

  • Comment on Re^2: Trudging along the learning perl path. -- wrong path? :=)

Replies are listed 'Best First'.
Re^3: Trudging along the learning perl path. -- wrong path? :=)
by shmem (Chancellor) on Apr 15, 2017 at 22:19 UTC
    So can I safely assume that the good Perl developers use these modules and these are not training wheels for new learners? Meaning professional Perl guys too use modules and they rarely roll their own stuff (unless needed)?

    Yes, of course, if they remember that they exist, while solving a problem. For a good programmer, pulling unique values out of an array is an easy thing, and it is written quickly. If it is a small bit in the overall task, they just write it inline, and done. But if it is to be done all over the place, and/or the program deals extensively with lists, they will pull in List::Util for sure, instead of writing subroutines already written.

    Good programmers know when to use a module; and good programmers also understand the modules they are using. They use modules, because they are lazy and won't solve things already solved; because they are impatient and want to see their job done, so they just include things already done; and because doing that, their hubris can unfold making just their own code bullet proof - because the modules they include are tested elswhere, and they avoid the technical debt of maintaining, testing and improving stuff written by somebody else: it is somebody elses burden.

    Of course, paraphrasing Fred Allen, "CPAN is a medium because anything well done is rare" - there surely are lousy modules on CPAN, but many gems. To tell them apart, you need expertise, and you get that by experience, which besides trial and error and reading documentation means learning from others. So, yes, modules are also training wheels for new learners, and I recommend reading their source code. If after reading you frown upon them, or feel enlightened, that's a good sign; but beware: you might frown for the wrong reason, or have been enlightened by false lights.

    update: s/List::Utils/List::Util/ - thanks Discipulus

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
Re^3: Trudging along the learning perl path. -- wrong path? :=)
by Discipulus (Abbot) on Apr 15, 2017 at 21:37 UTC
    Hello again,

    While i'm not a professional perl developer, but i bet yes; i saw them.

    Then, have you seen my signature? ;=)

    But look from another perspective: having or well using a module is a little price you pay, generally. If you use core modules, which every perl incarnation has ( http://perldoc.perl.org/index-modules-A.html ), the way is super plain: they are, for sure, better implemented than my or your code, they are tested a lot, they will remains stable during ages..

    Normally a well desinged module push in just the code you want like in use List::Util qw(any); so you pay quite nothing.

    CPAN is full, leterally, of useful modules too; here is preferable to choose carefully a well developped module, a famous and widely tested, or be able to understand what it is really doing: the risk to indroduce something unxepcted is present; with core modules is rare (by experience if i find something wrong with perl itself and it's core module i start looking for what i misunderstood about..).

    Experimental features are by other hand to avoid unless playing with the language to learn.

    I smiled the last time i was called Disci+ anyway; Discipulus is ancient latin word meaning pupil or student ;=)

    PS: another good way to learn is creating an account on perlmonks.org asking and observing questions from others and their replies

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^3: Trudging along the learning perl path. -- wrong path? :=)
by stevieb (Abbot) on Apr 15, 2017 at 23:46 UTC
    "Meaning professional Perl guys too use modules and they rarely roll their own stuff (unless needed)?"

    I'm not officially a professional Perl guy, but I promise you, the best of the best use what is already available, as long as it has a good test suite, an extremely high test pass rate, along with very good documentation and even better if the distribution's author is reachable for questions and feedback.

    Regarding the "rarely roll their own stuff", that's not just "unless needed". I have written distributions on the CPAN not because I needed it, and not because there are already duplicates, but because I needed/wanted to expand my knowledge on a specific area, and at the time, I had a need for a module that would allow me to gain that experience while writing something that was already written.

    Not all of my duplicate efforts have made it to the CPAN, but many have. There's nothing wrong with that, it's just a different way to achieve the same goal. I typically note the other modules that do the same thing in my documentation, and in some cases I've had authors of the similar distributions contact me to discuss my own approach. Re-writing something isn't always a waste of time is what I'm saying here.

    I'm not necessarily for re-creating the wheel, so when it comes to the basics and re-learning, knowing completely how to integrate other modules into your code and use other APIs are just as important as being able to do a print "hello, world!\n"; imho.

    Just as important however, is understanding and fluently using the common idioms, as some things just aren't worth trying to re-work/reproduce and there are better things to re-invent for learning purposes.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2019-05-23 19:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (146 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!