Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!


Forgot your password?
Perl Programming

Why JavaScript Is the New Perl 453

theodp writes "'People are thoroughly excited [about JavaScript],' writes Lincoln Baxter. 'However, I'd akin this to people discovering Perl during the advent of C and C++ (mirror). Does it work? Yes. Is it pretty? Not by a long shot.' Baxter adds, 'While I do like both languages, JavaScript [is] just waiting for the next technology to come around and make it look like Perl does today: pervasive, but lacking enterprise adoption on large applications.'"
This discussion has been archived. No new comments can be posted.

Why JavaScript Is the New Perl

Comments Filter:
  • Re:Readability (Score:4, Interesting)

    by Animats ( 122034 ) on Sunday January 06, 2013 @07:50PM (#42499267) Homepage

    Why can't the language resemble more readable (English, or native language) rather than obfuscated math.

    Because page after page of MULTIPLY A BY B GIVING C ON SIZE ERROR STOP RUN really sucked. put background field "name" of card n of background "data" after card field "list" wasn't much better.

    The problem with Javascript is not that you can't write good Javascript programs. Javascript has an adequate feature set, the syntax is no worse than C, and reasonably fast implementations are available. It's that the language encourages the writing of bad code, which then has to be debugged by others. Object-oriented programming was retrofitted into Javascript, and it shows. Typical bad Javascript has global variables that should be local, shared data that should be in closures, no proper objects, and no comments.

  • by lattyware ( 934246 ) <gareth@lattyware.co.uk> on Sunday January 06, 2013 @08:17PM (#42499447) Homepage Journal
    https://www.destroyallsoftware.com/talks/wat [destroyallsoftware.com] - Give that a watch - it's short and amusing, not some huge rant or dissection (begins on Ruby, moves to JS). Done watching? JS is full of that kind of horrific design that makes code do stuff you don't expect, and it lacks features that everyone needs. It just makes development harder, and that's the reverse of what you want a language to do.
  • Re:I don't.. (Score:5, Interesting)

    by dkf ( 304284 ) <donal.k.fellows@manchester.ac.uk> on Sunday January 06, 2013 @08:24PM (#42499497) Homepage

    1)Web programmers tend to be lower skill programmers. ...

    2)There's a hack it and get it done mentality to web programmers. ...

    I agree with these two statements. But your next one:

    3)The entire AJAX and framework of web programming is wrong. It was a quick hack added so that you could make dynamic apps using existing technologies without major changes to clients. But its layered hack upon hack upon hack. We really need to scrap it all and come up with a web application programming stack- a new markup language that's meant to do pixel perfect rendering (HTML is not, but its used that way), an HTTP replacement that's stateful rather than stateless, a cleaner way of sending data back and forth from the server. But if you write on top of an ugly platform, you're going to get ugly code.

    That's just ignorant of how nasty client programming really is. The reality is that using a stateless base layer of HTTP and building a state system on top of that (e.g., with REST) is significantly easier to make work properly in a hostile physical network environment than what you propose.

    AJAX is one heck of a lot easier to deal with though once it's been tamed with a library like jQuery, and once you've wrapped your head around asynchronous programming. Some programmers never really get async programming (I feel sorry for them, missing out on such powerful techniques) but it is really very useful for almost all network and GUI coding. There's no shame in using a library to make networking nicer; raw POSIX socket calls are horrendous from the perspective of the vast majority of application programmers...

    4)Language issues. Javascript was never a good language- hell, you can tell that from the fact it's very name was a blatant marketing maneuver. Lack of a good object model is a real problem.

    There's not much wrong with prototype-based object models; they're different, not wrong. If you were going to rag on the language design, it would be far better to grouse about the "fun" gotchas in scoping and the way one handles modularization...

  • Re:I don't.. (Score:4, Interesting)

    by shutdown -p now ( 807394 ) on Sunday January 06, 2013 @11:27PM (#42500453) Journal

    The language itself is pretty nifty, if you understand and use its functional aspects.

    Can someone explain why JS fans keep trotting this "functional aspects" bit as if it were a redeeming feature of the language? It may have been in the 90s, but we came a long way since then. All competing "scripting" / dynamic languages have the functions as first class types and function literals (even PHP!), and most of them have better, more concise syntax for them, too - e.g. Python lambda x: x*2 or Ruby {|x| x*2} vs JS function(x) { return x*2; }. Heck, even C++ has that these days! It really isn't the kind of feature that you get to show off and tell how cool it is.

    And, that aside, what else can JS boast of? Prototype-based OOP is a dubious feature at best, and everything else in the language is a mess, from magical semicolons to scoping rules for local variables and "this".

    It's more logical than PHP, though, I'll give you that.

  • Re:Modem noise (Score:5, Interesting)

    by shutdown -p now ( 807394 ) on Sunday January 06, 2013 @11:50PM (#42500567) Journal

    Can you give some examples of "new language features" which don't "fit within the OOP paradigm" and which look horrible in Python?

  • by drolli ( 522659 ) on Monday January 07, 2013 @12:29AM (#42500849) Journal

    perl has a very specific scope
    js has a very specific scope

    The overlap between the two scopes is not big.

    for tasks in the center of its scope, perl is still the best - filtering some plain text file is just easy in perl. Perl never ran on any browser. but perl ran on pretty much anything else (I used it on DOS)

    And js was never used in a significant extent to filter text files.

    js in not new (so it can not be the "new" perl)

    perl was inteded as an easy to learn extension-mixture-replacemnt of shell,tcl/tk,awk,sed. It still is and it is working well. (although tcl/tk still has something going for it (robustness, easy cross-platform gui)).

    if there is on thing, which would be "the new perl" then it would be php. Most of the www things which would have been written in perl from 1995-2000 now are written in php.

  • Re:I don't.. (Score:4, Interesting)

    by LingNoi ( 1066278 ) on Monday January 07, 2013 @04:29AM (#42502397)

    Web programmers tend to be lower skill programmers.

    This is a common misconception among c / c++ developers. Fact is it's simply not true, you have to deal with a multitude to complex issues that you simply don't need to deal with in native code development. I do both web and native code development and I can tell you that the tasks are just different not easier or harder.

    Your atitude in this respect reminded me of a guy that recently applied for a job position at the company I work. He was a c++ developer who wrote on his cover letter something along the lines of "I don't know any web development however because of my experience in native languages I think I will be able to easily pick it up". That's simply naive and wrong, as you can expect he wasn't selected.

    As for the rest you wrote I agree and disagree at the same time. Sure there are a lot of "make it work" attitudes however you get the same atitude in native code development too so it isn't something restricted to web development.

    a new markup language that's meant to do pixel perfect rendering (HTML is not, but its used that way)

    No, no it is not. People who think like this do not understand web development, and almost no one apart from terrible developers treats it in the way you mentioned. Websites have to be designed to fit on everything from small mobile phones to big TVs. That's why everyone is trying to make their sites "responsive". Everyone is moving in the complete opposite direction to what you have mentioned in that the best way to build a site is with a css grid to make your site handle different resolutions.

    I agree that javascript is a terrible language fortunately things are improving if you look at the latest standards being developed for newer versions. I guess we can only hope that it improves to the point where it doesn't just outright suck.

Logic is a pretty flower that smells bad.