Slashdot Mirror


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.

23 of 215 comments (clear)

  1. No Fair! by Watson+Ladd · · Score: 4, Insightful

    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
    1. Re:No Fair! by Short+Circuit · · Score: 5, Informative

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

    2. Re:No Fair! by frakir · · Score: 5, Funny

      I program in Malbolge, you insensitive clod!
      http://en.wikipedia.org/wiki/Malbolge_programming_ language

      I hope next windows ver will be coded in Malbolge and open source.

  2. Re:Here's better by Rosco+P.+Coltrane · · Score: 3, Interesting

    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
  3. It may prove useful. by Z00L00K · · Score: 3, Interesting
    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.

    --
    If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    1. Re:It may prove useful. by arevos · · Score: 4, Insightful

      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 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.
    2. Re:It may prove useful. by arevos · · Score: 4, Insightful

      Just out of curiosity, why not? And what would you suggest instead? A Wiki is essentially just an editable website. It must be manually ordered; tables of contents put in, pages linked to other pages, and so forth. This is find for data that has a very general structure, such as an encyclopaedia or a manual of some kind. But the Rosetta Stone concept is highly structured, cross-referencing programming languages with programming problems, and it seems to me as if this cross-referencing would be better done automatically, rather than making several Wiki pages and maintaining them manually. The site concept would be better suited to some sort of customised CMS, or perhaps something designed from scratch.
  4. Usage by mgiuca · · Score: 5, Insightful

    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.

    1. Re:Usage by Short+Circuit · · Score: 3, Informative

      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.

      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.)
    2. Re:Usage by cp.tar · · Score: 3, Insightful
      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.

      --
      Ignore this signature. By order.
  5. if you like this... by taybin · · Score: 3, Informative
    1. Re:if you like this... by Coryoth · · Score: 3, Informative

      Also worth looking into is LiteratePrograms 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.

  6. One task that isn't on there by antifoidulus · · Score: 4, Funny

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

    1. Re:One task that isn't on there by Anonymous Coward · · Score: 3, Funny

      use Hooker::Transactional;

      Hooker::Transactional->get_last->rollback;

      Dude, CPAN has EVERYTHING! :)

  7. Should I be impressed? by Fulkkari · · Score: 4, Insightful

    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!
    1. Re:Should I be impressed? by LiquidCoooled · · Score: 3, Insightful

      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.

      --
      liqbase :: faster than paper
  8. Been Done by WED+Fan · · Score: 3, Informative

    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.
    1. Re:Been Done by Zontar+The+Mindless · · Score: 3, Informative

      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?

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

      --
      Il n'y a pas de Planet B.
  9. Will they support these programming styles ?!? by ctrl-alt-canc · · Score: 3, Funny
  10. Pointless, don't bother! by Anonymous Coward · · Score: 3, Informative

    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.

    1. Re:Pointless, don't bother! by JoshJ · · Score: 5, Insightful

      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.

  11. In a more focused form by aero6dof · · Score: 3, Informative

    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/

  12. Re:Right tool for the job by Frumious+Wombat · · Score: 4, Interesting

    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