Searching for the Best Scripting Language
prostoalex writes "Folks at the Scriptometer conducted a practical survey of which scripting language is the best. While question like that is bound to generate flamewars between the usual Perl vs PHP, Python vs Perl, VBScript vs everything crowds, the Scriptometer survey is practical: if I have to write a script, I have to write it fast, it has to be small (less typing), it should allow me to either debug itself via a debugger or just verbose output mode. sh, Perl and Ruby won the competition, and with the difference of 1-2 points they were essentially tied for first place. Smalltalk, tcc, C# and Java are the last ones, with Java being completely unusable in scripting environment (part of that could be the fact that neither Java nor C# are scripting languages). See the 'Hello world' examples and the smallest code examples. Interesting that ICFP contests lately pronounced OCaml as the winner for rapid development."
Hello, I am the Slashdot Source Code. The answer is Perl. This question is now answered.
Thank you for visiting Slashdot.
... for a difinitive answer to a subjective question.
where's php?
print "hello world";
/* oops I accidentally made a comment, sorry */
Is it just me or where the hell is vbscript on there. I know most people here would rather wipe someones butt than use it, but it is one of popular scripting languages out there.
everyone loves perl.
I think the author is pretty biased away from Java, at least when compared to C#. If you look at the sample code, the class name for C# is always one letter, but for Java it's always spelled out.
Two languages missing are:
Io, which is an awesome, prototype-based scripting language that's super-easy to embed in C applications, and has an incredibly simple and consistent syntax.
REXX (Regina's just one implementation). REXX makes it incredibly easy to do system scripting, with powerful string-manipulation and I/O redirection.
Another one's ficl, which is basically an embedable Forth interpreter. (To all you young geeks out there - LEARN FORTH. You may never need to write a line of it ever in your life, but you'll learn a hell of a lot about how computers work. Trust me on this.)
...but it's being eaten...by some...Linux or something...
Ruby came in second, now lets say i put Ruby on my resume....how much respect will that get? while it was useful to rank the scripts to the author for whatever purpose(prove his point). It is still useless because there is a lack of implentation of 90% of these scripting languages...ergo this changes nothing..my resume is still filled with useless knowledge which won't help me win on jeopardy
For The Best Jazz/Hip-hop fusion > COlD DUCK
Perl can do a lot, but nothing is more painful than having to look at a perl source code. While a program can be written semi readable, when compared to some others, like PHP or python, they typically make me want to stick very large needles in my eyes.
WANNAWIKI Wannawiki WannaWiki WANNAWIKI!
How about the best language for the task you are trying to accomplish?
I've been using AppleScript for a bunch of stuff lately, but when I hit something that wasn't really intuitive in AppleScript that could easily be done in Perl, then I did it in Perl. Obvious, yesno?
no PHP???
You can do dozens, literally dozens, of things with batch files!
Only partially joking, though, as batch files using 4DOS/4NT are really quite powerful.
I guess we won't be seeing any of this then?
Need something highly functional, fast? Use VB. All the Windows functions at the click of a button and none of the low-level crap you have to deal with when programming using a real language like C++. It's amazing that anyone uses a low level programming language like C++ any more for general programming.
So, I RTFA, but I really didn't have to.
Web2.0: I love when people Flickr my cuil and digg my boingboing until my google is reddit and I start to yahoo
Mine, of course.
Hail Eris, full of mischief...
E pluribus sanguinem
combined with outlook (+express), office and Internet explorer
considering the amount of code vbscript that systems on the internet exchange daily
(Karma be damned; I am no better than AC anyway)
bash pwns j00
why anyone would use VB after C# was created is beyond me.
:-)
mmmm....it looks so nice
I am the Alpha and the Omega-3
php for real-time multiuser applications on the high level, C for real performance
perl for non-real-time application (unless you're slashdot and have oodles of resources at your disposal, even then, it's still inefficient)
Everything else: you work for Intel, Dell or Kingston
The slashdot descripton mentions that OCaml is the best. ...But when you follow the link, and look at the bottom of the page regarding the first prize winner, This is the proclamation.
It's not OCaml.
C++ was also praised: "C++ is a fine programming tool for many applications."
If you'd like to try scripting with Java, then I suggest looking into Mozilla Rhino, which allows one to script Java via JavaScript.
I'm a writer, a poet, a genius, I know it. I don't buy software, I grow it.
I like the ease of PHP and the fact I fully understand it helps. I've wanted to learn Perl, but lack the motivation except to perhaps code some patches for /.
Anyone feel the same way about either PHP or another scripting language? When you fully learn one, is there a need to switch?
Remember, when you have more experience with a scripting language, you can pretty much create anything you'll need at a rapid rate. I think that the level of your knowledge determines the effectiveness of the language.
The dangers of knowledge trigger emotional distress in human beings.
VB Script
Zero to a fully-functional Hello World program in 4 clicks.
But VC++ can also do that. So perhaps they are even?
The flip side is that before becoming productive one has to get used to a whole new way of thinking about problems: immutable data, everything is a function evaluation, no sequential statements, no side-effects, rely on recursion as much as possible, especially tail-recursion. But ocaml isn't religious about it: it has imperative features, including for and while loops, sequential statements (essentially successive function calls with side-effects and null output), and so on. After a while, though, you find you hardly need any of that. Maybe it's just me, but the sort of work I do is well suited to the functional approach. Also, it has a rich set of data structures and is pretty much agnostic about them: you can use linked lists, hashes, mutable arrays or records, sets, whatever suits your purposes.
The other drawback is the libraries (modules) aren't as complete as the Perl and Python equivalents (though far ahead of most other competition). I imagine that will get cured with time.
I think that scripting languages like Perl/Python might become the future of programming for admins. With faster machines and so much RAM these days, future systems will be able to quickly compile larger scripts on the fly and will store the compiled program in memory. And scripted programs are certainly easier to edit on the fly than C programs.
Its never the programming language. True, you can write obscure code with perl but the same could be down with C. Having said that, its the right tools for the right job. Perl would be good for certain situations, PHP would be good for certain other situations.
Me? I'd rather choose my scripting *and* programming language by some other measures, which mainly involve:
- portability
- object model
- ease of writing C/asm extensions (for speed!)
- extension modules available in default installation
I have my own choice (not the winner, it's my *choice* - I haven't compared and/or used other ones mentioned too extensivley). I have as portable interpreter, as Java (except it does work, not only claims that), with much smaller footprint; I can code extensions in C using simple syntax (it's very easy); I have already thousands of available modules in the base installation.I am pretty sure, that other tools, mentioned in the report, also allow pretty much the same, some of them do that better, some of them are worse, some are not worth using (as we seen, network stack can be written in PHP) - that's not the point. In my opinion, that report seems like comparing pneumatic hammers, ordinary hammers, sledgehammers and hamsters (mainly because "hammer" sounds similar to "hamster", so what the heck, let's compare them) - by something like color or shape, not by the things they can do.
You shouldn't compare tools like this (well, except for purely academical purposes), it's not useful at all for me. And, if you want to choose your tools basing on such reports, well then, good luck.
Exactly that and more.
I would have thought the best scripting language would be the one a person feels best scripting with. Rather than what some "scientific" study tells me is the best scripting language.
if I have to write a script, I have to write it fast, it has to be small (less typing), it should allow me to either debug itself via a debugger or just verbose output mode.
A big part of being a scripting language is being quick to code. But it seldom happens that you can tell how quick it was to code by how many characters it was. For instance for some tasks (even some scripting tasks), IDEs can help you go faster. Proper, clear error messages and exceptions can help you go faster. etc. The scriptometer didn't measure time to code at all, even though it is much more important than what they actually do measure.
Also, the definition of "scripting" is totally biased towards sh-based languages. Which language is best for driving a GUI word processor? Which one is best at scraping data from a web site or web service? Which one can tweak an XML configuration file? Which one can transcode from UTF-16 to UTF-8 quickly? Scripting is not just about files and regex filters.
Of course I probably wouldn't bother to post if my favourite language had won...
n/t
I was suprised the Perl language wasnt offered at my University, yet found it also wasnt too hard to learn. One thing I'll never understand is why University Computer Science departments prefer to offer Java as an introductory language when C really isnt that much harder and compared to Perl, Java really isnt that much more usefull.
I always wonder how well the people actually know the various languages when something like this comes up. For instance they say python has no "verbose execution" but I don't see how sys.settrace doesn't give you verbose execution.
I did not see PHP in the comparison list. Is thhat because they do not know it or have resources to test major scripting languages. Probably because it is not used for scripting a lot, mostly homepage design.
perl won .. well duh
The article says the smallest java program is 68 chars long just to make it seem double that of C#
public class smallest { public static void main(String[] args) { } }
But this would be the smallest Java program. only 56 chars
public class A{public static void main(String[] args){}}
(Karma be damned; I am no better than an AC anyway)
Note the extension on comments.pl ;)
Each of these languages was designed to meet someone's needs. None of them would be popular if someone, somewhere, didn't have a problem that for whatever reason any of these scripts remedied. Voting "the best" doesn't seem to have any meaning when you don't define the circumstances or the problem to be solved.
For instance, when I look at ways to make a website dynamic, I like PHP. I'm familiar with the syntax and my web host supports it. Someone with a slightly different background or web host might choose Perl. Apples and oranges.
Since when were script languages all supposed to be cryptic languages for shell scripting?
'Hello World'
But it really does depend. I'd use Perl over Python for web development any day of the week (exception: Zope seems pretty cool, but I've not fooled with it enough. The 'everything is an object' metaphor is heaps cool though :)). Perl is faster to write and more expressive, Python is easier to read and - IMHO - often better structured.
... yeah ... the language itself seems a little hacked together - PHP5 fixes a lot of things, mind you so my opinion might change in a few months time after I've used it a little more.
PHP is great for hacking web stuff together, but
It worries me that a "feature complete" version of PHP instantly becomes a release candidate, rather than stewing in Beta for a while.
Who cares ... it's all bits and bytes in the end. A real study would measure relative maintenace.
I am a big fan of Python, and I think this 'search' represented Python pretty well. It isn't great at hacking out short scripts, so it doesn't deserve to win this pointed competition, but its verbose yet pretty syntax makes solid scripts and maintainable, extendable code a joy to program.
If it's in you sig, it's in your post.
"While question like that is bound to generate flamewars between the usual Perl vs PHP..."
Yeah that's really likely when PHP isn't even listed in the results...
I don't see PHP listed. It's possition on the list is arguable, but it certainly belongs there.
...I mean, look at all those clear, concise Brainf**k programs out there.
Seriously, there's something to be said about a programing language that forces good practices (read: python). I indent and comment my code pretty well/consistantly, but a lot of people don't. And while I don't program professionally, I could certainly empathize with people who do debugging Perl code.
Hi! I make Firefox Plug-ins. Check 'em out @ https://addons.mozilla.org/en-US/firefox/addon/youtube-mp3-podcaster/
Whole thing seems sorta silly to me.
> conflict of interest warning: the author of this page is also the author of merd, so some things may be unintentionally subconsciously biased.
> merd is still in planning stage, only half of the programs work, the interactive interpreter is vaporware, and more generally merd is currently unusable.
Dear merd author, plese, use another name for your new scripting language.
I couldn't use "merd" as a programming lauguage. This name sounds awful in italian.
Folks at the Scriptometer conducted a practical survey of which scripting language is the best.
The best scripting language is Bourne shell script.
C Shell script would be second
and PERL third.
Screw VB Script
Anyone care to argue about that?
Who needs Objects for scripting anyways?
Now if we could only get DOS Batch language to work in a Unix/Linux shell...
if you're on Windows, but that's because nothing in the OS was ever really meant to be scriptable, so you had to have Microsoft bolt on a proper scripting language. Imagine using Emacs for you're shell; you'd wanna use Lisp as your scripting language, right?
Hi! I make Firefox Plug-ins. Check 'em out @ https://addons.mozilla.org/en-US/firefox/addon/youtube-mp3-podcaster/
...but Groovy isn't.
Groovy is a Python/Ruby style scripting language that runs anywhere Java runs, and it works and plays well with existing Java libraries, including the JDK. There's even a JSR for it.
I'm going to stick my neck out and say I like Perl -- so I think this is good news. However, I've always thought of Perl as a text-processing language, and In My Limited Experience, mobile phones can only fit about ten words on the screen. {on the other hand, this could simply lead to phones with bigger screens.}
There's no denying that you can write really ugly code in Perl, but you can also write beautiul code in Perl. I think some of the people who knock Perl are confusing "undisciplined" with "not anal retentive". Perl was always based around the idea of serving the end rather than the means -- it's about where you're at, rather than how you got there. It does not impose a particular style on the programmer. Thus, for any given task, there could be many, many ways to accomplish it in Perl.
They're all right.
Some will be faster than others, some will use fewer resources than others, some will look prettier then others when viewed as source. But if you don't care enough about those things to mention them in the design spec, then they don't matter.
Now, you can have your fancy object-oriented stuff, but in many ways it's overkill. For instance, if you needed to write a programme involving geometry, you could create an Angle object which would have a value assumed to be in radians and properties for its sine, cosine, tangent and representation in degrees; a Distance object which would have properties for its representation in different measuring units; and assigning a value to any property would affect the object and therefore its other properties. It might be beautiful if you like the OO concept, but it's a bit overkill if you just want to find the missing side of a triangle.
And does a "disposable" programme -- one that you will run only a few times before forgetting it forever -- really need to look pretty anyway?
As for PHP, well, it really isn't much different from Perl -- apart from always needing to put brackets around function parameters, the fact that all variables start with a $ sign whether scalar, array or hash and there is no $_. {I happen to love $_. It goes nicely with the concept of an accumulator. If you never did any assembly language, you probably won't know what I'm talking about, though}. That is hardly surprising, because the original PHP was actually written in Perl to be like a kind of subset of Perl.
Also, one of my little niggles -- and I freely admit that this is just my own opinion -- is the inability to get on with any language that uses the plus sign as the string concatenation operator while letting you freely mix string and numberic variables. {*cough* ruby *cough*} I expect "2" + 2 to equal 4, not 22. Hell, if I have to do something to my variables before I can add them, that just nullified the advantage of having freely-mixable scalar types! It might as well be a strict-typed language and barf on an expression such as "2" + 2!
As for Python - well, it's not my cup of tea {I guess you like either Perl or Python} but other people seem to have written some pretty good stuff in it, so I shan't knock it.
under Tools:
compilation and execution in one command (20 points) vs
debugger (5 points)
Ok, mabe it's just me but the author finds it 4x more important to be able to compile and execute the comand than having a debugger of some sort I mean wow if it's that important maby he should write some sort of script to handle that for him.
And wow that's a lot of TD's out there maby under Program Lengths by Language. Then again maby when we find somone who can figure out that the "ease of converting between numbers and strings" is less important than say noticing that your string doe not contain a number. "10l0" is realy the same as "RED" so who cares right.
PS: If you want to compare scripting lanuages try writing somethign that does a grep search for "GET A CLUE" with files of the format USEFULL*INFO## and then sort's the output by the number of ocurances of "FuncoLand" instead of writing hello world is as few chariters as posible.
And it made a good impression in one of my job applications, where the contact person knows it pretty well. It won't impress most people, sure, but (a) people who don't know Ruby will understand that means you could do Python, PHP or Perl; (b) people who do know Ruby will think better of you.
Are you adequate?
(How come <ecode> doesn't preserve whitespace?!)
Not that it makes any difference, Java was never gonna do well and is totally inappropriate for scripting, but there ya go.
--Tim
Measuring program size in bytes is stupid. Lines of code, though still rife with problems, is a much better measure.
Are you adequate?
The OS X scripting model is very powerful, it lets you call other languages and control scriptable programs from any OSA language (Perl, python, Ruby, tcl, JavaScript, AppleScript.) AppleScript can also be used within the XCode/AppleScript Studio framework to write regular programs.
You know what language does not matter. I can write a preforking server in perl in one line of code. How? Because somebody else has already done it for me, documented the code, posted in a central library that's available for everybody and is searchable. Not only that I can type "perl -MCPAN -e shell" and "install Whatever::Whatnot" and have it in under 5 minutes. Try that with python, ruby, ocaml or java.
Maybe python is easier to read, maybe ruby is more object oriented, maybe ocaml is faster, maybe lisp is better then all of them, but I don't care. When I want to get something done I can always get it done faster in perl and it's all because of CPAN.
Until another language offers what CPAN does I don't care that much about it.
evil is as evil does
public class A{public static void main(String[] v){}}
Where was vbscript? and where was the proclomation that OCamel was best. I must be missing something.
So, these languages get graded partly on how small a null program can be. I particularly like the Perl example of printing an environmental variable; you can pretty well figure out how they messed that one up, but it's still sloppy.
To say that one language is better than another based on a score assigned to these tests is not very defensible.
Dewey, what part of this looks like authorities should be involved?
PHP5 RC3 /is/ their (Zend/PHP's) public beta. Very minimal portions of the language will be modified prior to the final release of PHP5.
I agree that PHP4 seems a bit hacked together; PHP5's OO language construct additions, try/catch, et al should improve code reuse, design pattern implementation, etc.
Anybody have experience with both ocaml and dylan and willing to write a quickie comparison. I have been reading about them and right now I'm at a tossup as to which one I am going to learn next.
evil is as evil does
And as usual, ColdFusion is ignored. Doesn't matter that it's been around for 9 years and going strong. Doesn't matter how fast and easy it is to write a web app in it. It's not free, so ignore it. It's Macromedia, so ignore it. It's not open source, so ignore it. Damn, but this bias is getting real old.
Michael Dinowitz House of Fusion http://www.houseoffusion.com
I love OCaml! I suppose it depends on what you're rapidly developing, but it is quite a nifty language. Man I'm drunk.
It seems like a commercial comparative grid designed to make your product look good.
/x foo.js').
JS has debuggers and full featured interpreters at least on MS (try 'cscript
Also what about OOP/COM? Is it too much to ask? JS supports XPCOM and ActiveX on MS.
I'm lazy and like languages that all look (can be written) using generally the same syntax. For me that's C, C++, C#, PERL, & JScript. Semicolons, braces, etc.
MIRC r00lz!!! it EEZ the b3st3st skript0ring language around!! 3y3 CaN 0Wn0rz j00 with 1 lineof code #%!%!@ (disregarding the fact | is ;'s cousin(the one without the erectile dysfunction))
#%!%@#%^!
.... AND FOR GOD SAKES FORGET TRYING TO TELL THEM HOW TO USE AN XDCC!!!)
On a semi-serious note, my own lil mental definition of a "scripting language" is a set list of syntaxies' (or whatever the hell the plural of "syntax" is) for a human readable "language" that a computer can use to control the actions of an existing program per-user input. So i mention mIRC's scripting language becuase of the amazing versatility it has in customizing such a solid (solid as in STABLE, it has had many "IRC virus" scripts due to the effect of combining malicious/fun-seeking bastards with newbie/total-idiot/naieve (heretofore & nevermore known as "The Innocent") end users (the ones you have to write instructions down on a sheet of paper at as to how to download/install/run/connect/Join #JimbozWarez
- You're not paranoid, they really are after you.
I see that in the C "Hello World" test, they allow an "#include ", which of course is obviously required, but is it "fair" in this test? I'm sure there are includes for Perl, for example, that allow one to print "Hello World" with a simple "use" as well.
Check out my site for some Ruby GUI stuff:
:-)
(the gotcha is it's mostly in Portuguese. So jump to the "Exemplos Meus" (My Examples) section. Or use babelfish: http://babelfish.altavista.com)
http://geocities.com/canalruby
Hey, web stuff is easy with Ruby as well. But I don't have such examples for you. You have to get a taste of Ruby to find about its web capabilities. I Know IOWA has an example:
http://enigo.com/projects/iowa/index.html
Further enlightening at:
http://www.ruby-doc.com
http://www.rubyforge.org
http://raa.ruby-lang.org
You know, once you get addicted, there is no going back!
One thing that I have noticed recently is the apparent explosion in the number of people using PHP for more than a simple MySQL / dynamic-when-it-should-be-static web page implementation. I'm too lazy to provide the clicky links, but OpenGL and dynamic image generation is being done in PHP now. I think that once the associated stigma of it 'just being a web scripting language' passes, then PHP will be set for some very interesting future uses (much the same as BASIC has evolved through various implementations such as QuickBasic, VB [shudder], etc).
I think that it might follow Perl, and find more implementation at the CLI. To a non-technical user, Perl and PHP are only seen through CGI / web-scripting, and they don't care or need to see the CLI usage, even though it may be doing everything they are relying on. Once it gets past the 'just a n00b language' I think that it might get very interesting.
InfoSec that matters, when it counts.
I've collected a paycheck, one way or another, in almost twenty-five languages (in almost as many years) - the ability to learn new things quickly comes in handy when it comes when someone's got obscure code which needs to be rewritten, fixed, or updated.
Big Tip: It's not the language. It's the coder. If you know several languages and can apply the best one for a particular language, it's that much easier. If a language is best-suited for libraries, use it for libraries, then use other languages which are better for GUIs to do that and call the libraries as needed. 95% of the people in the industry really don't belong in the industry and their code basically sucks when you get a good look at it. The problem is people like it and think they're good at it. Because there are so many requests and so few people who can fill the slots, no filtering is really needed compared to what should be done. It may appear things are better now than they were twenty years ago, but the bottom line isn't all that different.
The truly sad part is if you grabbed a large quantity of people who code for a living and put them in a room and said, "All of the good coders go to this side and all of the bad ones go to that side." Which side do you think all of them will go to?
"You don't have to be good, just good enough." (and that's not good enough)
Well, this isn't really much of a practical survey of which scripting language is the best. Part one is a few checkbox features. Part two is program length, and is worth about twice the score of part one. It's really just a terseness survey and IMHO, even in a scripting language, it's a lot more complex then fewer-characters=better.
The measures that are used to evaluate languages are absolutely absurd - you should pick what comes naturally - not what is "best" according to his stupid chart. It is obvious to me, that the author of this article is the type of person that gets off on knowing lots of languages (very poorly).
If you just want to learn languages go to a trade school or pick up a "learn X in 21 days book". If you want to actually solve problems, then pick up a book, study at the library, enter some coding contests, and/or go to college.
Give me a break. The author of the article is a wannabe.
now lets say i put Ruby on my resume....how much respect will that get?
I just hired my replacement for a contract I was doing (I accepted another offer that was more in line with my field). One of the requirements was that the person hired would have to know Ruby because much of the code base was in Ruby. They hired someone from our local Ruby User's Group.
So to answer your question: for this particular job if you didn't have Ruby on your resume it wouldn't get a second look. If you had Ruby on your resume, but it became apparent in the interview that you didn't know Ruby... well, the interview was over.
Finally! The rightful recognition that the shell
(Bash and Korn) deserve and have earned. I am
constantly amazed at how these shells seemed to
be overlooked by todays generation of Linux
user's. Extremely powerful, and immanently more
sane, and readable than PERL. Do yourself a favor,
*learn* Korn (or Bash), you won't regret it.
Shell... it's more than a command line interface!
Since ICFP = "International Conference on Functional Programming" one wouldn't be surprised that they like a functional language such as OCaml best, however the 2003 2nd place winner received this judge's proclamation:
...just FYI
"C++ is a fine programming tool for many applications."
And the 1st place winner landed:
"C++ is the programming tool of choice for discriminating hackers!" 2003 ICFP results here
[but Perl 6 is really where it's at]
I can't understand why this person took in Haskell and OCaml anyway* The comparison is being hosted under the pages for merd, a language which aims to be kind of a hybrid of Ruby and ML/Haskell. * I'm not even going to bother wondering about C# and Java. I think they are control cases.
Are you adequate?
Okay, I'll admit most people won't have heard about it, unless they were around in the days when WebObjects 2.0 and 3.x were changing the landscape for eCommerce, dynamic publishing, so on and so forth.
Apple should release WebObjects 6 in a choice of Java or Cocoa/ObjC and really show the world how powerful such an application server solution they have sitting and collecting dust can be.
WOF Java is fine but doesn't touch the Cocoa version.
Every job has its requirements; being a good programmer is being able to use the tools you have to solve the problem in a way that fits the requirements. Being a great programmer is knowing which tool is right for the job - and which isn't - and when they may have to look for something else.
The lessons of history teach us - if they teach us anything - that nobody learns the lessons that history teaches us.
Forth? No.
Learning forth will help you learn reverse polish notation, one specific trick for building high-performance interpreted languages and a very lightweight, easily extensible and embeddable scripting language.
It won't, though, teach you anything about computers work beyond the small amount you'll pick up by learning any new language. Including French.
If you want to learn how computers work there are far better things to play with. Assembly language, obviously, whether it be a synthetic assembly language such as DLX or a real architecture. x86 isn't the most enlightening assembly language to start with (6502 is excellent, MIPS or for a really nice architecture, Alpha) but it'll run on your PC.
Books. Patterson and Hennesey, Computer Organization and Design, The Hardware/Software Interface is pretty good for a programmers intro, but Hennesey and Patterson, Computer Architecture, A Quantative Approach will teach you a lot more, as will most texts with Superscalar in the title
Learn a hardware description language. Verilog is better, but VHDL is OK. Compilers and simulators are freely available for both.
Get an FPGA development kit. Compile yourself some hardware. You can put full CPUs on a fairly cheap FPGA development board.
Design your own CPU. It's possible for an individual or a small group to design a CPU and have it fabricated as a tinychip. I've seen individuals design a full, if tiny, CPU at mask level in a couple of months, and a small group put together a fairly decent gate level design in a few more. Commonly done as part of a college course, but an individual can have a tinychip fabricated for around $1000. Not cheap, but cheaper than some hobbies.
You can do full circuit level design and simulate it using either gate level or spice transistor level simulators and see just why addition or multiplication takes as long as it does.
As a general rule I've found that some of the best software engineers have some hardware design background, and a good understanding of computer architecture, so even if you never plan to do any hardware design, understanding how it all works is a good idea.
Of course, I've also found that a large fraction of good software engineers have also spent time working as theatre technicians, so who knows what the correlations are...
Begun the great scripting languarge holy war has.
This guy is way out there
First of all, a pure character-based size count seems unfair. I do not believe that the number of characters in a chunk of source code is directly correlated to the amount of time it takes to write. Most of a programmer's time is usually spent thinking, not typing, and you can thinking just as fast with verbose naming conventions as you can with terse ones, as long as the constructs are the same. And then, if the constructs are different, it's even harder to judge, because if the constructs in one language are more natural, corresponding closely to human thought patterns, then coding in that language will tend to be much faster than coding in more cryptic languages, even if the cryptic language requires fewer keypresses.
For example, I tend to find that writing in functional languages is easier for me. My functional-language just tends to come out faster and contain far fewer bugs. I'm not entirely sure why, but I suspect it has something to do with the thought-pattern-correspondence idea I mentioned above.
Second thought... some of these comparisons are clearly unfair. For example, one of the test cases is implementing "grep". The sh version of this case simply calls grep (after validating the arguments, I guess), which seems like a really big cop-out. Any language could just as easily run grep in a separate process. Meanwhile, the OCaml version seems to implement the main loop of grep manually in terms of library functions that are not identical to grep. That is to say, the main thing the OCaml code is doing is translating grep-specific options and semantics to the options and semantics used by its own library functions. To make this comparison fair, one would have to write a library function in OCaml which is identical to grep, then allow that function to be called without counting the library as part of its code.
I think the only fair and useful way to make comparisons like this would be to hold a contest of some sort. Get an expect Perl programmer, an expert Python programmer, etc., together, then give them a program of some sort to implement. Avoid defining the program to be too similar to one language's library calls. In the end, judge the languages both on how fast the contestant completed the code and on how useful and robust the resulting code turns out to be.
Probably not going to happen, of course.
Glancing at that page is five minutes of my life I'll never get back.
Asking about the "best" scripting language is kind of like asking what the best motor vehicle is... it all depends on the application and your personal preferences.
... Just my 2 cents.
Personally, I have to say that I like JavaScript for browser scripting (DHTML) and I use it on a daily basis. It's easy to learn and is perfect for what it was intended to do.
I've used VBScript w/classic ASP quite a bit as well. There's nothing really impressive about the language, it's just easy to learn and read. Unfortunatley, classic ASP tends to automatically encourage "Spaghetti Code," so dealing with VBScript isn't always fun.
I like Perl quite a bit, but as far as I am concerned, Perl is a language I use when I am the only person who is going to be reading my scripts.
One other language I used frequently is PL/SQL. The syntax for Oracle stored procedures is kind of ugly - not hard to understand, just ugly. Unnecessarily so, if you ask me. The MS SQL Server stored procedure syntax is much nicer.
This is cheating; nevertheless it compiles and runs with sun jdk without any problems
class A{static{System.exit(0);}}
Only 32 chars. yay!!
> Interesting that ICFP contests lately pronounced OCaml as the winner for rapid development.
.o absent, invoke grep on some files, etc).
Certainly that is interesting, but it has absolutely nothing to do with the subject of the article. "Rapid Development" (or development in general) is not comparable to scripting, and the ICFP contest tasks (which this year was to develop AI code governing ants in a colony) contrast sharply with the sort of scriping tasks in this shootout (compile a file if
[aside]
This is not intended to rag on scripting or scripting languages, just to note that scripting embodies a largely distinct set of tasks from development in general (and a comparison involving OCaml or the ICFP contest is inappropriate). These sort of tasks that historically have been the domain of shell scripting, although perl seems to have taken over a lot of these things.
As a lot of what perl is best at is simplifying things that you could almost do from the unix shell (or might be able to do with a script, but would be a pain in the ass..), it always struck me as logical that perl should evolve toward becoming a viable replacement for the unix shell.
Sadly this doesn't seem to be on the agenda of the perl gods. Instead of evolving to better fill this niche, they seem to be gravitating toward becoming a sort of second-rate Java/Python immitator. I suspect that the underlying technologies they build with Parrot and the Perl 6 redesign will largely fail to convince many folks who aren't already perl users that perl is a useful substrate for developing real systems on top of. At the same time they will have neglected to improve in their original niche of quick and dirty sysadmin hacklets, while other languages will have continued to improve and build momentum.
Then again, I'm quite possibly wrong. We'll see what happens. Should be interesting..
Should be able to accomodate all evolution levels of a programmer!
. html
http://www.cse.ogi.edu/~diatchki/jokes/programmer
John Kerry is a Joke!
Speaking of web stuff and perl, my (former) boss always said "Perl is great. In fact, if you smash your hands down on the keyboard, you're halfway to having a working web server." Not trolling here, attempting humor.
The fact that Perl was recognized as good by this system proves that the metrics are broken. Perl is impossible to read and is unscalable. We have banned it because it results in unmaintainable code.
Python and Ruby are sometimes so similar, that today I want to take the chance and say what I don't like in Python:
- public instance variables and auto-creation of said variables (In Ruby, instance variables are private by default).
- indentation with spaces and tabs used as block delimiter. (I actually indent all my Ruby codes properly. The Python way buys me nothing).
- capitalization of classes, modules, variables. Only by looking at a word you can't make the difference whether it's a class or a variable (In Ruby, methods and variables start with lower case, and modules and classes start with upper case).
- use of functions, or what appears to be functions, instead of appearing as a method. ex: str(10), instead of 10.str. (In Ruby you use the later: 10.str).
- lambda is just too ugly. (In Ruby, you have nice blocks and closures).
- self isn't hidden. Sometimes you don't even want to use it, then why declare it and create unnecessary noise? (In Ruby, self is hidden for your pleasure).
No language is perfect. I could have made one or two wrong points, but the fact is that those points are just the tip of the iceberg. Ruby is much better than just that. And I am betting at that.
$str =~ /(.*?)\&(\w+)\((.*?)\)/gis
You can certainly have .* or .?, but .*? is surely ill-formed.
Are you adequate?
Sh is the best at doing tasks common in Sh, whereas languages not designed for shell scripting do them less well than sh. Furthermore, languages that aren't even scripting languages are terrible at being sh.
1p}{ 1 sp34k |33+ +|-|e|\| p30p13 \/\/il| 8e i/\/\pr3553|)
While it does moderately well on this test (finishing near the middle), you might be surprised at it's weak finish compared to it's reputation as a concise language. Well, as a committed Ocaml advocate, Ocaml isn't a scripting language. I freely admit that it has so-so string handling, no built-in regular expressions, so-so process handling, etc. But this is because it isn't a scripting language- it's an applications language, like C++, Java, and C#. And the only reason it does as well as it does is because it's a signifigantly better language than it's competition.
If you're writting a quick script to grep through the log files looking for port scanners, Ocaml is the wrong language.
Brian
In a similar vain, I wrote up a scripting language comparison document, but focused more on features rather than particular languages. Comparison Link. I describe the various feature options, and then weigh the pro's and con's of each.
After years of debating language features, I generally conclude that a lot of it is subjective. No language will ever satisfy everybody.
Table-ized A.I.
for all time.
So perl regexps are cryptic and hard to read even if you know regexps already. Thank you.
Are you adequate?
now were that punch tape. Ah right next to the acoustic coupler.
A test about prototyping languages which doesn't take Prolog into account is simply not serious. Due to backtracking and unification, Prolog can't be beat in terms of both readability and compact code.
The measure that the comparison is applying is the size of the source code in bytes. If we're talking about the size of the executable, (e.g. bytecode in Java, C# or Python), bytes is the natural measure.
Are you adequate?
There is far more to programming than brevity.
Where is Qbasic?
If you build it, nerds will come. Soylentnews.org
it has taint checking which is also a plus
You mean if I use Ruby, I can stop reaching behind my sack?
It's not offtopic, dumbass. It's orthogonal.
1. If you use the split function inside a loop you can not access an array element directly; you have to use the iterator of the loop. 2 you can not add directly to a dictionary object/hash through a record set oDic.add rs("field1").value, "Hi there" Will not add this to the data structure. 3 The RegEx expressions are limited ie no backwards look up. Jscript has a richer reg syntax implemented. 4 The Variant data type is a pain the ass.
rabble! rabble! rabble!
I think JavaScript got a low score because the author didn't fully understand the depth of its functionality (the todo's in the score table), only very simple tasks were tested, and the only measure was size.
rabble!
rabble! rabble!
For Pure debugging, my favorite was REXX. You could Trace anything and everything. It was also a "nice" little language... if a bit odd.
Today I use PERL for almost everything, however, and not for its debugging, which I don't care for. You can program almost anything in a single line of code however, and have no idea what it does ever again. Plus you can download a module to do almost from CPAN. Want to know if OJ did it? Download the DID_OJ_DO_IT module from CPAN.
WHy compare with Java when there is Groovy, the JVM scripting language?
Here's a simple sample script:
#!/usr/bin/env groovy
println("Hello world")
for (a in this.args) {
println("Argument: " + a)
}
Note that you can run this from a command line, no compiling required.
Groovy is not just some random basement project either, it's actually a JSR and so will probably become a standard before too long.
If you want a C3 equivilent, I'm sure some well-meaning but mistaken soul will copy this project as they have tried to do with every other Java project. "C# - only a year behind Java since 2003!".
"There is more worth loving than we have strength to love." - Brian Jay Stanley
While perl is demanding (IMO) much more self-discipline to keep code clean, it is unbelievably easy to use HASHes everywhere to write small and extremely efficient utility scipts. Great.
The BeanShell lets you use pure Java as a scripting language and it's almost trivial to include the BeanShell in your Java application.
See http://www.beanshell.org/.
What's your point? The program is shorter shorter when written in sh, more natural and more readable. (Not to mention that it uses lazy evaluation, so that the full input doesn't need to be in memory, just the full list of words).
HAND.
"""I have to write it fast, it has to be small (less typing)"""
Why can't programmers just learn 10-finger typing like every secretary can, I don't see why they also don't teach it as a subject on informatic schools or studies, it is a core skill of what you're doing everyday.
And when you once learned to write using more than 4 fingers in an eagle-search-system you won't mind if a programming language is a bit more explizit, in favour of readability and maintance
Just to quote Linux Torvalds on his perception:
"""Saving on typing
is not a good reason - if your typing speed is the main issue when you're
coding, you're doing something seriously wrong. """
--
Karma 50, and all I got was this lousy T-Shirt.
That doesn't go for scripting languages (as far as I'm concerned), which I don't generally feel are appropriate for large projects.
I suppose it may depend on what your definition of "scripting language" is, but what is wrong with dynamic languages for large projects? Generally one should target an event-driven architecture if they are going to use dynamic languages for larger projects IMO. Each event is more or less treated independently, but changes state in the database and/or framework, which is the primary method for communicating across events or tasks.
However, event-driven architectures are not in style right now for whatever reason. Thus, the current style perhaps does not favor scripting in the large.
Table-ized A.I.
If you bothered to read the article...
The lines of code needed to achieve a task are measured, as they serve as an indicator on how fast one can create a script.
If you need 20 lines of C# to check if a file exists, but only one in Perl, then according to the study, Perl should receive a better weighted score for ease of implementation.
Read the articles people! They are interesting (at least most of the time).
...While question like that is bound to generate flamewars between the usual Perl vs PHP, Python vs Perl, VBScript vs everything crowds...
-- snip
Unlikely, since Perl is the only of all those scripting languages mentioned which is actually covered. You can't argue with results that aren't there.
BeauHD. Worst editor since kdawson.
As much as I love programming language comparo's, this one just doesn't hit the spot. Do people actually think a scripting language should only be used for tiny write-only stand-alone scripts? TOOLS: If this section was meant to cover the tools / features that enhance the versatility and convenience of a language, it isn't complete. What about machine code compiler availability / VM support, Web options (CGI, Apache plug-in, Server Pages, etc), editor / IDE support, profiling, RAD features like unit testing, and docstrings, multiplatform support for threading and other features that immature languages might leave POSIX-centered, etc? License openness and multiplatform range should also be considered. And why is shebang awareness, working without which would just require one extra word on the command line, three times more important than an interactive interpreter, debugger, or passing program in command line, which open up some serious time-saving habits. SPEED: Unlike compiled / system programming languages, interpreted speed isn't the most important feature of a higher-level / scripting language. For most tasks on a modern computer, development time is infinitely more precious than execution time. Algorithms matter more than the overhead language speed. For example, since many scripts spend much of their time waiting for file I/O, network response, or user input, a Perl programmer who understands multithreading might end up writing faster apps than a C programmer who doesn't. Another important point is how a language fits into a large modular system. For example, Tcl is easier to embed / extend with C than many of the languages compared, so the real-world apps that are implemented in a combination of C/C++ and Tcl can be optimized as much as is needed. Python has superior profiling, JIT machine code compilation, and VM (IronPython, Jython) implementation than most / all of those scripting languages. Final speed note: the Python version 2.2 used in those benchmarks is ~30% slower than the latest version. L.O.C. COUNT: Program briefness shouldn't be the only measurement of sample code: productivity and readability are each at least equally as important. Like, even though Perl is more compact, I'd bet those sample Python scripts would take less time programmers to write, and far less time to read for a non-Perl-centered programmer. The benchmark should also define a common policy for abbreviation-vs-readability in sample code: many of those examples could be made briefer or more readable regardless of the language. The comparison was missing a number of essential sections: LANGUAGE QUALITIES: how the fundamental language features impact its abilities as a scripting language. This would include language agility, dynamic typing system, garbage collection, high-level non-scalar objects (arrays, hashes, tables, relational features, etc), OO / multi-paradigm abilities, etc. How easy is the language to learn? (Will your non-programmer users be able to make trivial changes themselves?) Does it have any unavoidable annoyances (ex. as much as I love Python's use of whitespace, lack of an alternative block syntax would be a minus here). SCALABILITY: Can it be used for very large applications? Does it break if running more than X instances / threads / CGI hits / etc at the same time? Does it break when asked to allocate 20 gigs of memory for some fancy chemistry simulation with lots of large numbers? AVAILABILITY: How frequently is a language available on a typical shared Web host? How many add-on packages / libraries are available? Does it have any gaps in its library offerings: well-rounded RDBMS support, GUI, regex, multithreading, etc. How easy is it to find related published books, online tutorials / references, and community help? Is there a quality-assured version (like ActiveState), without which a language may not be usable in some commercial situations? Are there many popular / killer-app projects that use the language (ex. Zope). Finally, the comparison was missing PHP, which has full
groovy is really cool. It is a mixture between Java and Ruby! You can use all Java JAR libraries and if you take care it is completely OS- and platform-independant.
I really used to like Perl, programed in it all the time. But until Randy drops dead, Perl is going to continue to change, making it really worthless as a scripting language. How many times have you had old scripts stop working because they 'improved' Perl and a particular feature isn't there anymore? Or works differently? I've had to re-write entire test harnesses and tool sets.
Plus everyone is trying to make Perl into a language! We have enough languages. Lets take all the dumb stuff back out of Perl (Does object oriented scripting really make sense to anyone out there?) and let it be what it was supposed to be: A good Scripting language. Not Bloatware!
If you are on VMS, the "best" scripting language may be DCL (or whatever it was called). On Windows, it may be VBscript or Perl. If you write numerical code, it may be Matlab. If you write visualization code, it may be Python with VTK libraries. Etc.
The whole point of scripting languages is that they are well-adapted to their application domain--different domain, different winner.
If you try to develop "general purpose scripting languages", all you are doing is developing a poor implementation of a general-purpose dynamic language (Lisp, Smalltalk, etc.).
What ever happened to the engineer's motto "The right tool for the right job"? I'm not a scripts person, but indubitably, all scripting languages have their specific advantages for specific applications. Imho, this whole thing is made for trolling and flaiming and not for anything else. It's just stupid.
If a train station is a place where a train stops, what's a workstation?
I searched around a bit, and found that someone's already done it. It uses the PCRE library along with a camlp4 macro that provides an elegant "match ____ with" construct tailored specifically to regexps. I'm impressed.
the "correct" answer is easy: the one you know best.
Unless you have other considerations like maintainability, reuse by coworkers, etc. But those considerations are external to any language you might choose.
Diplomacy is the art of saying, "Nice doggie!" until you can find a rock.
Or even Groovier
#!/usr/bin/env groovy
println "Hello world"
args.each {println "Argument: ${in}"}
Measuring program size in bytes is stupid. Lines of code, though still rife with problems, is a much better measure.
Where program size counts in a scripting language is the time taken to write the program. As someone said recently, "typing is cheap, thinking is expensive". For me it requires 0 seconds of thought and 0.8 seconds of typing to write "import os" in Python if I use something from the os module.
Likewise, using things like regexps from a library necessarily implies some typing (function re.search instead of m//), it doesn't require any thought so the path chosen doesn't impact production time. It does impact the readability which counts too.
I think the referenced "shootout" was a poor idea. Measure things that don't matter, and pretend that they do. A better idea was what was done a while back - measure the size of gzipped source code, which measures the semantic complexity of the code . Python kicked other languages' arses there.
Save your wrists today - switch to Dvorak
No GNU has been Hurd during the making of this comment.
In the Windows environment there are a host of different OS-specific needs which are best served by Windows-specific scripting programs.
Two which come to mind are KiXtart which I use to do clever things in our users' login scripts and Winbatch.
Phil
So what happened to Cold Fusion? I've scripted in Perl, PHP, Python, Javascript, VB and many others and I'd still say Cold Fusion is the simplest/quickest to build a small to medium sized system in.
Sure it lacks the geek factor because it's not open source, and it's not as widely available as perl/php, but it's certainly a lot more common on ISP servers than ruby.
I love the debugger of ocaml. You can backstep, you UNDO the execution of the previous 1, 10, 100, 1000, ... steps.
Wonderful if you like me fill the code with asserts. If an assert occurs, just run in the debugger, then backstep until you know why the unthinkable happened and then you fix the bug.
I was disappointed when Microsoft failed to include VBScript as one of the languages in .NET. The ASP VBScript model was the first innovative product that Microsoft introduced. And that model served it's purpose remarkably well - ASP VBScript put Microsoft on the WWW. Without ASP VBScript there would be no significant Microsoft presence whatsoever on the WWW. Yet today, 5 years after the introduction of .NET, ASP VBScript pages on the WWW outnumber .NET ASPX pages by 10 to 1. And ASP VBScript usage continues to grow faster than .NET.
But Microsoft refused to add those features(binary file I/O, associative arrays, throw/catch, etc.) to VBScript that could have made it a superior scripting language. [Some of these features can be implemented with COM, but COM overhead makes such implementation costly performance-wise - those features should instead be part of the VBScript language.] Microsoft instead developed a new set of languages for .NET that were
In contrast, veteran ASP VBScript programmers pride themselves on their use of NotePad as an IDE.
This is an unfortunate but compelling example of a corporation shooting itself in the foot by discontinuing enhancement of it's most successful product.
It is, of course, nonsense. So this entire "test" seems utterly pointless since the person responsible also measured 38 bytes for Perl in this case (the above code).
Fight for your digital freedom, join the EFF *now*: http://www.eff.org/support/
consult with/trust in yOUR creators..... good advise since/until forever.
tell 'em robbIE?
Guile 1.4 is old...1.6 has been out for a good year and a half now.
It has a debugger but it is disabled for speed purposes by default; running (debug-enable 'debug) turns it on. There's also an excellent Emacs interface that makes editing/debugging Guile code painless.
HAL 7000, fewer features than the HAL 9000, but just as homicidal!
This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Perl"
I like to work in a kinda hybrid environment, using perl as a basis and going for backticks and shell processing whenever I think it to be more straight forward than the perl equivalent. Thus I'll get the best of both worlds. For example:
# do_fancy_perl_stuff_here to fill $tempdir
$tempdir =~ s/\s//g;
`rm -rf $tempdir`; # $tempdir='/'
This saves me from needing to lookup how to delete a directory in straight perl code, and will be readable by anyone who ever used a shell.
Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
Personally I think that's a better metric than the author's simple-minded "the program in this language was eight characters shorter so it gets a higher score". This was apparently an attempt to measure the expressive power of a language, but done in such a way as to ensure Perl scored well.
I think there are more important things to keep in mind when selecting a scripting language, like
- how easy is it to learn?
- how easy is it to remember how to use everything?
- how easy is it to read other people's programs
- how easy is it to read your own code six months from now?
On these counts Perl loses big time. Its "every combination of punctuation characters does something" language design saves you typing, at the expense of pretty much everything else.If the only thing you use the scripting language for was one-off half-page scripts that you use once then throw away, and you wrote those eight hours a day five days a week, then I could see using Perl. For any other purpose I think you're better off using something else. (And, yes, I have a suggestion in mind, and it rhymes with Crython.)
larry
p.s. I have a nomination for a shorter Python program to remove #-characters from a file:
After all, it is precisely as "legal" for the Python program to call sed as it is for the sh program to call sed.In shell scripting, you can get Hello World in 7 characters:
$ echo 'echo $0' > 'Hello, World!'
$ chmod +x 'Hello, World!'
my other sig is a 500 page novel
There are some silly mistakes in this article, suggesting that the author does not really understand the languages he is comparing.
Here are some examples:
for 'return exit code error (non zero) if a file does not exist' and 'return exit code error (non zero) if a file is not readable. There is no Java or C# code supplied. Java can easily test this: for example
new File(filePath).canRead();
and
new File(filePath).exists();
and I'm sure C# can as well.
There are other omissions:
Under Java 1.5, the System.getenv() method allows access to environment variables.
Also, saying Java is completely unusable in a scripting environment is nonsense. The BeanShell system has been around for years, and allows java to be run as if it were a scripting language, both from a command prompt or from script files. Java 'scriptlets' on JSP web pages are very common. Finally, there is a PHP/Java interface.
I don't know C# well, but I'm sure there are similar facilities for that language.
I'm wondering why noone here seems to have noticed that most of the perl scripts on the site are broken...
Can we atleast all agree that VB script is utter shit and should be wiped from the face of the earth?
This comment does not represent the views or opinions of the user.
Both are untrue. TCL will happily take command line arguments, and if you set the execute bit under unix, will happily act as programs. If by "programs can be passed over the command line" that he wants to bang out to the shell, there is the exec command. Of course in his hello world program he uses BOTH features.
TCL gives you a complete stack dump on every error that is stored in a global variable "lastError", and you can override the background error with the bgError command. That also covers the "FullInterpreter in Debugger". The language was designed AS a debugger to C programs for christ's sake.
All told that cost TCL 15 points.
Sure I'm quibbling, but if you aren't going to compentantly seek out features save in all your favorites, you look like an idiot putting these comparisons together.
(Disclosure: TCL Guru.)
"Learning is not compulsory... neither is survival."
--Dr.W.Edwards Deming
This supposed Perl "readability" myth, or the lack thereof, is one of the reasons we will have Perl 6. You are not up to date with Perl development, are you?
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
Dialect kind of bills itself as a BASIC-like RAD language, but *do not* be scared away by that. It is a lot more like Python than Dialect in its syntax..
Oh, man, a language that is more like Python than itself.
Is the day I had to : - take screenshots ( every 5 seconds ) while using a web-based AS400 terminal emulator without having to use the PrintScreen key of my keyboard - resize the image by cropping only the AS400 emulator zone - delete the duplicate pictures - change the colors in the pictures so that black->while , yellow-> blue ; green->red, etc... while keeping the image readable. - add some comments at the bottom of each image It was really easy using Perl::Win32 and Perl::Magick modules. I wonder if you can find other languages to perform the same task....
You have provided great examples. I would add another two: Unlambda, bf and maybe also Ook. Furthermore, let us not forget about Assembly. Seriously, I strongly believe that if kids today had learned those languages and tried to understand how computers really work, we will have much less Flash/JavaScript/PHP/MySQL "elite" (or "leet," if you will) websites shamefully vulnerable to trivial cross-site scripting and SQL-injection exploits. The problem is that script kiddies today don't want to learn anything, be it REXX, Unlambda, IMCC, Perl 6 or even valid ANSI C for God's sake. We have to do something about it. I agree with you.
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
C++. If they included Java they have to include C++ :-)
What a silly way to try and display 'objectiveness'.
I get the strong feeling some Perl freaks were involved in the evaluation tables design.
Where's readability?
Could it be that readability contradicts with 'programm shortness'?
Ever tried to read through the shortest possible Perl solution to a problem? Exchange shortness for readability and Python will porbably 'win' hands down.
And what silly dork drew the line between 'scripting languages' and 'programm languages' ?? With 'Java not being a scripting language' and Python, Perl and Ruby being one. Whatever that's supposed to mean.
Why this evaluitation may be objective on some narrow areas, in a whole it's somewhat pointless. I can add some other criteria that will have TCL or bash win in no time.
We suffer more in our imagination than in reality. - Seneca
OK, here it is:
#!/bin/sh
0 875&cid=9411049
:; do read a || exit; [ "${a/$1/}" == "$a" ] || echo $a; done
# 2004-06-13T12:33:55+0000
# pth shgrep - a minimal shell grep implementation
# Copyright (C) 2004 Pan Tarhei Hosé, PhD.
# http://developers.slashdot.org/~Pan%20T.%20Hose/
# http://developers.slashdot.org/comments.pl?sid=11
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
[ a$1 == a ] && echo "Usage: $0 pattern < file" && exit 1
while
Just a quick hack I wrote right now in less than a minute, I am sure one could write it better. A quick test:
pth@ws0:43:~/sh/shgrep$ ./shgrep arse < /usr/share/dict/words
arsehole
arseholes
arsenal
arsenals
arsenate
arsenic
arsenide
[...]
Seems to work fine. Is it pure enough?
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
The only script language I know is python but coming from C++/Java it seems easier to handle then perl. I think it all depends on your backgroup.
Youdon'treallyexpectsomeoneactuallyreadingthatpost ,doyou?
lets take a look at java for example:
shebang aware (#!) (15 points):
this can be done in linux, using some extension i dont remeber its name. you choose it when you compile the kernel. and not to mention the jar files!
compilation and execution in one command (20 points):
how hard is it to write a shell script or even a java class that does this??
20 fucking points??? for something that you can add/fix in like 30 seconds?? this looks very biased to me
program can be passed on command line:
dont get it. what the fuck is this??
is it like ls `which ls` or something??
this has more todo with the shell than the language.
interactive interpreter (REPL) (5 points):
well, when you limit yourself to gcj, then you basically have said that you are not interested in a "interactive interpreter"! why not use eclipse or Visual.Net (for C/C++/C#)??
debugger(5 points):
oh wait, have you heard of jdb??
or the jikes debugger? or the GNU debugger? ddd anyone?
full interpreter in debugger (5 points):
hmmm...
verbose_execution (2 points):
hoo??? sure, you can verbose java, but WHY??
for this kind of stuff, a simple "print" here and there is more than enough
this guy has basically chosen the measurements that (he thinks) will give his favorite language higher score and used them.
lets see... why not use important points like object-orinted, networking and multi-threaded (not that they matter for scripting, just wanted to show you how stupid his comparision is)?
One of the down sides to the advancement of the free "as in everything" OSs is that people are learning lots of perl and python and such but not learning shell. Whether you are a developer, sysadmin, user or tinkerer you should learn shell first and always add it to the list of tools to evaluate for any situation that comes up.
--
If I actually could spell I'd have spelled it right in the first place.
--- shgrep Sun Jun 13 15:42:45 2004
:; do read a || exit; [ "${a/$1/}" == "$a" ] || echo $a; done :; do read a || exit; [ "${a/$1/}" == "$a" ] || echo "$a"; done
+++ shgrep-r1 Sun Jun 13 15:43:24 2004
@@ -22,5 +22,5 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
[ a$1 == a ] && echo "Usage: $0 pattern < file" && exit 1
-while
+while
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
#!/bin/bash
CV
free ipod and free gmail!
don't use scripting languages.
with all scripting languages
I don't really consider Python a "scripting language". Just because something is easy to use and interpreted doesn't make it useful for scripting. For that purpose you really need something very loose and non-structured. I am a big advocate of Python in the workplace and I have written huge object oriented systems using it. I don't think that's a task most "scripting" languages are up to.
BTW WTF is a scripting language anyway? Can anyone really solidly define what one is? By some of the definitions I have heard, just about every language could be a "scripting language" for someone.
I've been working with Perl for about a year and a half, and I'm not a programmer by profession. I have no idea what that reg exp does, nor would I bother to take the half hour or more of brain gymnastics it would take to figure it out. It doesn't matter, however, because that's what comments are for.
/(.*?)\&(\w+)\((.*?)\)/gis
The syntax is irrelevant if the code is adequately explained. If you wrote something like the following, we'd all get along:
# Assigns the velocity of an unladen swallow to $str. Depending on the species of swallow, it either takes every character and xors it with 0x42, or wipes out your hard drive.
$str =~
Here is a binary to ascii converter in 1 loop and 1 line of bash. No it's not rock solid but does work on a bunch of 8 bits like:/ bin/bash /g'`; do :-)
# cat > test
01101000 01100101 01101100
01101100 01101111 00001010
^D
# bin.sh test
hello
#
here is the code:
----------------8<--------------------
#!
for i in `cat $1 | tr -d '\n\ ' |sed 's/\(.\{8\}\)/\1
echo -ne "\0$(( $[2]#${i:0:2} ))$(( $[2]#${i:2:3} ))$(( $[2]#${i:5:3} ))"
done
----------------8<--------------------
Now everyone post a result in another language!
Nice to see a monk out here in the wilds! BTW, chromatic, did you look at the code for the Perl tests on the article? They're a little... weird. It looks like his shell took a pass at interpolating the command line before he pasted it into the page, or something.
:\
I suppose the fact that he includes "perl -le " at the start of so many "tests" isn't really fair either -- most of those interpreters support similar one-liner options, but they got away with just the program code.
Another problem is that there is very little punctuation that gives your eye any aid in seeing structure. Very often you get a bunch of keywords and identifiers in a row with no delimeters at all! A simple example of this from the tutorial:
let cos2 = compose square cos;;
Come on, cut me some slack! Is this compose(square(cos)) or (compose(square))(cos) or compose(square,cos)? I shouldn't have to think about precedence rules when I'm reading a function call, the syntax should make it clear what's going on! Another example:Compare this with a Python-like syntax:I don't know about you, but to me the second example is a lot more readable. Readability is about making your eye see the structure without even trying. That's one of the reasons I like Python so much: I think it excels at making the structure unavoidably apparent.
Ocaml's definitely got some cool things going on, and I really respect the fact that smart people seem to gravitate towards it and get useful things done with it. If I ever learn it, I'm going to have to suck it up and deal with syntax I really don't like.
This thing was weighted from the moment they decided to disclude VBScript. They gave points for being "shebang aware" (#!), which also leans the contest towards shell scripts, etc. on Unix only, of course leaving Smalltalk and C# out to dry.
Now I'm not saying that any of these languages should necessarily win (though I'm pretty sure VBS would score pretty high in a fair contest), but this survey is meaningless because the people who conducted it are full of crap.
To be quite honest MS Batch files beat the hell out of most of the competition on many of those categories. I hope no one takes these people seriously.
Zope was not mentioned, WTF?
Remember, Slashdot does not have a -1 disagree moderation, and no, troll, flamebait, and overrated are not substitutes.
There exists no language that is the best for everything. Choosing metrics for scripting goodness is arbitrary at best. This study is pure tripe. Useless.
You should be familiar with the strengths and weaknesses of different tools and choose the best one for that particular job. And you should be a quick study.
Beanshell is not Java, so your point is moot.
I can complete most string manipulation tasks in Perl in 5 lines as compared to over 100 in Java. Java is simply not suitable in a scripting environment.
$ sml ../compiler/TopLevel/interact/evalloop.sml:52.48-5 2.56
../compiler/TopLevel/interact/evalloop.sml:35.55
Standard ML of New Jersey v110.42 [FLINT v1.5], October 16, 2002
- 1 + 1; (* Add two ints *)
val it = 2 : int
- 1.0 + 1.0; (* Add two floats *)
val it = 2.0 : real
- 1 + 1.0; (* Error! *)
stdIn:5.1-5.8 Error: operator and operand don't agree [literal]
operator domain: int * int
operand: int * real
in expression:
1 + 1.0
uncaught exception Error
raised at:
- fun f x y = x + y; (* Define a function *)
val f = fn : int -> int -> int
- fun f x y = f (x-1) y; (* Define a recursive function *)
val f = fn : int -> 'a -> 'b
Are you adequate?
If you're using UTF-8 as input, the code already works.
Scheme and Haskell are on the page?
The O'Caml example can be improved with pattern guards (ecode is eating my indentation):
Two important things you don't mention are: (a) Python doesn't actually have a case statement; (b) O'Caml's matchAre you adequate?
Computing which scripting language is best by character count? What a brilliant idea!
Sometime next week, I'll post an article definitively stating which is the best work of literature in the world. My criterion will be the one that has the most words.
Not sure how the author decided what candidates qualified for a scripting lanuage shootout.
It seems that php was left out on purpose. Not the ingredients for a fair comparison. What else hase been left out to skew the results. *ponders tha validity of the results*
No sig.
It's faster than bejeepers. I run it on my webhost as a scripting language.
Simple, fast, elegant.
http://www.newlisp.org/
Condecending clod..
not flaming, but
:)
if (File.Exists("filename")) {
is one line of c#
although a little longer than the perl counter part
if (-e "filename")
C# (all .Net) is a scripting language, as any real programmer knows.
... you ususally use one of the few which are installed and allowed to use.
This is even more true if you are a consultant. Right now I have the choice between Perl, PHP and sh. I'd love to do Python but convincing my bosses is not worth the effort.
And the choice between those boils down to "Is there already a script which does somehow what I want?". I take that one and modify it.
Heck, for most of the stuff that has to be scripted it is totally egal which language you use (most of the time ist is "read csv, rearrange and import into database xy" or the other way round anyway.). Don't waste time on language decision. Developers tend to be almost religious about it.
-silence
Dyslectics of the world, untie!
I skimmed them. Honestly, I wondered more about how Parrot would fare than looking for odd Perl results.
how to invest, a novice's guide
What about Beanshell! It is a scripting language for Java-based applications like jEdit. Beanshell will interpret ordinary java source files in addition to class files. You can even write a simple web browser in less than 74 lines of code! It surely should have been considered along if languages such as Pike, Lua, and Haskell were thought of.
This entire analysis seems suspect. Take the first section. For JavaScript, their implementation uses NJS, which hasn't even stabilized with a 1.0 release yet! They also have a unix bias: many applications have no need of the shebang, #!. Even though, a script in another language could easily be written to implement that feature. Shebang support is a trivial and doesn't deserve the 15points awarded. Furthermore, awarding points for "program(s) can be passed on command line" is silly. That is a horrible horrible style of coding guaranteed to make scripts hard to maintain.
Their second section is not complet and has a heavy bias against Java and C#. The subsections, "smallest" and "hello world," are silly. I never understood why having a small size for the simplest program is important for nontrivial applications. (For that matter, I never understood why programmers wish for the "least typing" in a language. I never never never code for least typing, since that often makes programs unreadable!) Finally, their coding style is inconsistent. For instance, they use for Java:
Yet the authors throw these conventions out with JavaScript:
(Also note that the numbers reported and counted don't match, but I may just be missing something.) Why? Java and C# seem destine to loose with the author's methods. As I said, this entire report seems biased and unscientific.
P.S. /. needs to fix the site's source code white-space style. This is getting ridiculous.
It is impossible to enjoy idling thoroughly unless one has plenty of work to do.
- Jerome Klapka Jerome
This is a shitty review. I just quickly glanced (no more than 30 seconds reading), and here are a couple glarring problems:
- It's stated that perl's shortest "test file existence" code would be: -e "/etc/mtab" or exit 1. The "or exit 1" is extraneous.
- There's no mention of php, which is a widely used scripting language.
- it refers to bash as sh, which are, technically speaking, not the same thing.
- doesn't take into account the "scratch the itch" need of a good scripting language. ie, the language needs to be versatile in addition to be able to carry out routine tasks.
There's really nothing to see here. Pretty worthless 'review'
~/ssh slashdot.org ssh: connect to host slashdot.org port 22: too many beers
Despite its position in the middle of the pack, merd is pretty close to shit. I mean literally, just add an 'e' to the end. Check the fish if you don't believe me.
Anybody want a peanut?
- Anonycous Moward
find -name "*.c" | sed 's/.c$/.o/;' | xargs echo all: | make -f-
(this is because GNU make is smart enough to figure out how to make
Perhaps the "sh" implementation could assume that there's a perl implementation with shebang in a file called "x" in the same directory and make every "sh script" as 'x "$@"'? That would be really effective scripting language! :-)
_________________________
Spelling and grammar mistakes left as an exercise for the reader.
come on, Pixel (the author of merd) is a language geek. He has tons of stuff on his home about diferent features of different languages, and I don't think you should consider this biased. Simply put, this was just a research he did for fun, on the lines of the CRAPS system from doug's shootout, why the hell you're believing it means something ?
I overlooked that bit. But I didn't notice any bashisms in their code, and it's rather surprising how many bashless systems I've had to deploy existing scripts on (requiring some porting in many cases).
This is hardly an argument against Bash--now is it? Even despite the obvious lack of omnipresence of Bash, I would bet it is still much more popular than Merd, Lua, OCalm or even Haskell which were also evaluated in the article.
I have seen more perlless than bashless systems myself. I have seen lots of systems with Perl 4 (there are still new systems shipped with Perl 5.005 (sic!) today which is so 1998) but I would not consider using only Perl 4 syntax in the Scriptometer test because of that.
Nevertheless, having done it myself too many times, I can perfectly understand your pain in porting shell scripts. As Larry Wall once said, "it's easier to port a shell than a shell script."
Actually, I don't know of many systems to which Bash has not yet been ported. The systems with Bash I know of are GNU/Linux, FreeBSD, OpenBSD, NetBSD, BSD/OS, BeOS, Sun Solaris, IBM's AIX, SGI, HP-UX, Compaq's Tru64 Unix, Jaguar/MacOS X--just from the top of my head. I would consider it a very strong argument pro Bash.
To be honest, I don't know what would you expect from a Bash script grepping text file in the linked article. Running an external grep is apparently not good enough even though running external programs is essentially what shells are supposed to do... Fair enough, so I have written a pure Bash script, which in turn is still not good enough since it is a Bash script... Well, I rest my case.
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
So, he wanted to test for the best language to replce the bash shell, and the winner is bash. So, what's the surprise?
If he wanted to test for other things, the results might have been a little different. He didn't. I won't be changing language preferences based on this, and I suspect you won't either.
-- Slashdot gains self-awareness. Deduces the existence of income tax and rice pudding.
- a.c.
I've used Perl and Bash, etc., but I keep coming back to Python. The syntax is simple and clean, with few exceptions. I can write a complex program in no time, and I can remember the syntax after not having touched the language for 3 months, while drunk.
It's not as popular as Perl and not as new and trendy as Ruby, but it's a simple, no BS, get the job done, language. It has bindings into everything, and combined with GLADE, is about the easiest way to make a nice GUI really fast - yes, sometimes interactive scripts need GUIs, and "dialog" gets old real fast...
There aren't a billion downloadable additions like Perl, but it comes with such a large standard library, that for most quick and dirty tasks, Like Ragu, "it's in there".
It reminds me of the pseudo-code my Pascal teacher made us write out before the actual code. For that matter, Python also reminds me of what I liked best about Pascal vs C - sets and the like...combine this with "magic" lists/arrays like Perl and syntax without $#@#$ and you got a winner!
I used to admire one line C programs, which looped and did useful code as "side effects". However, in the real world, when one wants to modify such a one line program and has to unwrap that damn "loop", it's much easier to maintain, for myself 3 months later while drunk and others, if it's written in expanded Python style to begin with.
BTW, Python does regular expressions, but via a library. This means a few more lines of code, in other words, it's not built in like Perl, but this really isn't a disavantage. Perl matching spoils you, but often, the complex pattern match soltuion isn't needed anyway - basically, Python can do Perl stuff, but Perl doesn't do structure and readibility like Python.
Honestly, when I need a super quick and dirty solution "near the shell", I use Bash. I've actually written complex Python programs that drive several Bash scripts. It seems counterintutive, but between the two, Perl has become obsolete for me. I now firmly believe that there is no perfect, one size fits all, solution.
Slashdot decides to send 2.7 tons of rice pudding to Internal Revenue Service.
You're thinking wrong about it-- conceptually, all functions take a single argument. Well, ok, you can get away with thinking of functions as having multiple arguments most of the time; but the point of the design is that you can apply functions partially:
I guess that would partially explain why it isn't notated compose(square, cos), because although that's the net effect it isn't actually evaluated that way.A further confusion is that it's possible to write functions like this:
The thing is that (2,3) is a single value-- a tuple of two ints (int * int)-- and g is a function from tuples of ints to ints. Tuples don't support partial evaluation like curried functions, but you can pattern match over their contents...Are you adequate?
On the other hand, if the intent is to develop applications, ie scripts that are typically 40k of source file, then i found Don Knuth's "structured programming" approach useful.
You see, the "problem" is that one can have very large loops, like
What i did was to break the program down to handleable segments, and then assemble the program in the index, like so:The advantage of this is that one can use the same variable across a whole range of files, and one can at a glance see what each segment of code does. The result is then compiled, so that the run-time code is free of comments.The language can be set up to be simply a text processor, so that one can write the program and INI files in the same source.
You can even do web pages in it, although i prefer to use a home-grown markup language + converter, which i implemented in exactly this way. It is a 40K source file, that breaks down to a 20k rexx script. One can add different bits and pieces without having to digest a 40k file every time: the 40k weave file is structured for easy reading and editing, the resulting 20k output is structured for easy interpretation, since no dead code or comments ever makes it to the list (even where it is in the source tape).
Weave has its limitations also, in that it is not suited for larger programs (as Jon Bentley pointed out in his critisms of Literate Programming), but the approach of "compiled" batch and script files is *ideal* for jobs that rely on 20k-60k files.
My weave-program is itself written in a miniture weave-program, that allows one to intersperse rexx script and comments at any ratio, giving at the end, a rexx script, with no dead code in it. In the example below, one does not see any comments or dead code go through to the program.
OS/2 - because choice is a terrible thing to waste.
What about Jython. It combines Java and Python and runs everything on the JVM. You get two languages in one because you can use java code and python code interchangably. There are restrictions place on python code because of the JVM, but thats Java's fault.
I think Jython is fairly popular, another good one overlooked.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
irb(main):001:0> 2 + "2"
TypeError: String can't be coerced into Fixnum
from (irb):1:in `+'
from (irb):1
irb(main):002:0> "2" + 2
TypeError: cannot convert Fixnum into String
from (irb):2:in `+'
from (irb):2
You don't get 22, you don't get 4 either. You get an error. IMHO, that's more sensible than either of those behaviours. If you want string concatenation, then make sure you're dealing with strings. If you want numbers, then make sure you're dealing with numbers:
irb(main):003:0> "2" + 2.to_s
=> "22"
irb(main):004:0> 2 + "2".to_i
=> 4
> If you need 20 lines of C# to check if a file exists
Yeesh, I hope you made that number up. I think even COBOL can do it in less
than twenty lines (though probably not much less), and Perl is probably not
the only language that would do it in one line. Heck, it'd be about three
lines in BASIC.
Cut that out, or I will ship you to Norilsk in a box.
.... to read Chinese is a real fucking peace of sugary cake.
Well, Duh!
Perlmongers believe that everybody is fluent in Chinese.
IANAL but write like a drunk one.
I looked at the scriptometer page, but didn't find much about Java scripting environments (not JavaScript). I'm a long time user of Bean Shell and consider it to be damn near perfect, though I know there are other interpreters. While it does not have such scripty features as weak typing (there are other solutions that do), it does allow for very quick scripting for a Java programmer and leverages all available Java libraries! And as I said, it's not just one language, but a whole class of them to choose from. That's some powerful stuff.
Alexey
UnrealScript Language Reference
:)
Sorry, but I just had to post that...
Peace!
-=- James.
"For all program aspects investigated, the performance variability due to different programmers (as described by the bad/good ratios) is on average about as large or even larger than the variability due to different languages."
Which is why it almost always makes more sense writing it in whatever you're most experienced with, because you know all the tricks and techniques. Writing it in the 'most appropriate' language opens you up to the problem that you aren't that good in that language, so then you write worse code and it ends up not performing any better anyway.
They don't realise that the reason the asshat can fix things so quick is that he frickin' caused the bug in the first place.
Rant over.
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
Because neither of them are programming languages.
THWAP!
BUT, Python was in there and since that's the foundational language for Zope, you SHOULD be happy.
Were you even serious?!
Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!