views:

129

answers:

6

The title may seem slightly self-contradictory, and I accept that you can't really learn a language quickly. However, an experienced programmer that already has knowledge of a few languagues and different styles (functional, OO, imperative etc.) often wants to get started quickly. I've seen a few websites doing effective "translations" in the form of "just show me syntax equivalence". I can't remember the sites now, but for related languages (e.g. Perl/PHP) it's quite common.

Is there a better resource that covers more languages? Is there a resource that covers idioms as well as syntax? I think this would be incredibly useful for doing small amounts of work on existing code bases where you are not familiar with the language. Looking at the existing code, as we know, is not always a good indicator of quality. Likewise, for "learn by doing" weekend project I always have the urge to write reasonably idiomatic, clean code from the start. Such a resource could also link to known good example projects of varying sizes for those that prefer to learn by reading. Reading a well-written medium sized code base can also be much more practical when access to development environments might be limited.

I think it's possible to find tutorials and summaries for individual languages that provide some of this functionality in disparate web locations but I'm hoping there is a good, centralised, comparative place that the busy programmer can turn to.

+1  A: 

In the past my favour was "learning by doing". So e.g. I know a little bit of C++ and a lot of C#.Net but I must write a FTP Tool in Python.

So I sit for an hour and so the syntax differences by a tutorial, than I develop the form itself and look at the generated code. Then I search a open source Python FTP Client and get pieces of code (Not copy and paste, write it self to see, feel and remember the code!)

After a few hours I get it. So: The mix is the best. A book, a piece of good code, the willing to learn and a free night with much coffee.

Kovu
A: 

At the risk of sounding cheesy, I would start with the language's website tutorial and/or FAQ, followed by asking more specific questions here. SO is my centralized location for programming knowledge.

I remember when I learned Perl. I was asked to modify some Perl code at work and I'd never seen the language before. I had experience with several other languages, however, so it wasn't hard to figure out the syntax with the online Perl docs in one window and the code in another, side-by-side. I don't know that solely reading existing code is necessarily the best way to learn. In my case, I didn't know Perl but I could tell that the person who originally wrote the code didn't know Perl either. I'm not sure I could've distinguished between good Perl and really confusing Perl. It would've been nice to be able to ask questions here at the time.

Kristo
I agree - some "recommended" code bases of well-written code at manageable project size would also be a very valuable learning resource. This feeds in to what I'm trying to get at about idiom. I keep trying to point people to the fact that I find most tutorials too slow. I know what a loop is etc. so just a translation like a cheat sheet will do for these for a non-novice programmer. But learning when it's appropriate to use different techniques (for performance/style/maintainability) can be worth a paragraph or two, depending on how much it differs from other similar languages.
Sam Brightman
+2  A: 

You generally have two main things to overcome:

  • Syntax
  • Reference

Syntax you can pick up fairly quickly with a language tutorial and a stack of samplecode. Reference (library/API calls) you need to find a proper guide to; perhaps the language reference, or perhaps google...

With those two in place, following a walkthrough (to get you used to using the development environment) will have you pretty much ready - you'll be able to look up what you want to say (reference), and know how to say it (syntax).

This, of course, applies principally to procedural/oop languages; languages that require a paradigm switch (ML/Haskell) you should go to lectures for ;)

(and for the weirder moments, there's SO!)

Dave Gamble
I guess what we're saying is "no, no such resources exist". This answer gets more in the right direction. However, once one has seen the "syntax mapping" between languages (this is common for e.g. perl/python/php), it is common to naively map idioms too. I'm imagining a sort of language wiki that brings competent programmers up to speed quickly on the syntax and idioms, provided the already are familiar with broader concepts like OOP/functional programming. You make a good point that reference is rather larger area, but a quick guide to the basics and link to API specs would be starting point.
Sam Brightman
A: 

Language isn't important. What is important is learning your ways around designing algorithms and the proper application of design patterns. Focus on the technique, not the language that implements a certain technique. Once you understand the proper development techniques, any programming language will just become real easy, no matter how obscure they are...

When you put a focus on a language, you're restricting your own knowledge.

Workshop Alex
Yes, that's rather the point. My aim is to find "this is how you do x in language y" when one already understands the concepts and tradeoffs of technique x.
Sam Brightman
Basically, when you want to move to a newer language, all you need is knowledge of the new syntax and a list of standard (library) functions that this new language supports. Then, with your algorithmic knowledge, you can easily rewrite your code in the new language. (Especially when your project is well-documented in a technical design with plenty of UML-like diagrams.) I started with Basic about 30 years ago, learned Pascal, C, COBOL, Assembly, PHP, XSLT and plenty of other languages and they all have similar design patterns in common. So learn to use design patterns instead. :-)
Workshop Alex
I disagree. There is syntax, which is partly what I'd like to see summarized per-language. There's reference, which you really have to just look up. But there's also idiom. Python/Ruby have traditional for loops, but you don't really use them most of the time. If you are skimming several languages, or want to get started quickly on small projects in each, then you need that summarised too. The traditional method is to read a tutorial but they are rather.... slow. Most tutorials read like they are targetted at non-programmers.
Sam Brightman
Feel free to disagree but syntax alwals resolves around the same principles. Loops, conditional commands, assignments, math, comparisons, etc. Every language has these, although some do this in more unique ways than others. Differences are more at a detail level, which is something you just have to learn, but in general you can learn those quickly. If you want to be able to learn new languages real fast, make sure you understand the basic principles.
Workshop Alex
A: 

http://devcheatsheet.com/ seems to be a step in the right direction: it aggregates cheat sheets/quick references and they are (somewhat) manually reviewed. It's also wide-ranging. It still comes up short a bit in terms of "idiomatic" quick reference: for example, the page on Ruby doesn't mention yield.

Sam Brightman
A: 

Rosetta Code appears to be an excellent resource that includes hints on coding idiomatically and moves from simple (like for-loops) to things like drawing. I haven't checked out how comprehensive it is, but there are a large number of languages and tasks listed. The drawbacks re: original question are:

  • Some of the linking is not accurate (navigating Python->ForLoop will take you to the top of the ForLoop page, not the Python section). It's a wiki, this can be improved.

  • Ideally you could "slice" the wiki however you chose to see e.g. the top 20 tasks for two languages side-by-side.

Sam Brightman