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.
But would you mind if I submitted it to Technocrat?
SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
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;-)
If brevity is the soul of wit, then how does one explain Twitter?
You're itchin' for a fight with Cupertino, is that it?
"Win treats sysadmins better than users. Mac treats users better than sysadmins. Linux treats everyone like sysadmins."
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
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:
"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
to having a psuedocode compiler!
As if we didn't have too much of that already.
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.
"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."
http://jody140.dsl.frii.net/SWE/ProgEvol
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)
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?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.
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.
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?
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?
if it weren't getting /.'ed... 5 minutes to load a page = nothx.
How is this practical? Please enlighten me!
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/. 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.
Please correct me if I got my facts wrong.
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.
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.
Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
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/
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.
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"!
/Rant
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.
I didn't look at the site (/. effect) but the Shootout 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. Today Common Lisp is faster than Pascal and OCaml, tomorrow we beat Fortran and C++!
It was already done before:
http://99-bottles-of-beer.net/
xD
http://code.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.
Work Safe Porn
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 called it ScriptNexus: http://www.scriptnexus.com .htaccess files and write quick proposals from time to time. It's still a feasible idea though. Someday...
I wanted it to literally do things in "real-time" too.
My mind wandered though, so I mostly use it to do
HELLO WORLD examples (you can use the drop-down menu to change languages):
http://www.scriptnexus.com/code/all/hello/text
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:
s yntax-across-languages/
http://merd.sourceforge.net/pixel/language-study/
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!
For example:
for loop
Since some languages have the same token for different tasks, you would need cross-references in various positions. E.g. in perl:
for (i=0 ; i<n ; i++) or
for $var (@array), this would translate to foreach in other languages
The way I picture it, is a mainmenu where you select the languages you want to compare. Then you get a list of the statements side by side. Or you can search for a particular token.
Does anyone know if such a site exists?
Sheesh!
Parent is totally full of shit.
First of all he misses the fact that there are *multiple* versions for C and C++ some of them *exactly* the way he would like to see them.
And than he *completely* misses the point of the site. Its point is to show the *difference* between the languages. So the algorithms *are* supposed to be different. Of course you can use a functional language like an imperative one, but that's besides the point.
To evaluate what language is best for a task...or to learn new languages this is a great concept...er, I can't view the site, however...
Forbidden
/.
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
So much for THAT idea...courtesy of
Richard Steven Hack - This sig is TOO GODDAMN SHORT TO DO ANYTHING USEFUL WITH! MORONS!
For computer languages, everyone has their own favourite - we just need a way to get one to talk to the other without any confusion. OO was the solution for this.
This seems to be a solution for a problem that doesn't exist.
"The greatest lesson in life is to know that even fools are right sometimes" - Winston Churchill
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."
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/mike/public_html/includes/Exception.php on line 139
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.
I read somewhere that Microsoft actually has an internal version of SourceSafe that does, in fact, attempt to treat VB.net and C# as two different presentation layers of the same underlying code, and allows you to work on a file using whichever of the two languages you prefer. In other words, two developers can check out the "same" code from the repository -- one, as VB.net, the other, as C#. If #1 commits changes, VSS semi-compiles it to intermediate code and treats the VB.net code as nothing more than a presentation layer. When #2 updates his copy, it decompiles the code on the server to C# and updates HIS copy.
.1%, but the combo was lethal anyway). That, and the fact that VSS is kind of brittle to begin with & likely to be replaced by something else as soon as Microsoft can figure out what to replace it with...
Unfortunately, Microsoft discovered that it's a lot easier to describe on paper than do in real-life, because the devil's in the details. Apparently, the system had to make changes to code at commit time (officially, things like formatting), and those changes botched things up *just* enough to destroy its users' confidence in the system (in reality, it unnerved developers 99% of the time, and really screwed something up about
This idea makes sense, (even if the site sounds like it's empty and poorly designed), but only if you are comparing similar languages. For web scripting, I learned PERL first, and recently made the switch over to PHP for most of my new website stuff. Due to the old stuff still needing periodic work, I'm constantly going back and forth between the languages, and a cheat sheet showing me the syntax diffrences and basic fundamentals is invaluable for me.
Even if this site was fully fleshed out, you would still never get past the initial learning curve of a new language with just a list of ways to do all the particular tasks. It would be useful while learning it, but you still have to learn the new language.
ChuckyG
While I haven't been able to take a look at the Rosetta Stone project, it seems like it might be similar in spirit to the Code Codex.
Another approach can be found on Amit Singhs site, where he has more than 100 implementations of Towers of Hanoi (in all kinds of languages etc): http://www.kernelthread.com/hanoi/
The real attraction of 99 Bottles of Beer ... and the reason it is so unhelpful if you just want to compare languages is that the examples often use exotic uses of the programming language in question. More a "lets use the weirdest way possible of writing this program that we can in the given language". So we see examples like, Java using no loops or ifs just throwing exceptions and printing stack traces to get the effect, or the C++ version doing it *all* in template meta-programming .... or my favourite the perl example (who said perl is hard to read?). Very amusing, but not a real comparison of languages .. as they are actually used.
Bitter and proud of it.
I did a simple look-up of one of these waay back when: http://mike.dewolfe.bc.ca/rosettastone.asp