Building a Programmer's Rosetta Stone
Did you ever run into the problem where you knew how to do something in one programming language, but really needed to do it in another? That's what Rosetta Code is all about. A variety of programming tasks are solved using as many languages as possible. You can examine existing tasks, or create your own.
Posted to Technocrat.net- as I'm "semi-paid contributing editor" there, it hit the front page immediately of course.
SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
A lot of the tasks assume imperative programing, e.x. assigning values to an array. This should be about algorithms that we can all implement, not code fragments that assume a particular style of programing.
Inventions have long since reached their limit, and I see no hope for further development.-- Frontinus, 1st cent. AD
Oops, I broke the link. Here it is: polyglot programs
"A door is what a dog is perpetually on the wrong side of" - Ogden Nash
Of course there are also cases when you will need to port the solution to a different language. This may be the cause when the project specifications requires a specific language like Ada.
As with all programming; your mileage may vary.
If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
I'm not sure the right idea is to "know how to do something" in a particular language. If programmers are encouraged to learn algorithms specific to a particular language, how will they ever adapt once their pet language sinks? (By using an algorithm repository to re-learn rote code?)
At any rate, I think this site has already encountered a problem which is only going to escalate as it grows: code isn't cross-indexed properly at all. For example, there are many "programming tasks" with solutions in C, but there is nothing on the C page. I think this problem stems from the fact they used MediaWiki.
MediaWiki's great for something like... well, Wikipedia. But it doesn't support a cross-referenced database like this. The wiki concept is good for this site, but the server needs to be running some software designed better to the task.
Also check out 99 bottles of beer and Hello World Collection.
"How to bring a hooker back to life" Damn, I really neede....I mean, was interested in how you would do it in Perl, for curiosity's sake....
Monstar L
The site has absolutely no real content. There are only a couple of pages on the whole site. The most advanced thing found there is something along the lines of how to open a file with mIRC scripting (no C/C++/Java) and that bash scripts (usually) start with #!/bin/bash. Oh, please. Should I be impressed?
I demand the Cone of Silence!
It's already been done. Planet Source Code does this already, and it's been around for ages. You can find code examples and complete projects.
Then for projects in the .NET set there are a number of online translators that do C#VB.NET. Very good for moving code between different types of projects.
Now, something that would be truely useful would be a service that would do translations from a wider variety languages.
Politics is the art of looking for trouble, finding it everywhere, diagnosing it incorrectly and applying the wrong fix.
http://jody140.dsl.frii.net/SWE/ProgEvol
Apple, which currently has a product called Rosetta, which allows PPC code to be executed on Intel chips by translating it dynamically or something.
I had to get it started. My hope is that other people will contribute with languages (and tasks) that they know.
tasks(723) drafts(105) languages(484) examples(29106)
Although the idea seems nice, it still has a long way to go. The site currently only contains a few mIRC and bash scripts.
Anyway, I'm looking forward to when it's filled with code from different languages.
PS: an applet or an IDE plug-in like those from Koders would be really cool.
Did you even bother looking at the site first? Perhaps not as it's slashdotted. The idea isn't bad, but it's just a nearly empty wiki. Not many languages, and looking at some tasks, most of the stuff wasn't very useful. For example, I looked at the file I/O task, and there were no versions for C, C++, Java, C#, VB (not that I'd want that), PHP (idem) nor anything like that - but there was a mIRC scripting version...
Might be worth posting somewhere once there's actual useful content, but just not now.
But then again, I'm sure the editors didn't even look at it either before posting. There's nothing news worthy or interesting there - yet.
Sourceforge has hosted to Programming Language Examples Alike Cookbook project for a while now. It does something similar, filling out "Perl Cookbook" recipes for a fairly wide range of languages...
http://pleac.sourceforge.net/
Years ago my copy of Kruse's "Data Structures" came with examples of how to do all the then-hip dynamic data structures (linked lists, trees, etc) in languages without pointers. This became useful when writing high-level Fortran-77 programs, as it allowed moving beyond Gomputed Goto and Arithmetic If for algorithms. In the same vein "Numerical Algorithms" (Teukolsky, Vettering, et al.) showed how to get decent array performance and add various oversights (such as complex numbers and complex arithmetic) to C-type languages.
>>>I see this ending up as an effort to shoehorn concepts unique to one language to another language (building web sites in COBOL *shiver*).
I once saw a series of cgi-bin routines written in Fortran-77 because that's what the web-site designer knew, and the schedule was too tight for her to learn Perl in time. (for those of you who started programming after compiled languages gave way to Python/Perl/Ruby/WombatCode6000, get a copy of G77, and try to compare two strings of different lengths) It's no big deal; given enough time one Turing-complete language can accomplish the same work as any other Turing-complete language. It's just the degree of pain you're willing to endure that's the limiting factor.
As for the F77/cgi-bin programmer, She's a full professor now (though not in Comp. Sci, alas),
the more accurate the calculations became, the more the concepts tended to vanish into thin air. R. S. Mulliken
One project that deserves a look here is the LiteratePrograms project. The goals are somewhat different from Rosetta, with more emphasis on teaching of algorithms and the ability to run code directly from the wiki.
As one who has worked on a couple of multi-language problem sets (SICP in other programming languages and OO Shapes), I can appreciate the amount of work it takes. We can always use more sites that teach programming in various unique fashions.
I wouldn't expect all tasks to be solved in all languages. For example, I wouldn't expect someone to solve the File I/O task in UDB DB2.
I would expect to see an eventual segregation between things like database tasks and web development tasks. I simply haven't known enough about programming to collect the requisite data myself.
tasks(723) drafts(105) languages(484) examples(29106)
I can beat that. The language Greet has the specification that an empty input file (or indeed, any other) is a program directing the language to print "Hello, world!"
In fact, K&R presents a complete Greet interpreter very early on.
My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/
But all Real Programmers know all languages! At least that's what Slashdot keeps telling me...
AC: Stupid article, the guy could have used Haskell and solved his problems
BB: But maybe he didn't know Haskell?
AC: Then he deserves get fired!
Don't blame me, I didn't vote for either of them!
"In the 1980s capitalism triumphed over communism, In the 1990s it triumphed over democracy."
And in the 2000's, it's well on the way to triumphing over common sense... with apologies to the author.
Seven puppies were harmed during the making of this post.
Why?
Your C-language for-loop example uses the same crappy example as nearly every crappy text of the "learn C in 7 days [assuming you already know BASIC)" genre. Giving the first example this way --- as "a for-loop is something that counts, here's how you make it count" is
A for loop in C is simply the exact, beautiful, expression of the iteration concept: See? Has nothing to do with numbers.
You're saying: execute LOOP_INITIALIZER, evaluate LOOP_INVARIANT, if it's true, perform EXPERSSION, evaluate PROPELLER and go back to the part of this sentence where we evaluated LOOP_INVARIANT.
Because of this craputidinous teaching, I am constantly faced with programmers who cannot understand a loops of these types: ...and these people have freakin' degrees in computer science. That final (contrived) example, BTW, is a fine way to avoid doing stupid shit like .... So: Why is the for-loop superior in every way to this while loop example?
Look carefully.
Loop control in the for statement is on the same line of code as the loop-construct keyword. In the above while-statement, loop control is at the beginning, middle, and end of the block. That's just BEGGING for a maintainer error. Yet 99 out of 100 C programmers prefer the second form... because it looks more like BASIC... they don't understand the beauty of the for-loop... they simply think ("Oh, I don't have any numbers to count, so I'd better use a while-loop"). That's CRAP! It's broken thinking, and it encourages buggy programs.
It all comes down to people teaching to the lowest common example [denominator], rather than actually exploring the concepts behind the language.
Do daemons dream of electric sleep()?
for the site to come back, you can use this.
"Beware of he who would deny you access to information, for in his heart he dreams himself your master."
That's one thing I want to see rewritten in several different languages.
Just so I can make sense of the damn thing and I won't look at my call to ITPLBV() and wonder, "What the fuck does THAT do?"
grey wolf
LET FORTRAN DIE!
There is the PLEAC (Programming Language Examples Alike Cookbook) which uses (or should use) the same examples for many programming languages.
Many languages are close to complete the provided examples.