Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Building a Programmer's Rosetta Stone

CmdrTaco posted more than 7 years ago | from the still-waiting-for-programmer's-tower-of-babel dept.

215

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.

cancel ×

215 comments

Sorry! There are no comments related to the filter you selected.

I don't know about firehosing it (1)

Marxist Hacker 42 (638312) | more than 7 years ago | (#17682502)

But would you mind if I submitted it to Technocrat?

Re:I don't know about firehosing it (1)

Short Circuit (52384) | more than 7 years ago | (#17682670)

Not at all.

My only concern is that it's on shared hosting through Dreamhost. But if it comes down to it, I've got people I can talk to to see about alternate hosting.

Re:I don't know about firehosing it (2, Informative)

Marxist Hacker 42 (638312) | more than 7 years ago | (#17683338)

Posted to Technocrat.net- as I'm "semi-paid contributing editor" there, it hit the front page immediately of course.

Re:I don't know about firehosing it (1)

Short Circuit (52384) | more than 7 years ago | (#17684154)

Cool. I've been watching the activity on the wiki. There appear to be more than a few exploring the site and updating the pages.

Pointless, don't bother! (3, Informative)

Anonymous Coward | more than 7 years ago | (#17702422)

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.

Re:Pointless, don't bother! (5, Insightful)

JoshJ (1009085) | more than 7 years ago | (#17702504)

Right now it may be "pointless" for someone looking at it. It is certainly not "pointless" for contributing to it. Posting it to /. , technocrat, and similar means that it will get exposed to a lot of potential contributors.

Re:Pointless, don't bother! (1)

dosius (230542) | more than 7 years ago | (#17702654)

mIRC script, eh? I could use a SysReset or UPP here on X-chat... rather than having to run wine for mirc or use the braindead irssi fserv...

-uso.

Re:Pointless, don't bother! (2, Insightful)

Zadaz (950521) | more than 7 years ago | (#17703124)

Then add something.

Whoops, my fault. Being a hater is easier.

Perhaps I'm not hip enough. (0)

Anonymous Coward | more than 7 years ago | (#17702446)

Firehosing would seem to imply dousing, as in putting out his idea with a firehose. The definition that seems to apply to the context here is:

Extensive and possibly excessive criticism of an idea by presenting an overwhelming number of arguments against it.

I don't know what technocrat is, that could be where the confusion is coming from. It is perhaps a site that rips apart ideas? Site won't load for me so I honestly don't know. Other than that I don't understand how your title and comment go together other than you just really wanting to use the term firehosing to sound with it.

To me what you said is like...

I'm sorry to burst your bubble but I think that's a great idea, you mind if I share your idea with others?

Re:Perhaps I'm not hip enough. (1)

Short Circuit (52384) | more than 7 years ago | (#17703618)

I have no problem with criticism. It tells me how I can improve.

The exposure has pointed me to several other sites and projects with similar aims. I won't rip code off, but I will be investigating how they run their projects.

I made it through! (1)

Shadow Wrought (586631) | more than 7 years ago | (#17682542)

Whatever was keeping me out is either gone or something, but I have access now. Since I am attempting (yet again) to teach myself coding I am very excited about using the site and will be voting you up in the hose;-)

Erm... (1)

jpellino (202698) | more than 7 years ago | (#17702004)

You're itchin' for a fight with Cupertino, is that it?

Re:Erm... (1)

Short Circuit (52384) | more than 7 years ago | (#17702218)

Cupertino? Who's that?

Re:Erm... (2, Informative)

lexarius (560925) | more than 7 years ago | (#17702342)

Apple, which currently has a product called Rosetta, which allows PPC code to be executed on Intel chips by translating it dynamically or something.

Re:Erm... (1)

Short Circuit (52384) | more than 7 years ago | (#17702482)

Ouch.

Well, I'll put contact info in About page. If they want to make an issue out of it, I'll hand over the domain. I've got another name as backup.

Re:Erm... (1)

AndrewNeo (979708) | more than 7 years ago | (#17702690)

Apple won't have anything on you since it's a name based off of something else.. if anything, the actual company Rosetta Stone would be a problem.

Re:Erm... (0)

Anonymous Coward | more than 7 years ago | (#17703006)

It's a completely valid domain name. If Apple or anyone gives you any shit about it, make it as inconvenient and public as possible. You don't need to take it to court, you just need to make it an utter pain in the ass for them. We've all seen far too much legal bullying over domain names.

No Fair! (4, Insightful)

Watson Ladd (955755) | more than 7 years ago | (#17702038)

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.

Re:No Fair! (1)

tomhudson (43916) | more than 7 years ago | (#17702084)

That's what google or a good book are for. Even (bleh!) design patterns.

Or programs that convert from one source language to another ...

Re:No Fair! (5, Informative)

Short Circuit (52384) | more than 7 years ago | (#17702236)

I would be happy to see other types of programming represented in Rosetta Code. I only included what I already knew. Rosetta Code should be about many things I don't already know. Once the server's no longer slashdotted, stop by blog.rosettacode.org [rosettacode.org] , and I'll make a point to bring up how to add your own programming tasks. (Really, you just have to add a template to the top of of the page. But there are some guidelines.)

Re:No Fair! (1, Interesting)

Anonymous Coward | more than 7 years ago | (#17703418)

Perhaps it would useful for you to investigate design patterns [wikipedia.org] . They're at a higher level of abstraction than what appears in Rosetta Stone. It might be possible to kickstart Rosetta Stone by having multiple implementations of the patterns. A couple of caveats: someone else may already have done that, so I'd look around before spending a lot of time implementing the patterns; the Wikipedia article lists some criticisms of design patterns.

minus 4, T8oll) (-1, Offtopic)

Anonymous Coward | more than 7 years ago | (#17702050)

contribute3 code approximately 90%

Re:minus 4, T8oll) (2, Informative)

Short Circuit (52384) | more than 7 years ago | (#17702350)

I had to get it started. My hope is that other people will contribute with languages (and tasks) that they know.

LiteratePrograms (2, Interesting)

Chris Rathman (458868) | more than 7 years ago | (#17703146)

One project that deserves a look here is the LiteratePrograms project [literateprograms.org] . 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 [codepoetics.com] and OO Shapes [angelfire.com] ), I can appreciate the amount of work it takes. We can always use more sites that teach programming in various unique fashions.

Here's better (1)

Rosco P. Coltrane (209368) | more than 7 years ago | (#17702054)

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?

There are also programs that can be compiled or run by several different compilers/interpreters: [nyx.net]

Re:Here's better (3, Interesting)

Rosco P. Coltrane (209368) | more than 7 years ago | (#17702074)

Oops, I broke the link. Here it is: polyglot programs [nyx.net]

It may prove useful. (3, Interesting)

Z00L00K (682162) | more than 7 years ago | (#17702086)

But as a seasoned programmer I also know that some tasks can't be ported. A more efficient method is to actually resolve the problems at link time since most object files doesn't really care about which language you use. Some tasks are better off in one language than in another and porting the "problem" may prove a herculean task ending up as the major time-consumer for a project.

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.

Re:It may prove useful. (4, Insightful)

arevos (659374) | more than 7 years ago | (#17702198)

But as a seasoned programmer I also know that some tasks can't be ported. A more efficient method is to actually resolve the problems at link time since most object files doesn't really care about which language you use.
If you look at the programming tasks [rosettacode.org] the website attempts to translate, you'll notice that they are extremely basic and generic. I don't think the aim of the website is to translate some complex library into another language; rather to provide a learning resource where programmers can see how to map simple tasks from one language to another, which presumably will help them better understand a new language. Remember that the original Rosetta stone was used for a similar purpose.

This site could be useful, but MediaWiki doesn't seem the best tool to use, and the content so far is rather sparse. I'm uncertain whether this will prove a success; it's an interesting concept, but many interesting concepts have fallen by the wayside.

Can't get there from here. (0, Flamebait)

Anonymous Coward | more than 7 years ago | (#17702246)

"as a seasoned programmer I also know that some tasks can't be ported"

Are you an old man in bibbed overalls leaning back in a rocking chair on the porch of an old run down general store playing checkers and exchanging quick glances with your friend suggesting the pair of you have some fun with this rube asking directions to the next town?

"Yer cannit git thar frum hair."

Re:It may prove useful. (0)

Anonymous Coward | more than 7 years ago | (#17703682)

"most object files doesn't really care about which language you use"

You sure? Can I link a java class file into a C++ binary? You can't even link C++ object files compiled with different compilers on the same platform, in some cases (different compilers mangle symbol names in different ways, etc - and obviously linking C++ object files compiled on different platforms isn't going to work). It sounds like you might be a seasoned .NET programmer, at best.

Re:It may prove useful. (0)

Anonymous Coward | more than 7 years ago | (#17703776)

I also know that some tasks can't be ported.
Can't all tasks be ported between two languages, assuming they're both turing complete?

Usage (5, Insightful)

mgiuca (1040724) | more than 7 years ago | (#17702094)

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.

Re:Usage (3, Informative)

Short Circuit (52384) | more than 7 years ago | (#17702440)

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?)
Rosetta Code was largely inspired by a page on Wikipedia where the classic "Hello World" example was shown in a few hundred languages.

Rosetta Code takes the concept behind Hello World, and spreads it to other tasks.

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.
Actually, this is (almost) intentional. I want people to be able to learn about the languages they're using. I've been filling in the pages as I've had the opportunity. (I'm a full time college student, and president of a student organization.) Check the page on GCC, for example. [rosettacode.org]

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.
I'm open to suggestions. (And assistance, if it'll go that far.)

Re:Usage (3, Insightful)

cp.tar (871488) | more than 7 years ago | (#17702524)

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?)

But this kind of thing should be very good for someone learning a new language - you know how to do it in one language, now you're looking it up in another one... like learning the most common phrases first when learning a natural language.

I hope this project will amount to something; it can be really useful.

Re:Usage (1)

garo5 (895321) | more than 7 years ago | (#17703866)

Mod parent up!

MediaWiki is not a good platform for this. You should create own software which is designed for this kind of usage.

  - Garo

Re:Usage (0)

Anonymous Coward | more than 7 years ago | (#17703906)

And then in the spirit of the site, port it to all languages!!!!!!!

if you like this... (3, Informative)

taybin (622573) | more than 7 years ago | (#17702096)

Also check out 99 bottles of beer [99-bottles-of-beer.net] and Hello World Collection [roesler-ac.de] .

Re:if you like this... (2, Informative)

mgiuca (1040724) | more than 7 years ago | (#17702136)

Another great one: HanoiMania [kernelthread.com] . 111 solutions to the "Tower of Hanoi" [wikipedia.org] recursive problem, some in very creative and bizarre environments (as outlined in the summary at the top).

Re:if you like this... (0)

Anonymous Coward | more than 7 years ago | (#17702582)

I've found PLEAC [sourceforge.net] useful as well. From the site:

Following the great Perl Cookbook (...) which presents a suite of common programming problems solved in the Perl language, this project aims to gather fans of programming, in order to implement the solutions in other programming languages.

Re:if you like this... (3, Informative)

Coryoth (254751) | more than 7 years ago | (#17703038)

Also worth looking into is LiteratePrograms [literateprograms.org] which provides a wide range of algorithms written (and documented - hence the "literate" part) in a wide variety of languages. Currently there are over 50 different "Hello World" programs in different languages, including such things as AliceML, AspectJ, Haskell, and Oz, as well as all the usual suspects. More to the point, it also includes a decent variety of more interesting algorithms, including basic sorting algorithms (quick sort, merge sort etc.) in a wide variety of languages, right the way up to a basic GUI file manager in GTK. It's a Wiki, and still growing, but it seems to be well ahead of RosettaCode at the moment.

Re:if you like this... (2, Interesting)

Dan East (318230) | more than 7 years ago | (#17703214)

As far as actual usefulness goes, the 99 Bottles of Beer site is worthless. The C version implements a Linux Kernel Driver! Now what's the point in that? Why not output to stdio? The C++ version doesn't even use OOP or implement a single class! It uses recursive templates and thus doesn't contain a single piece of runtime logic.

However the real nail in the coffin is that the fundamental algorithm used to generate the song varies widely from one language to another, thus no real comparison between languages is possible.

Dan East

Re:if you like this... (0)

Anonymous Coward | more than 7 years ago | (#17703444)

Did you even have a look at the site before flaming away?
For C there are 4 more versions, for C++ 5.
With simple output to stdout and with classes.

The *point* of this site is to show different language features, not to implement the program in the most simple way.

One task that isn't on there (4, Funny)

antifoidulus (807088) | more than 7 years ago | (#17702098)

"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....

Re:One task that isn't on there (3, Funny)

Anonymous Coward | more than 7 years ago | (#17702308)

use Hooker::Transactional;

Hooker::Transactional->get_last->rollback;

Dude, CPAN has EVERYTHING! :)

Re:One task that isn't on there (1)

Hektor_Troy (262592) | more than 7 years ago | (#17702378)

I didn't know Ben Affleck [imdb.com] posted on Slashdot.

Re:One task that isn't on there (2, Funny)

patio11 (857072) | more than 7 years ago | (#17702552)

>>
I mean, was interested in how you would do it in Perl, for curiosity's sake....
>>

There's more than one way to do it.

Re:One task that isn't on there (1)

Larry Lightbulb (781175) | more than 7 years ago | (#17702620)

My book "101 uses for a dead hooker" will be published in time for Christmas.

Re:One task that isn't on there (1, Funny)

Lord Ender (156273) | more than 7 years ago | (#17703530)

I mean, was interested in how you would do it in Perl, for curiosity's sake....

  • Hold down shift.
  • Mash the top row of your keyboard with your fist. You may also consider outsourcing this job to your cat.

The Perl language was designed with genetic programming in mind. Any random combination of characters is executable Perl.

Great! It as close as you can come... (0)

Anonymous Coward | more than 7 years ago | (#17702100)

to having a psuedocode compiler!

Re:Great! It as close as you can come... (1)

$RANDOMLUSER (804576) | more than 7 years ago | (#17702228)

> to having a psuedocode compiler!

And what standard for psuedocode are we going to use? I once worked for an old-fart IMB 360 assembly language programmer turned CTO, and for a while he had us (I'm not making this up) using a program that used a psuedocodish language to produce flowcharts, which could then be used to document programs written in a 4gl (Progress). He did not see the irony or humor in this.

The wonderful world of copy and past programming ! (0)

Anonymous Coward | more than 7 years ago | (#17702104)

As if we didn't have too much of that already.

Should I be impressed? (4, Insightful)

Fulkkari (603331) | more than 7 years ago | (#17702130)

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 [rosettacode.org] (no C/C++/Java) and that bash scripts (usually) start with #!/bin/bash [rosettacode.org] . Oh, please. Should I be impressed?

Re:Should I be impressed? (1)

TodMinuit (1026042) | more than 7 years ago | (#17702276)

Oh, please. Should I be impressed?

I think so: Somehow, inspite it's nothingness, it got on the frontpage of Slashdot.

Then again, it is a Sunday, and yet the server got Slashdotted.

Re:Should I be impressed? (3, Insightful)

LiquidCoooled (634315) | more than 7 years ago | (#17702384)

It got to the frontpage because its an interesting idea.
The firehose will help with things like this.

I agree it was empty and its implimentation feels flawed, but it gives a baseline for thoughts other people may be having.
I know *I* have been thinking about this since I saw it and how it should/could be once filled.

It gets a thumbs up from me.

Re:Should I be impressed? (1)

Short Circuit (52384) | more than 7 years ago | (#17702622)

Then again, it is a Sunday, and yet the server got Slashdotted.
3000 hits to the main page in 45 minutes. I've got to find better hosting.

Re:Should I be impressed? (1)

TodMinuit (1026042) | more than 7 years ago | (#17702972)

That's not a lot, although that is to merely the frontpage. Perhaps it isn't the server, but the fact that you use MediaWiki, which I think is SQL query heavy.

Re:Should I be impressed? (1)

Short Circuit (52384) | more than 7 years ago | (#17703788)

The server load average at the moment is 178.35, 153.35, 143.98. I don't think Dreamhost wants me any more.

Re:Should I be impressed? (1)

Giometrix (932993) | more than 7 years ago | (#17703154)

"3000 hits to the main page in 45 minutes. I've got to find better hosting."

I wasn't able to get to the site, and I don't know how much data your pulling from the database on that page.... but did you cache the data being returned from the database?

My site, also on a shared hosting platform (cheap plug alert: www.bookgoldmine.com) received similar traffic when it got on StumbleUpon and it handled it quite well. I made heavy use of caching, which is what probably did the trick.

Also, my back end is SQLite (www.sqlite.org). In the past I've had issues with databases on shared hosting plans. Basically the web servers had terrific uptime, but the database uptime was mediocre, at best. Even when the db (I've used both MySQL and SQL Server on shared hosting plans, MySQL fared worse, probably because the plan is cheaper and more people are on those servers) was up, performance often stinks because there are many other sites hitting those db severs... which means plenty of badly written queries hitting the same db server.

I figured I might as well use SQLite, which is very fast and scales well up to about 4GB (my database is about 1.5MB right now @ 161 books, so I'll never get close to even .5GB). The db is actually part of your program, that is, it runs on the web server. Since from my experience the web server uptime is much better than the db server on these plans, this solution made sense to me. Of course, if I ever need to use some sort of load balancing system I'll probably need to port this system to a RDMS, but I'll worry about that when the time comes. If your site doesn't have a large number of users PUSHING data at the same time (SQLite's is ACID compliant, but the locking system is not as eloquent as the ones used by RDMSs) then you may want to consider using it as your back end, especially if you continue to have problems.

Re:Should I be impressed? (1)

Short Circuit (52384) | more than 7 years ago | (#17703498)

I'm following up on an offer to move the site to a faster, dedicated server. We'll see how it works out. :-)

Re:Should I be impressed? (1)

llefler (184847) | more than 7 years ago | (#17703292)

3000 hits to the main page in 45 minutes. I've got to find better hosting.

Wikis seem to be fairly processor intensive. I looked at MediaWiki when I was setting up one of mine, and besides being slow it was a pain to set up. I don't know why they don't include a lot of the stock help pages in the distribution. I ended up using DokuWiki for user documentation for my apps. My production documentation server runs in a VM and the CPU spikes to 100% every time it serves a page. I doubt my hosted site over at GoDaddy would fare much better.

Re:Should I be impressed? (1)

peektwice (726616) | more than 7 years ago | (#17702366)

No, do not be impressed. This is only a test. There is no content. In the event that there is actual content, you will be notified by a Slashdot front page article.....wait.....dammit. Also, does anyone have to be show how to do something in Perl? In general, if yo slap together some code, it'll run. Whether it will do what you want or not, is usually up for debate. Iterations of this process will eventually make it perform the task at hand.

Re:Should I be impressed? (1)

TeleoMan (529859) | more than 7 years ago | (#17702392)

Should I be impressed?

Yes. And here are two points:

1) Imagine an older, wizened Dr. Daniel Jackson in one final all-out war with the Gay-ould. A line of antiquated C++ code will allow him to upload a virus to the mothership from a PowerBook, thus leaving all of humanity unscathed (relatively). He hits rosettacode.org, translates Gay-ould into C++, and voila! No more evil alien fem-dom.

2) A wood chuck would chuck all the wood he could chuck if a wood chuck could chuck wood.


PS-> Fuck you.

Re:Should I be impressed? (1, Insightful)

Short Circuit (52384) | more than 7 years ago | (#17702538)

I'm sorry it doesn't meet with your approval. It's a wiki. Care to improve it?

Re:Should I be impressed? (1)

Fulkkari (603331) | more than 7 years ago | (#17702932)

Sorry if I seemed a bit harsh, but it was a Slashdot frontpage story after all and I think most of us kind of expected a bit more from it. As you probably know there already are much competition from tons of other programming-related wikis. Not that this is a bad idea, but there should be some foundation done before making this big much publicity...

That being said, I don't have anything against "solving a task" or two if this site would take off.

Been Done (3, Informative)

WED Fan (911325) | more than 7 years ago | (#17702192)

It's already been done. Planet Source Code [planetsourcecode.com] 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.

Re:Been Done (3, Informative)

Inferger (1007151) | more than 7 years ago | (#17702304)

It's been done before in another program called XTRAN [pennington.com] too.

Re:Been Done (3, Informative)

Zontar The Mindless (9002) | more than 7 years ago | (#17702442)

Planet Source Code is not that hot. There's heaps of trivial examples that just aren't done very well - like a "new" PHP4-style class for connecting to MySQL which hard-codes "localhost" for the server name. I guess the guy hasn't heard of mysqli [php.net] ?

The quality of the writing itself is pretty bad, too. People who are purporting to teach you something ought to be a bit more... well... literate.

Neither am I inclined to be overly impressed when a site throws 175+ JavaScript and CSS errors in Firefox in just the first 2-3 pages. (I didn't bother counting the errors after that point.)

Re:Been Done (1)

jomama717 (779243) | more than 7 years ago | (#17702836)

Now, something that would be truely useful would be a service that would do translations from a wider variety languages.

Agreed. How sweet would it be to have a cross-compiler that could "compile" C code to Java, Java to C, Java to C#, etc. I'm pretty sure that at some level of code complexity it becomes an impossibility but even a cross compiler that could translate single methods/functions at a time would have some use. Sounds like a fun javacc or yacc experiment.

Re:Been Done (1)

Short Circuit (52384) | more than 7 years ago | (#17702894)

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.
Nice. Not sure I like their layout, though.

For me, one of the benefits of using a wiki is that I can include content on things like specific compilers and languages. (Not that there's a whole lot of that up there, now, though.)

Don't see much use (1)

kalpaha (667921) | more than 7 years ago | (#17702354)

Any piece of code for which you can do a literal enough translation that looking at the mapping would help you, is trivial anyway. Any larger piece of Haskell would probably take huge amount of, say C, and the translation wouldn't make it one bit easier to understand.

The only help the service will be is for beginning programmers who need to learn the syntax, but really, how long does learning a language's syntax take anyway?

Re:Don't see much use (1)

Short Circuit (52384) | more than 7 years ago | (#17702968)

If you look at the programming examples pages, you can see that each mention of a programming language links to a page about that language, each mention of a compiler links to a page about that interpreter, libraries to a page about libraries, platforms to their own pages, etc.

What I'm really hoping for is that a programming encyclopedia will grow around the programming examples. Take a glance at the page I wrote for GCC [rosettacode.org] . I'd love to see pages like that sprout up around all the different languages, compilers and libraries.

Re:Don't see much use (0)

Anonymous Coward | more than 7 years ago | (#17702988)

Any piece of code for which you can do a literal enough translation that looking at the mapping would help you, is trivial anyway.

So, you can quickly whip together functions to do Fourier transforms in half a dozen different languages?

Couldn't find it... (1)

hugg (22953) | more than 7 years ago | (#17702410)

I was looking for some code to help me load-balance a busy server that was just posted on Slashdot ... all I found was code for this old Applesoft BASIC wiki server.

New? (2, Interesting)

d34d.10n (924456) | more than 7 years ago | (#17702414)

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 [koders.com] would be really cool.

Re:New? (1)

Short Circuit (52384) | more than 7 years ago | (#17702678)

Add it to the Request Page [rosettacode.org] .

Simple Tasks - Not Progamming Wars (1)

hackershandbook (963811) | more than 7 years ago | (#17702434)

Strikes me that the "Rosetta Stone" should concentrate on algorithms and not religious solutions ... "99 Bottles" is good because it allows so many variants on a simple task .. a little like a "meta-hello-world" ...

How may ways do *you* know to solve the "Hello World" problem?

Re:Simple Tasks - Not Progamming Wars (1)

maxwell demon (590494) | more than 7 years ago | (#17702962)

Depends on how you count. That is, which solutions you consider as equivalent.
In the most extreme case (source file identity), there are in principle infinitely many solutions (just take your favourite solution and add arbitrary comments).

Of course the simplest implementation is in m4:

Hello, world!

Re:Simple Tasks - Not Progamming Wars (2, Funny)

seebs (15766) | more than 7 years ago | (#17703258)

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.

I can see this as useful... (0)

Anonymous Coward | more than 7 years ago | (#17702498)

if it weren't getting /.'ed... 5 minutes to load a page = nothx.

Not a Bad Idea (1)

WiseMuse (1039922) | more than 7 years ago | (#17702630)

How is this practical? Please enlighten me!

Re:Not a Bad Idea (1)

Short Circuit (52384) | more than 7 years ago | (#17703172)

Knowing how things are done in one language and seeing how they're done in other languages, gives you a perspective on those other languages. You can see how some other languages are similar to ones you already know, or you can see how totally messed up some languages are.

Aside from that, I hope to have a programming encyclopedia grow around all of the incidental links. (Each programming example links to a local wiki page about each of the software tools used, be they compiler, interpreter, library or platform.)

I've Been Working on This (0)

RAMMS+EIN (578166) | more than 7 years ago | (#17702642)

I've been working on something like this for a while. Basically, the idea was to represent common tasks in various programming languages. The tasks are things like performing some operation on every element of a sequence, doing file I/O, defining recursive functions, etc.

Some of what I made is up on http://inglorion.net/documents/plcomparison/ [inglorion.net] . Eventually, I got tired of writing the C and Java programs. On my home machine, I have some more examples; like an implementation of the filter (AKA delete-if-not) function, a math formula internal-representation-to-text translator, and a TCP echo server, but I still have to write some of the programs, as well as the documentation for these.

Anyway, just thought I should share. :-)

Re:I've Been Working on This (1)

Short Circuit (52384) | more than 7 years ago | (#17703600)

I'll add a link to your site, if you like. Really, though, I'd like to see your code and tasks included on RC.

maintainability (1)

Crusty Cracker (824806) | more than 7 years ago | (#17702790)

This may be all fine and well for writing a program, but what about maintaining the code... for anyone else trying to do anything with the code, it would be a huge headache... especially once the original programmer left. Completely unmanageable for projects of any decent size.

Right tool for the job (1)

mrjb (547783) | more than 7 years ago | (#17702828)

Nice idea, some concepts (string functions, (associative) arrays, file I/O) may be portable across some languages and in these cases rosettacode will be useful.

But I think the actual problem is not given due value. Sometimes performing the same task in the same language requires different code on different platforms. Examples: Reading a file bigger than 4 Gigabyte in gnu-flavored C++ on mac, linux, windows; figuring out the total number of sectors on disk, etc.

Also, we should accept that not all languages can do everything. Try creating an array of functions in VBA. Or (also in VBA) even simply breaking out of a loop, for that matter. Try exceptions in ANSI pascal or ANSI C. Try using pointers in Java. Try writing a GUI windowed interface in ANSI Pascal (no, Turbo Pascal doesn't count). Try recursion in GWBasic (this is actually possible).

I see this ending up as an effort to shoehorn concepts unique to one language to another language (building web sites in COBOL *shiver*). Rather than using the wrong tool, it will pay off to actually learn the other language.

Re:Right tool for the job (4, Interesting)

Frumious Wombat (845680) | more than 7 years ago | (#17703004)

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),

Re:Right tool for the job (2, Interesting)

Short Circuit (52384) | more than 7 years ago | (#17703238)

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.

Re:Right tool for the job (1)

Tablizer (95088) | more than 7 years ago | (#17703548)

building web sites in COBOL *shiver*

Just use Cobol-Script [cobolscript.com] :-)
     

In a more focused form (3, Informative)

aero6dof (415422) | more than 7 years ago | (#17702858)

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/ [sourceforge.net]

This is the reason why software sucks (1, Insightful)

Anonymous Coward | more than 7 years ago | (#17703218)

We are always reinventing the wheel, recreating frameworks and libraries from codesnippets. software has failed, if it succeeded then we could just "connect" together from a library of existing "components" / "objects" but no, we have too much fucking ego so we have to always "create" something, must create must create, how about no? Just "BUILD"!

Are you really afraid to accept that software is a BLUE COLLAR job today? I think that is why we MUST (re)CREATE something every fucking time.

It is like an arms race, proliferation of code.

Implement it once and reuse it many times. Yes I know it is the holy grail but this is not a TECHNICAL problem, it is more of a POLITICAL problem. This is why software will continue to suck. /Rant

How about the shootout? (1)

YGingras (605709) | more than 7 years ago | (#17703262)

I didn't look at the site (/. effect) but the Shootout [debian.org] sounds like a good place to get a list of tasks implemented in several languages. You even get arbitrary, but still usefull, metrics like the line-of-code count, run time and memory usage. If someone has time to waste coding trivial tasks in his favorite language, he should contribute to the shootout. I did and I must admit I got a kick when a few well placed suggestions cranked the performance of my entry [debian.org] . Today Common Lisp is faster than Pascal and OCaml, tomorrow we beat Fortran and C++!

It was already done before (0)

Anonymous Coward | more than 7 years ago | (#17703290)

It was already done before:
    http://99-bottles-of-beer.net/ [99-bottles-of-beer.net]
xD

Software Rendering in Four Languages (1)

KalvinB (205500) | more than 7 years ago | (#17703396)

http://code.icarusindie.com/ [icarusindie.com]

The tutorials there show how to do software rendering in Javascript, PHP, C++ and Java. In Javascript, C++ and Java it gets into advanced raycasting. All three languages have a wolf3d clone.

Internal Server Error? A true Rosetta error (0)

Anonymous Coward | more than 7 years ago | (#17703486)

I like this site! The following page comes up when I try to access the site and is both vague and general, yet detailed in a universal kind-of way. A true "Rosetta Error" if you will

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@rosettacode.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

TDz.

I was working on something exactly like this... (1)

CleverBoy (801540) | more than 7 years ago | (#17703598)

I called it ScriptNexus: http://www.scriptnexus.com [scriptnexus.com]
I wanted it to literally do things in "real-time" too.
My mind wandered though, so I mostly use it to do .htaccess files [scriptnexus.com] and write quick proposals [scriptnexus.com] from time to time. It's still a feasible idea though. Someday...
HELLO WORLD examples (you can use the drop-down menu to change languages):
http://www.scriptnexus.com/code/all/hello/text [scriptnexus.com]

Syntax Across Languages (1)

aldheorte (162967) | more than 7 years ago | (#17703784)

Once you get beyond syntax you start delving deep into the particular style of a language, which frustrates attempts to compare. A very good 'Rosetta stone' for programming languages already exists:

http://merd.sourceforge.net/pixel/language-study/s yntax-across-languages/ [sourceforge.net]

But... (2, Insightful)

Brandybuck (704397) | more than 7 years ago | (#17703800)

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!
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?