One guy pipes up and asked if I knew what the shortcomings of perl were. I mentioned that obviously a compiled language would run faster than a script, and a few of is other shortcomings, but most of the class seemed to think that there was yet another flaw with perl. scalability .
They all seemed to think that JAVA (insert silence) was God, and superior to all languages. Their main point was that java only spawned one process and could handle hundreds of users and that perl, on the other hand, could not.
I wanted to bring up sockets, and mod_perl but with my limited knowledge on these technologies I just smiled and took their remarks. Even my teacher was flaming me at this point.
So I ask, 1) what should I have told them , and 2) is perl really scalable? and 3) why is perl strictly a love or hate relationship?
-Silent11
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Is perl scalable? (yes)
by Ovid (Cardinal) on Dec 05, 2002 at 21:02 UTC | |
Whether or not Perl is "scalable" can depend upon how you defined "scalable". Do you mean "large projects can run using Perl as the primary language"? I would argue that they can. If you mean "many programmers can work on the same Perl project", then scalability can depend upon the strength of your organization. Do you have strong programmers and good standards in place? Do you have strong project management? These issues, from what I can see, cause problems to crop up quicker in Perl shops than others. However, it's important to note that these problems occur in any shop regardless of the language. Perl, however, has a unique approach. Rather than increase the power of a team to work together (which Java can do), it can increase the power of the individual programmer allowing a smaller team to be more productive in Perl than a larger team working with another language. This can lower overall costs and increase communication (because there are fewer communication paths) and this is a benefit to the success, and ultimately the scalability, of almost any project. I'll finish this by posting an email reply that I made to someone who was concerned about this issue. I don't know all that much about programming. I am under the impression that Perl is fine for fairly low traffic CGI, but C would be needed when the site scaled beyond a certain amount of traffic. Please correct me if I am wrong. That depends upon exactly what you are trying to do and what technologies you are trying to apply to it. For example, I know of a company (that I cannot name) where the programming team was working in C++ to develop a large Web site to manage financial data for customers. A friend of mine was their QA director. After I learned a bit more about the company, I discovered that they had quality management, a sharp QA team and solid financial backing. Further, they were offering their employees generous stock options. I urged my friend to quit the company. This sounds a bit ridiculous, but the problem was due to their choice of programming language (languages like C and Java often suffer the same problem). It takes too long to develop in them. Quite frequently, using a language like Perl allows you to finish your program and move it into production before competitors have even gotten their first compile. With my friend's company, it took them two years to get their prototype working. This means that if it was successful, competitors using a language such as Perl (or Python, Lisp, or other language that's quick to develop in) would likely be able to duplicate their results in only a few months. Further, any new features that my friends company could produce could be duplicated in a much shorter time frame at a fraction of the cost. My friend is now looking for a job. He was convinced they would succeed and every time I talked to him, I was impressed with what they were trying to do, but I was convinced that they made the wrong technology choices. The company has gone bankrupt because the technologies they chose simply took too long to develop in. (side note, not in the email: there was nothing that this company was doing that required C++. It was vanilla CGI with a powerful database backend that DBI would have handled nicely. And yes, I know that the DBDs are not pure perl :)). For more information about Perl's success, you can read Perl Success Stories. If you find that scalability is an issue with your application, switching to mod_perl will likely remove the bottleneck. Further, because of the way that mod_perl is designed, mod_perl programs often run faster than their C counterparts. You also have the option of embedding C in Perl for very time-sensitive tasks. Note that the Perl Success Stories link above has wonderful examples of how scalable Perl can be with the right team using it. Regarding Perl vs. Java: one of my favorite quotes is by merlyn (pardon me if I am misquoting). He was facing an audience of students and there was some discussion of both Perl and Java. One of the students asked him how he dealt with the lack of strong typing in Perl. merlyn replied, "I just smile and move my programs into production before the Java programmer has his first compile." Cheers, New address of my CGI Course. | [reply] |
by Anonymous Monk on Apr 25, 2004 at 16:00 UTC | |
| [reply] |
by Anonymous Monk on Apr 28, 2004 at 14:23 UTC | |
| [reply] |
Re: Is perl scalable?
by mirod (Canon) on Dec 05, 2002 at 20:31 UTC | |
I think for a lot of "corporate-type programers" Perl is intimidating, so they choose to believe the FUD. The same features that make it so endearing to most of us here in the Monastery make it suspect for them: I could go on like this, but it mostly boils down to "I have learnt Java in school, why should I learn something else" and finally to "nobody has ever been fired for using Java". Once they believe in this, then they have to justify this cultural reaction, and come up with tons of mostly-invalid-but-serious-sounding reasons. BTW, Amazon.com runs on Perl, CNNSI uses it a lot, I had people from Boing attend a Perl class, and sure, Yahoo is moving away from Perl, but their plan is to use ... PHP! So scalability does not seem to be a problem for some rather huge organizations. | [reply] |
by perrin (Chancellor) on Dec 05, 2002 at 20:59 UTC | |
| [reply] |
by Anonymous Monk on Dec 07, 2002 at 15:45 UTC | |
| [reply] |
by Anonymous Monk on Dec 07, 2002 at 19:00 UTC | |
| [reply] |
Re: Is perl scalable?
by perrin (Chancellor) on Dec 05, 2002 at 21:07 UTC | |
Ask them this: if Java is so perfect, why don't the largest sites use it? Why don't Yahoo and Amazon run Java? Both of them do use Perl and C, but not Java. You might also mention that TicketMaster/CitySearch runs on mod_perl. | [reply] |
Re: Is perl scalable?
by gjb (Vicar) on Dec 05, 2002 at 20:59 UTC | |
An important question is how one positions Perl and Java in the programming language landscape. Obviously, both are general purpose languages and each problem that can be solved in Perl can be solved in Java and vice versa... well, at least in some way, though the solution that's obvious in one language may be a nightmare to implement in the other. As an example, just try and do some system administration tasks in Java: well, no one is even trying. Try to do some simple data transformations and manipulations in Java, it will only increase your love for Perl. Perl has definitely made its mark in server side web programming, even before Java became a hype, let alone a hit. But here's an important point: Perl has traditionally been used for CGI programming, which -- at least without mod_perl -- requires a separate process for each incoming request. When using Java Servlets, this is not the case since those processes are instantiated at startup of the server. Moreover, servlets can be stateful, while this is a pain to achieve with CGI. So yes, for web programming Java has an edge for certain applications. From a developer's point of view, both languages have their merits. Perl is flexible and allows for very fast development. Java is more strongly typed, has a cleaner syntax and is more disciplined, making it a better choice for "things that are to last" (although a lot depends on the programmer, it's easy to write ugly code in Java too). The conclusion could -- and I think should -- be that there's such a thing as the right tool for the job, at least if the one handling the tool knows how to wield it. What could you have done differently: well, emphasize that Perl is not limited to web programming, but is a very versatile tool for data munching and sysadmin, something that should be important in a course on UNIX. Just my 2 cents, -gjb- | [reply] |
Re: Is perl scalable?
by Abigail-II (Bishop) on Dec 06, 2002 at 12:51 UTC | |
They all seemed to think that JAVA (insert silence) was God, and superior to all languages. Their main point was that java only spawned one process and could handle hundreds of users and that perl, on the other hand, could not. Eh, this was a Unix Fundamentals class, wasn't? I've given Unix Fundamentals classes, and what we do it stuff like browsing the file system, looking at files, editing them, commands like cd, ls, more, cat, vi, grep, find. We talk about in/output redirection, pipes, exit status, awk, sed. A natural environment for perl. What's the deal about processes? If I start a perl program, I start a single process. If I start a Java program, I start a single process. Now, they may claim a perl process is taking lots of memory, but so is your typical Java program. What they mean by "a Java program could handle hundreds of users" is beyond me. You aren't writing operating systems in your Unix Fundamentals class, I hope? In my professional opinion, I find that Java *doesn't* scale. It's wasting too much memory - many applications come with their own Java run-time enviroment (because the "write once, run everywhere is a blatant lie"), and a handful of Java run-time environments quickly consume all the memory available, even if it's 2 Gb. Now, Perl doesn't scale well either, it's also memory hungry. With Perl it isn't so much the run-time environment (although that still isn't memory friendly), but the amount of memory data takes. Mind me, I'm not saying Java is a bad language. It certainly does have its merits. It's syntax isn't complex, and not as rich as Perls. It has strong typing, and for a lot of programmers, Java is a better language than Perl. It keeps you further away from the idiosyncrasies of Unix. This is sometimes a good thing - but try to make a Java program that pays attention to environment variables. If I have to choose between Java and Perl, I can make that decision based on many criteria. For some criteria, Perl will win. For some, Java will win. But scalability isn't a criterium for which Java will be a clear winner (they both lose ;-)). If something really has to scale, with all other things equal, C is the only logical choice. Abigail | [reply] |
by demerphq (Chancellor) on Dec 06, 2002 at 19:25 UTC | |
lisp? :-)
--- demerphq | [reply] |
by shotgunefx (Parson) on Dec 06, 2002 at 22:05 UTC | |
Paul Graham is "Mr. Lisp" so I assume the Lisp code was implemented very efficiently. There's still some Perl in the Store Manager though!. -Lee "To be civilized is to deny one's nature." | [reply] |
by hding (Chaplain) on Dec 06, 2002 at 22:28 UTC | |
by shotgunefx (Parson) on Dec 06, 2002 at 22:49 UTC | |
Re: Is perl scalable?
by chromatic (Archbishop) on Dec 05, 2002 at 23:41 UTC | |
obviously a compiled language would run faster than a script It's not obvious to me why this is the case. It's also not (quite) obvious to me why people think that Perl is interpreted and Java isn't. Perl's biggest shortcoming is that it's so efficient, you can often get your job done before you stop to think about the "right way to do it". Perl's scalability depends on how you do it. I'm sorry this answer isn't more meaningful, but it's a meaningless question. (Is a hammer scalable?) Perl is only a love-hate relationship for people who don't yet grasp the subtleties that Real Programmers (to be elitist) encounter every day. | [reply] |
by perrin (Chancellor) on Dec 06, 2002 at 01:33 UTC | |
It's obvious to me: because they have to run javac before they can execute Java code! As we know, Perl does this step implicitly, and Perl's compiler is so much more efficient than Java's that no one even knows it's there unless they bother to learn something about how Perl works internally. The bottom line for anyone who doesn't already know this: both languages compile to bytecode and then interpret that bytecode. This is also how modern versions of PHP and Tcl work. So, explain to them that Java is no more compiled than PHP is, and see what they make of that. Also, note that while Perl CGI has to do the compilation step every time, mod_perl and similar persistent technologies (and equivalent for PHP and Tcl) just keep the bytecode in memory after the first time it is compiled. | [reply] |
by dws (Chancellor) on Dec 06, 2002 at 01:42 UTC | |
Many JVMs do incremental compilation, using technology pioneered in Smalltalk and Self, though it's probably true that the fact of there being a separate "compilation" phase, by a thing called a "compiler" confuses many people about what's really going on under the covers.
| [reply] |
by perrin (Chancellor) on Dec 06, 2002 at 03:30 UTC | |
by dws (Chancellor) on Dec 06, 2002 at 05:17 UTC | |
Re: Is perl scalable?
by defyance (Curate) on Dec 05, 2002 at 21:18 UTC | |
This should help clear up some of the misconceptions in the Java vs Perl argument... -- Can't never could do anything, so give me and inch, I'll make it a mile. | [reply] |
Re: Is perl scalable?
by dws (Chancellor) on Dec 06, 2002 at 01:04 UTC | |
They're spouting nonsense, probably based on simple ignorance. I've worked on a Perl-based application server that could handle thousands of HTTP requests per minute, corresponding to several hundred logical sessions. We were limited by the network pipe more than we were by CPU. The advantage you get over quicker time-to-market can offset quite a bit of scalability for many applications.
| [reply] |
Re: Is perl scalable?
by mpeppler (Vicar) on Dec 05, 2002 at 21:21 UTC | |
Michael | [reply] |
Re: Is perl scalable?
by hardburn (Abbot) on Dec 06, 2002 at 14:41 UTC | |
Their main point was that java only spawned one process . . . Last time I checked the output of 'ps -A' with a JVM running, Java spawned a lot more than one process. It could just be my Virtual Machine (IBM on GNU/Linux), and I suspect those extra processes are for the JVM, not the actual program. Java might have some superiority with threads, but this is probably a temperary issue as Perl threads continue to get better. | [reply] |
by perrin (Chancellor) on Dec 06, 2002 at 16:07 UTC | |
Also, I remember I used to see separate entries for each thread in top on Linux. Not sure if this is still the case or if ps does the same thing. | [reply] [d/l] |
by emelander (Acolyte) on Dec 06, 2002 at 22:49 UTC | |
"Unlike some other implementations of Unix (such as AIX or Solaris), the Linux kernel itself does not provide an abstraction of allowing several kernel threads to be packaged inside a process. Instead, a special version of the fork() system call (also known as clone()) has been implemented that allows you to specify that the child process should execute in the same address space as its parent. This system call is then used by the Linux threading library to present a thread programming abstraction to the user. From the user interface standpoint, practically all of the POSIX thread interfaces are fully supported under Linux; however, the implementation is not fully POSIX-compliant due to some problems in signaling. The result, however, is that each Java thread in the IBM Java VM for Linux is implemented by a corresponding user process whose process id and status can be displayed using the Linux ps command." http://www-106.ibm.com/developerworks/library/java2/ Updated 2002-12-10 by mirod: turned the URL into a real link | [reply] |
by Anonymous Monk on Dec 07, 2002 at 06:18 UTC | |
by Anonymous Monk on Dec 07, 2002 at 13:50 UTC | |
Re: Is perl scalable?
by Anonymous Monk on Dec 07, 2002 at 06:37 UTC | |
| [reply] |
Re: Is perl scalable?
by TheOtherGuy (Sexton) on Dec 09, 2002 at 16:13 UTC | |
Performance is often misunderstood... most frequently performance issues come from 2 sources... (a) database access, and (b) file system access (like writing logs). What's important to note... neither one of these is related to a particular language. Caching and data pre-preparation go a long way to resolving these issue. Keeping processes resident in memory also can be a big improver of performance... you aren't going to get a clean comparison of JSP to straight CGI if you aren't using mod_perl or something similar. Perl does a lot of jobs well; I think it is much more suited to 'batch' type processing than is java... for example, grab some data out of a database, drop it into an XML file. You then pass that file through a XSLT filter(s); get out some pregenerated HTML, marked up with a bit of javascript. That tends to be seriously scalable... and easy to support and debug. 'Use the right tools for the job at hand' is what I would have told them; sometimes that tool is Java and JSP... but often its not. | [reply] |