14 ms·
Why Did I Choose Perl When Building Crowdtilt?
- caycep 14y agoDoes anyone have a good handle on how good perl interpreters are, or whether there are perl "compilers" that do something fancy, i.e. turn it into bytecode? What with all the fancy compiler/interpreter technology going into things like V8, Nitro, pypy, cpy, etc, would be interesting to see how perl is keeping up in terms of speed.
- uvtc 14y agoPerl 5 has been around for a while and has seen quite a bit of optimization. It's fast.
- singingfish 14y agoAnd the regex engine is amazingly fast (there is one faster I believe). Try throwing a 20,000 item list at this little program, and then use the resulting regex to match another 20,000 items and see how long it runs (hint: not very, considering): #!/usr/bin/env perl use warnings; use strict; use Regexp::Assemble; my $ra = Regexp::Assemble->new; while (<>) { chomp; $ra->add($_); } print $ra->re . "\n";
- singingfish 14y agoWell I'm told that newer versions of perl optimise alternations internally and this is redundant now: my $re = join "|", @list; my (@matches) = $txt =~ /$re/g; Quicker and faster...
- ujeezy 14y agoHow do you find hiring? A Blekko founder said they chose Perl partly because as one of the few hot startups to be using Perl, it would make them a top choice for great Perl hackers.
- knighthacker 14y agoI personally wouldn't work for a company ONLY because of the programming language. I have to be super passionate about their product as well and then the language choice comes after. So far hiring hasn't been a problem for us. However, we don't focus on hiring Perl hackers, but outstanding hackers instead. They grow to enjoy Perl after a few hours and sometimes during the interview ;) haha
- ibejoeb 14y agoI've heard this argument before: I'll build my product using X because nobody else is doing it, so all the best Xers are going to line up. I can't speak for the author, but I haven't seen it quite work out. Unless you're talking exclusively to language/stack zealots, the best guys are evolving the tools, and the next-best are evolving with them. That's not to say that all things old are bad and all things new are good, but we do tend to get better at different classes of problems. As the author suggests, though, Perl has this incredible longevity and extensibility. I really like it whenever I work with it, and it wouldn't be a turn-off if I was considering working there. But if someone came to me and said, "I want you to develop a To-Do web app in C++," I'd probably pass.
- blantonl 14y agoIn all fairness, I think it depends on what "X" is in your case. If you've decided on Prolog as your language of choice, you are going to be limited to a pool of government type candidates and IBM event management gurus. Perl was one of the first mainstream advanced scripting languages to run the Web, so the amount of folks out there that cut their teeth on CGI/Perl is pretty wide and deep. For me, I started writing my first Web apps in Perl, and moved over to PHP.
- lazyjones 14y agoThat's funny, because most of the "hot" startups are choosing/using languages that they can actually find developers for. If great Perl hackers were easy to find, more startups would use Perl.
- 14y ago
- noonespecial 14y agoThe one thing I've learned as a consultant working outside the startup world, in the boring world of everyday business is just how much of the computerized world still runs on perl. I've seen some fantastically made systems and some real stinkers. In the HN echo chamber, it seems like everyone who's anyone has moved on to ruby, rails, python, django, etc. Look into the every-web. My god, it's full of perl.
- knighthacker 14y agoI agree. It is a misconception that Perl is "dying". It powers a lot of the web. It had a bad rep a few years ago due to cryptic-looking codes that were written as a throw away code and somehow spread all over the web :). I was one of the skeptical developers at some point, but then I got hooked :). Modern Perl changes the old rep alltogether. I encourage people to write well architected, maintainable, extensible code and follow design patterns regardless of the language of choice.
- ralph 14y agoRegardless of the structure of modern usage its syntax is still very noisy for the reader. It seems the majority prefer the cleaner syntax that doesn't use punctuation to define the type of access a la BASIC.
- jonathansizz 14y agoYes, the sigils can make Perl code look noisy, especially as Perl uses curly braces and semicolons too. However, they do have a couple of nice benefits: firstly, they make variable interpolation easier (and less noisy!) than in other languages like Ruby and Python. Secondly, sigils make it easy to see what kind of data you are dealing with, obviating the need to scroll through your program to the variable declaration.
- thecoffman 14y agoThe sigils make variable interpolation easier only in the most generic case "interpolate $me". Anything more sophisticated requires a temporary variable.
- jvrossb 14y agoI wonder if this will make hiring easier or harder in the valley?
- knighthacker 14y agoIt is a very good question and I had to think really hard about it in the early days. My take on it is that I appreciate good developers regardless of the language of choice and those are the stars that we want to have at Crowdtilt. Good developers will usually learn any "needed" tools in a matter of hours. In fact, I think if anything Perl would speed up the time it'll take to train a dev and get him/her to have an impact on the product from day one due to how easy is it to learn.
- lawnchair_larry 14y agoIn fact, I think if anything Perl would speed up the time it'll take to train a dev and get him/her to have an impact on the product from day one due to how easy is it to learn. Which will be negated by how hard real-world perl code is to read and maintain.
- knighthacker 14y agoDevelopers that write unmaintainable and unreadable code exist. This has nothing to do with the language. That's where "Good Developers" come in. You don't even need to know how to write code to understand the code written at Crowdtilt or any other company that really uses Modern Perl and have good practices.
- mamcx 14y agoYeah, but the language helps a lot on that. And so, it is related to the language. Comparing the readability of python vs perl/c-like languages show it clearly. In python the readability come as a natural idiom, it is part of their zen!. I found that when I develop in python/delphi/pascal the code is readable by default, but in ANY c-derived language could become messy fast. Something as simply as how align a IF clause. In C-like language I could go wild (and I see a LOT of code that look different, from person to person) and in contrast I read almost any python code as if I was write by myself.
- rotten 14y agoOur company is primarily a Perl shop as well. Hiring is one of the big challenges with a technology stack based on Perl. Especially hiring younger talent who are more interested in the latest trendy language. When I first started here I asked the same question: "Why?" - and I got essentially the same answer as this article. In the end, as long as the development team is comfortable with it, and it works, and there is still a community of supporters, I suppose it doesn't really matter what it is written in. Hey - at least it isn't PHP!
- rdevnull 14y agoGood Story and Dancer is really good. For these that want to give it a try we support dancer on the free hosting at http://1.ai http://1.ai Perhaps how popular a solution for the web is depends also on free or easy hosting options where people can experiment ?
- jmspring 14y agoThere is some decent justification in there, but I think the generic question, in a lot of questions is: Why did I choose to build X with Y? The generic answer is usually: Because it is what I know. The extended answer may include particular features of the language or environment or it may include the support provided by a particular cloud infrastructure. As an example, the stuff I am personally working on now, I mostly use Python because I know it well and the ecosystem for webapps is pretty mature. 7 or so years ago, Python (in particular) mod python wasn't even close to modphp, so I went with PHP. Today, if I was adamant about building on Azure, I'd choose NodeJS (thus JavaScript) or C# because they are first class citizens of the platform. In other words, choice of language can take on many facets. Good to see PERL mentioned again.
- knighthacker 14y agoThere are always tradeoffs, but sometimes you can find "the best tool for the job". And that may or may not be the tool that you know. You gotta be flexible and open to learn other tools that may suit the situation better. In the post I don't bash any other languages at all. In fact, I encourage people to learn other languages too. At the end of the day, it'll help you evolve your thinking process and extend your skill set. Thank you for your comment :)
- jmspring 14y agoNot saying you bashed languages, but made a good argument for PERL. And the points were good and provided substance. Which, personally, I find useful and will likely guide me to look into things I may not know or revisit something I don't know. PERL might be the exception. What I liked about the post - it didn't focus on hype, like that around NodeJS (it's badass rock star tech); additionally it brought up a language no so en vogue. Keep up the good work.
- deleted 14y ago[deleted]
- eblume 14y agoI personally don't like the 'flavor' of most Perl that I've seen or written - and it was my first programming language - but it's obvious that it remains one of the most relevant languages in terms of shipped code. That being said, I don't feel that any of the reasons given in this post are in any way leading to the conclusion 'Use Perl'. In fact I think all of those points apply to just about every major high-level language today. CPAN is definitely a very high-quality system, but I think nearly every language I use has something functionally similar. The same sort of argument works on the other points, or so it seems to me. The one exception is the ease of extending the language. I'm not familiar with that functionality of Perl, but I can say that extensibility of the core language is by far my favorite feature of Scheme. If Perl has a similar ability, then I will absolutely concede that that is a powerful feature indeed.
- knighthacker 14y agoIndeed :). Checkout these modules: Test::Class::Sugar MooseX::Declare Thank you for your feedback.
- ironcamel 14y agoThose are both excellent examples. One modifies the core language syntax to allow for writing tests in a cleaner and easier way. The other one modifies the language to make writing OO code in a new way, one that will be familiar to Java developers. I don't know of very many languages that allow developers to modify the core language via 3rd party modules. That's why Perl will never die - it will simply evolve as the needs of programmers change. Hey, Smalltalk Roles are a nice idea ... ok we'll add those (Moose::Role). Hmmm, lets allow method signatures to declare types for their params ... sure no problem (MooseX::Method::Signatures). Wouldn't it be cool if we could treat arrays as objects and invoke methods on them? Sure, here you go (autobox::Core).
- e12e 14y agoAs has been alluded to in another comment: Which other languages that compare to perl have you actually looked at? Python has rich meta-programming. Ruby has (almost) single-handedly super-hyped and re-invented the idea of domain specific languages (DSLs). Lisp is of course all about this (as is Forth). Javascript builds on the ideas from Smalltalk and (especially) Self to allow you to crazy stuff with how objects work... Java can't do much of this, but the JVM has been bent in surprising ways by efforts like Clojure and Scala... While it is great that you know and like perl -- That particular point in the post (and this comment) seems rather poorly researched. I'm very much on the burnt-by-crazy-old-nasty-perl-legacy-crap side of the fence -- but I can't deny that I see some of the reasons why people would like to use perl -- it's just not for me. The statement "Perl evolves in a ... manner that makes the language always fresh" makes me want to hide under the bed -- if I have to deal with someone else's code in production ;-) Still -- it's a bit strange to see the claim that perl is somehow much more flexible than other comparable languages.
- juan_juarez 14y agoTL;DR - I know Perl.
- leoh 14y agoThis is a great comment. Not sure why it we downvoted in oblivion. Sometimes there's nothing to say about an article, really. Way to drop the hammer, dude. Enough with HN pretension.
- Protostome 14y agoI've had some experience with perl. While it has a lot of advantages (most of them are described in your post) it clumsily support OOP and is very hard to maintain. It's true that perl gets you going pretty fast, But once your code base reaches several hundred classes, you'll really regret ever considering it for production. As a grad student I found myself using it quite a lot for writing quick and dirty scripts for data manipulation until I finally decided to move to python. Since then, I never look back :-)
- ionforce 14y agoIsn't the maintainability of the code a function of who wrote it?
- sbochins 14y agoThat is one aspect, but not the only one. When you start to write complex software you realize that the language, frameworks, libraries, design patterns, etc impact the maintainability of your code.
- knighthacker 14y agoframeworks, libraries, This is basically what Modern Perl and CPAN modules are all about. Checkout Perl Dancer as a web framework for example and you'll see simplicity.
- MetaCosm 14y agoCheckout Moose -- it is one of the thing the author points to about Perl. Tools like Moose do an amazing job of fixing the warts but keeping the power. Moose's support and flexibility as an OOP layer is second to very few. http://moose.iinteractive.com/ http://moose.iinteractive.com/
- jlarocco 14y agoIf the developers don't plan ahead then you'll regret whatever language you choose once the project gets big enough. Perl because it's "write once", Python because it's loose typing, C++ because it's so big and complicated, ...
- singingfish 14y agoI've been playing around with perl over the last 10 years, and over the last 4 years or so doing perl professionally. Because I'm in the job market at the moment I figured I'd take a closer look at Python and Ruby, so I'm concurrently reading two python/ruby books. To be honest, I don't see much in it. If I were to chose one I think I'd have to go with python, because Ruby looks to me, just like perl but with a different set of weird symbols to remember, and a slightly different set of downsides. Python on the other hand looks like a sufficiently different take on the dynamic language problem, so as to be more interesting. PHP I'm not bothering with right now. It's just like perl only with most, if not all of the design intelligence removed.
- UncleOxidant 14y ago"As far as I know, Perl is one of the only languages that can evolve via 3rd party modules." Ummm... What?! There's a long tradition creating DSLs in the Ruby community. Lisp/Scheme/Clojure have macros. OCaml has campl4. I'm sure there are many others.
- singingfish 14y agoNot the same thing. DSLs are not the same as extending the functionality of the interpreter. And it's basically the flexibility of perl as a procedural/functional/declarative/OO language (i.e. lack of assumptions of how you want to work) with its roots in practical natural linguistics (as opposed to theoretical as with lisp) that makes this possible. Yes, that does mean coding with some discipline (Perl::Critic and Moose & friends helps here), and some things are more of a pain in the arse than with a more opinionated language, but it seems a reasonable trade off to me.
- chromatic 14y agoI'll give you macros, but if you define DSLs as "chained methods", many languages have DSL supports. The author's talking about Perl's support for mangling the language itself through third party modules.
- knighthacker 14y agoExactly. MooseX::Declare is a good example.
- rb2k_ 14y agoWhat does Perl have in that regard that Ruby hasn't? Ruby also has open classes and you can chain and modify any of the base classes, be it "String" or "Object". I don't know anything like "MooseX", but that might be because Ruby actually has a somewhat working object system.
- chromatic 14y agoPerl lets you add new language keywords which take effect during the parse phase.
- kanja 14y agoI see these justifications for perl almost every time it comes up - The community, cpan, writing lots of code fast. These are good things, but it's worth pointing out that EVERY OTHER LANGUAGE DOES THAT. Ruby has gem, python has pip - modern languages have these things built in by design. Not to hate on perl, because there's things I like about it, but this article could be retitled "what I like about not using fortran"
- chromatic 14y agoI know of no other language that has anything like cpantesters.org. Everything that gets uploaded to the CPAN gets tested automatically on a large matrix of Perl versions and host platforms, often within minutes of the upload. Furthermore, the entirety of CPAN is the continuous integration test suite for Perl 5 itself. Edit to add: I know why this sounded familiar! I had forgotten I wrote about it recently: http://www.modernperlbooks.com/mt/2012/08/why-i-use-perl-testing.html http://www.modernperlbooks.com/mt/2012/08/why-i-use-perl-tes...
- tlianza 14y agoI use Perl for the Turing completeness.
- berntb 14y ago>> EVERY OTHER LANGUAGE DOES THAT Do you really know about this? I've done a bit of Python lately. The infrastructure isn't close (see e.g. Perl Testers, chromatic had a blog post about it quite recently). Also, CPAN is much richer than pypi.
- asher 14y agoWhich modules are missing on Pypi?
- berntb 14y agoOff the top of my head -- a serious sql parser and the whole TAP test ecosystem. After a while I stopped checking cpan for what I needed, since I just got angry. Another difference: In the Perl world, you can find and have dependency trees with dozens to hundreds of modules installed from cpan -- and you expect it to work, particularly since the module tests by default are run at install. (It is a bit painful with too many dependencies, but it works if you need it.)
- darklajid 14y agoI learned perl in the past (I'd rate myself as ~somewhat proficient~, ignoring 'new style perl'), and I like the language. That puts me in a strange place when I talk to friends: I don't know ruby nor python, but do think that perl's a nice language. A strange position to be in, by now. That said: The do what I mean paragraph kind of reminded me of the Stripe CTF. One of the levels (5?) was vulnerable to pass parameters to a POST handler via query string. In other words: In level 5 in that CTF, if you followed one possible solution, you abused this flexibility. So .. maybe it's not always a good thing? Including this particular reference in the article?
- knighthacker 14y agoYou are exactly right. But for some cases, it is a great thing. You obviously need to know when is the right time to be explicit. I remember doing the Stripe CTF and I was like, I wish all people would learn to be explicit about those parameters. Thanks for the feedback :).
- slurgfest 14y agoSo I usually write Python. Perl has a similar heritage to Python and I think the two are similar in many ways (more in Rakudo). As a Python programmer, I think there is nothing wrong with liking and using Perl. I don't think you should find this uncomfortable or strange. I also think there is no clear-cut reason why you would absolutely have to switch, as long as Perl was still suiting your purposes.
- deleted 14y ago[deleted]
- blantonl 14y agoOf all the reasons why the OP chose Perl for their project, this is the one that makes the most sense: 5. Perl code is fun to write. If you are comfortable in your environment, then moving fast comes naturally and you have far more opportunities to succeed.
- angryasian 14y agoI'm sorry but most of these arguments can be used to defend the use of ruby or python as well.
- slurgfest 14y agoThat's true, they're also true of Perl. These languages have a lot in common and a lot of overlap in what they can be used for.
- agentultra 14y agoI hope the strong testing culture and rock-solid reliability are another good sticking point. CPAN is more than just a repository of modules: it's a tool-chain of software. When you upload a module you get a tonne of feedback about which platforms and versions of Perl the tests fail on, you get reports from CPAN Testers about your library in the wild, and when new Perls come out you get notifications if your library gets broken. The ability for the language to evolve, I think, has been a big reason why Perl is still around. It's able to adopt new features and simultaneously remain backwards compatible for long periods of time (for the most part). I don't use perl most of the time, but when I do I like it.
- SoftwareMaven 14y agoPerl is a really great language at getting things done today. Its failing (and the thing that makes a "mem" perl developer and a star developer) is what happens six months to a year after you complete a feature. If you are willing to have some discipline up front (and the expense of some amount of velocity), it can save your bacon later.
- harbud 14y agoReason no 6: The expression of people's faces when I tell them that I use Perl. “Oh! wow, why?” Priceless.
- nuxli 14y agoDoes he think he has to justify jis language choices to others? Maybe he's worried because someone else might have to read the code someday and they might wonder why it's Perl. What's needed is a way to store code in an "intermediate" form that can easily be translated into whatever scripting language is desired.
- prawks 14y agoNormally I'd just on the author for using a prototype in production, as admitted in point #1, but being open about it garners brownie points. Good article, especially the praise towards CPAN. It seems to get lost in the hustle and bustle of the cutting-edge discussions, undeservedly so.
- gdog 14y agoI'm writing to beginner programmers. Please, please don't use Perl. Use Ruby and/or Python. Other competing scripting might be good (like lua) but I haven't used them. I do know however Ruby and Python are better. see https://sites.google.com/site/steveyegge2/ancient-languages-perl https://sites.google.com/site/steveyegge2/ancient-languages-... 90% still holds true. This guy knows more than 99% of the Perl advocates on this thread (he's also smarter than me). Do another search on other famous programmers (like Rob Pike) and almost always you'll find negative comments about Perl. There a reason companies like google use Python and universities (like MIT) teach in Python. For crying out loud Perl has pointers in it. Perl doesn't do basic parameter checking in functions. Perl doesn't come with a decent repl. The Perl repl doesn't work with readlines. Perl doesn't do sane type checking. print "abc" + 1; prints 1. It isn't a syntax error (like in Ruby or Python). Do some basic google searching. wantarray is one of most horrible things I've seen a programming language thats unique to Perl. You how know generally side effects are bad in functions? Well, I don't want to get into it... but just google it. Perl has a weird cult culture to it. There are a few smart people who are really into it but it isn't because of the languages merits. This is well described by one of perl most famous developers: http://www.perl.com/pub/2000/12/advocacy.html http://www.perl.com/pub/2000/12/advocacy.html No one with a OPEN mind who isn't lazy wouldn't move onto Python or Ruby. Remember too at the end of the day it is how good or bad code theoretically is. Is what you see out in the wild. What you work with. The chances are you won't be looking at chromatic's code. Perl code is about the ugliest, most unreadable code you'll find on average. I recently saw something Brain D Foy (a Perl expert) acknowledging this. The average code is what counts. Anyhow those are my 2 cents. I have to go to sleep.
- cytzol 14y agoYour post gets a number of things wrong about Perl. > For crying out loud Perl has pointers in it. It does? Do you mean references? You'll need to use reference syntax when using nested data structures, but this is the same syntax that you'll find in Python and Ruby - you could think of those languages as using references by default instead of having array or list types. > Perl doesn't do basic parameter checking in functions. This is true - you'll need to deconstruct `@_` yourself. It is a shame. There is Params::Validate and Method::Signatures to fix this. > Perl doesn't come with a decent repl. Yeah, this is annoying. Get Devel::REPL and use that. > Perl doesn't do sane type checking. print "abc" + 1; prints 1. It isn't a syntax error (like in Ruby or Python). This throws a lot of people off, when they expect it to work like Python or Ruby and it doesn't. "abc" and 1 are actually the same type - scalars. A scalar can be a number or a string behind the scenes, and they're automatically converted, so you can just read data from a file and not have to worry about that. You want to use the dot operator, `print "abc" . 1;`, which prints "abc1" (which is what I think you want). In those languages, it throws a type error, not a syntax error, which is an important distinction. Intergalactic law states that you're not allowed to complain about Perl if you don't know this. > wantarray is one of most horrible things I've seen a programming language Having list flattening means you can dump all kinds of data into a function and not have to worry about where it came from. Recently I wrote the line of code `highlight qr/regex/, @colours, @more_colours`, where I just dumped values from arrays into the function and didn't have to worry about destructuring them. If I wanted to pass the arrays, I'd put a backslash before them. It's sort of the opposite of Ruby's unary * operator. Perl has warts just like any other language. Its warts are just more infamous (because Perl is used so much, a lot of people are having to maintain old codebases) and more visible (Perl has a culture of using the CPAN to fix things with the language (MooseX, Modern::Perl) whereas other languages' users tend to just put up with it). I disagree that the average code is what counts. When I helped out on a Python cause, the lecturer barely knew Python, and taught it as though it were C (the students learned while loops first, then for loops, and never actually learned about generators. Yeah, I know). The code they wrote was definitely below-average. But not once did they turn to the Internet to see what proper Python code was like - they just followed the course, and did what it told them. If you learn Perl from a book, the amount of sub-par Perl code in the wild isn't going to affect you. Or, to put it another way: how can someone else make my language a worse one merely by writing in it? I do agree that Perl is a bad choice for your first language: the choices it gives you and the amount it leaves up to you could get confusing when you're trying to learn it by yourself. Perl is a language for when you're a better programmer, and you've learnt to code at a higher level.
- cafard 14y agoI reach for Perl frequently, primarily for two reasons: i. I've been using for 20 years or so, since Perl 4. By the time I check back to verify some point of Python syntax or library use, I will have written the code in Perl. ii. CPAN. It is unusual for me to go there and not find something that I can use for a task. I like Python and do use it a good deal, largely on Windows. Yet some months ago, I ended up writing a few longish scripts to run on Windows, with ActivePerl.