6 ms·
I used to work for a company that used Perl as their primary language. The codebase was millions of lines long, modules (pm files) with like 1000 methods and 1
by benbristow 6y ago
I used to work for a company that used Perl as their primary language.
The codebase was millions of lines long, modules (pm files) with like 1000 methods and 10,000 lines, a total mess and it had 0 unit tests too. Almost beyond salvageable. Left a bit of a sour taste.
They're trying to migrate to AWS but AWS don't even natively support Perl in their libraries. There's a few third party libraries in CPAN but nothing as comprehensive as what's available with official libraries for other languages.
Nothing against the language but I don't know why you wouldn't use literally anything else nowadays. Python or PHP, JavaScript or even Ruby if you're looking for a dynamically typed language. AWS don't even support Perl.
- ugexe 6y agoYour opinion on Perl is based on one code base you worked at on one job?
- w0m 6y agoHonestly that's more than most I think. I've written tens of thousands of lines of perl professionally and I generally share the same opinion.
- nchelluri 6y agoI've been writing (Modern) Perl for about 3.5 years and I disagree that Perl necessarily tends to unreadable code. I really don't think that's true at all. To quote myself from a recent discussion: I think some languages do make it easy to write convoluted code, but through judicious use of coding standards (including a helping of common sense [don't be clever where you can at all avoid it, which IME is ~~almost~~ all the time], code linters, and so on) I think how you use a language plays a huge part in code maintainability. For instance, I've heard PHP get shit on pretty badly all around the web, but I've worked at PHP shops that had nice, clean codebases, and my current Perl codebase is, in many ways, nicely structured. That's not to say there aren't some hairy codepaths that could use refactoring, but I really think that kind of thing, again, can happen in almost any language.
- aeontech 6y agoStrongly agreed. It’s much more about the team, the conventions used, the organization of the codebase, and the coding culture of the team, than it is about a specific language.
- jimbokun 6y agoTrue, but the cultures that grow up around a specific language tend to encourage certain conventions, standards of organization, and team coding cultures.
- ed25519FUUU 6y agoUnder that standard it’s true, but it’s also true for virtually any language and is therefore not a good defense of whether or not a language lends itself to unreadable code.
- nchelluri 6y agoThere are a couple of points in there: 1. You can use virtually any language to write clean code Not sure if I agree with this, though it may well be true. I just know there are some things like Brainfuck where it's designed to be impossible. I realize that language is created specifically for the purpose of making a coder say "WTF", but perhaps there are other languages that are not designed to be so that are really nearly impossible to write good code in. 2. Perl lends itself to unreadable code If you stick to Modern Perl you still might end up with things like `wantarray` in your code so I guess this is kind of true. You need to be judicious in your use of code. Some languages lend themselves more easily to writing clean code, like I feel about Go or if you hate the Go type system, Ruby. Even in Ruby I feel like metaprogramming is ripe for misuse. It's a tough thing to talk about. I don't feel like I wholeheartedly disagree with your sentiment which seems to be "some languages lend themselves to bad code" and subsequently that Perl lends itself to bad code but there is plenty of ambiguity in these thoughts.
- hpcjoe 6y ago
- jschwartzi 6y agoYeah, I've got a Perl codebase that's conservatively tens of thousands of lines, and it's honestly a struggle to write anything in it that isn't a big ball of mud. There's about 50 different ways to do anything in the language, the syntax is infuriatingly obtuse, and you can't rely on any documentation because it will recommend doing things that experts don't recommend doing. The system is from like 2013 and still going, but I really wish I could rewrite it in a language I can actually train people on in a reasonable amount of time. It took the one junior I have about 6 months to get to the point where he could read the syntax without tearing his hair out. It's not really built to create maintainable structures. The libraries and stuff are full of opinionated little "gotchas." As an example, the Test::Simple module will throw errors if you use a number to title a test which is infuriating when you're writing a test which tests all the numbers in the space of acceptable or possible inputs.
- benbristow 6y agoPerl's syntax is really confusing. Especially for example how variables have symbols for different types ($ for scalars, % for hashes, @ for arrays). And if you want to for example pass an array to a function you have to send it manually referenced with like method(\@myArray) which then inside the method is contained in a $scalar. Compared to Python for example where you'd literally just pass the array to the method like method(array).
- mfontani 6y ago> Compared to Python for example where you'd literally just pass the array to the method like method(array). How does one tell Python to pass the contents of said array as distinct parameters to the function, instead of as a lone array parameter? In Perl, that's the difference between foo(@bar) and foo(\@bar) or foo(1, 2, 3) vs foo([1, 2, 3]).
- cesarb 6y ago> How does one tell Python to pass the contents of said array as distinct parameters to the function, instead of as a lone array parameter? With an asterisk: method(*array)
- briansteffens 6y agoHow much and what kind of experience do you think someone should have with a language before beginning to form an opinion?
- runamok 6y agoThey mention aws library support as another major concern too.
- psadri 6y agoPerl used to have one of the most extensive module libraries. One of the things I miss about Perl was it’s more sensible module namespace convention (Eg Net::... for networking related) vs the more hip but confusing and hard to discover naming of node modules.
- matt-attack 6y agoYes, the hierarchical namespace for modules was super nice. Migrating to a flattened package structure of npm was a disappointment. I ended up encoding the same type of structure in internal npm package names, e.g. "@myorg/net-aws-.." and "@myorg/file-..."
- JJMcJ 6y agoLast Perl shop I worked at was newer than the company you described but well on its way toward being like this. Since Perl code is often very compact, it probably needs a higher comment to code ratio than most other languages, but you don't see that either.
- mirchibajji 6y ago> There's a few third party libraries in CPAN but nothing as comprehensive as what's available with official libraries for other languages. That is true. This alone might be a good reason to look elsewhere for new projects. However, for existing Perl codebases, PAWS is comprehensive and popular library, and is generated from the official botocore: https://github.com/pplu/aws-sdk-perl https://github.com/pplu/aws-sdk-perl
- proverbialbunny 6y agoKeep in mind TDD wasn't really invented yet, so it's understandable. Also, CPAN had better libraries than pip did all the way up until I last used Perl in 2015. Ofc, it depends on what you're doing. My point is, there was a reason to use Perl once upon a time ago. The alternatives back then were PHP, C, C++ (the old bad kind), BASIC, assembly, FORTRAN, and others like Smalltalk. Seeing this, it's understandable why Java took the world by storm the same way Perl did.
- cutler 6y agoI don't know about TDD specifically but we have the Perl community to thank for setting the bar for rigorous testing back in the ealry 2000s with the numerous Test:: modules on CPAN.
- snapdangle 6y agoPerl and CPAN definitely do not get enough flowers for their contribution to TDD.
- redis_mlc 6y ago> There's a few third party libraries in CPAN but nothing as comprehensive There's 194,000 modules, which is probably the most of any language: https://www.cpan.org/ https://www.cpan.org/ > Nothing against the language but I don't know why you wouldn't use literally anything else nowadays. Gee, let me see: - Perl's Mojolicious web framework is probably the most powerful today. https://mojolicious.org/ https://mojolicious.org/ - Perl has moderate static typing with use strict; - Perl allows forward references, unlike Javascript or Python. The question is why would I use anything but Perl?