Skip to content

Instantly share code, notes, and snippets.

@amirrajan
Last active December 24, 2015 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirrajan/6816606 to your computer and use it in GitHub Desktop.
Save amirrajan/6816606 to your computer and use it in GitHub Desktop.
Language observations, subject to change.

#So you want to learn another language?

Hurray! Someone sent you here or you found this some how! Here are my tips for learning a new language.

##Disclaimer

This text is a work in progress, please comment and contribute as you see fit. These are my opinons on language progression based on personal experience, not hard fast rules. If you have any tips to help others please share in the comments or fork this gist and add your own opinions.

##Here is a list of languages

  • C#: primarily OO, primarily static. Multi-paradigm: functional (but not as good as F#) and dynamic (but not as good as Ruby)
  • Ruby: primarily OO, dynamic. Multi-paradigm: functional (more so than C#, but not as good as F#)
  • F#: primarily functional, primarily static. Multi-paradigm: OO (dare I say as good as C#)
  • Scala: Scala is to Java as F# is to C# (mostly)
  • Clojure: strictly functional, dynamic, recently got opt-in static
  • Haskell: strictly functional, strictly static
  • Javascript: object oriented with first class functions, dynamic/prototypical. Multi-paradigm: makes me sad if you apply C# style OO to JS (see comments for clarification https://gist.github.com/amirrajan/6816606#comment-922012)
  • Erlang: non-strict functional (with optional types) in the small, but Kay-ish OO in the large. Joe Armstrong, the inventor of Erlang calls it a "Concurrency Oriented" language. Also, Elixir is a new dialect (quite promising IMHO) (see comments for clarifications https://gist.github.com/amirrajan/6816606#comment-922018)

##Hey! Language X isn't listed! And it's Awesome!

Write it in the comments/fork this gist, send a tweet to @amirrajan and I'll add to the list.

##I disagree with these approaches (and/or) langauge explanations!

Leave a comment and help others, fork this gist and give your perspective. The more the merrier!

##Be Nice with your comments

##So where to start???

Here are some recommendations on where to start. Again, this is my personal opinion, please feel free to leave a comment on this gist for others to benefit from. Also, take your time with this, you won't get proficient over night (I'm still learning too).

###Baseline

It may help to baseline in your preferred language.

Implement the following coding problems in the language of your choice:

Prime Factors: http://amirrajan.net/meta/2013/10/06/TDD-the-wombo-combo-of-software-dev/#getstarted

Mancala: https://gist.github.com/amirrajan/2153731

Conway's Game of Life: http://en.wikipedia.org/wiki/Conway's_Game_of_Life

##I'm a C# dev, where do I start?

  • Do the Baseline Section

  • Think dynamically in C#:

Watch this video: http://vimeo.com/43659055

Read this wiki/blog entry: https://github.com/amirrajan/Oak/wiki/gemini-deep-dive

  • Do the Baselines in the following order and languages: Ruby, JavaScript (using NodeJS), F#, Clojure

  • Baseline again in C# (how does it feel?), try other languages in the list!

##I'm a Ruby dev, where do I start?

  • Do the Baseline Section in Ruby

  • Do the Baselines in the following order and languages: JavaScript (using NodeJS), Clojure, ObjectiveC or C# (Mono), Scala

  • Baseline again in Ruby (how does it feel?), try other languages in the list!

##I'm a JavaScript dev, where do I start?

  • Do the Baseline Section in Javascript

  • Do the Baselines in the following order and languages: Ruby, Clojure, ObjectiveC or C# (Mono), Scala

  • Baseline again in JavaScript (how does it feel?), try other languages in the list!

##I'm a Java dev, where do I start?

  • Do the Baseline Section in Java

  • Do the Baselines in the following order and languages: ObjectiveC or C# (Mono), Scala, JavaScript (using NodeJS), Ruby, Clojure

  • Baseline again in Java (how does it feel?), try other languages in the list!

##With regards to language learning order

I tried to order the languages in such a way so that it eases you into newer languages. As Björn Rochel (@BjRo) has stated in the comments, you may feel comfortable in deviating from the orders perscribed above.

##My primary language isn't here!

I can only speak to language I've worked with. If you can provide any tips, please comment and let me know via twitter: @amirrajan and I'll update as best I can.

@napcs
Copy link

napcs commented Oct 4, 2013

One main comment I have here is that JavaScript is absolutely an object oriented language. It is also dynamically typed, with weak typing. (there's no compile time type checking, and we can cast number to strings easily.)

But it's not the kind of OO that people are used to - that is, it's not "class-based" like Java or C#. In JavaScript, you take an object and conjure a new object from that object, and then you modify that new object's prototype.

This is actually a bit how Ruby works too, except that Ruby does have a friendly "class-based" approach you use to declare objects. But in Ruby, since everything is an object, it's perfectly legal to grab an instance of Object and add methods to it at runtime. Or inject modules of code onto existing instances. In fact, in Ruby, even classes themselves are objects.

Somewhere, "object oriented" programming became "make a class, create an object from said class", but Smalltalk, Ruby, and JavaScript don't necessarily fit that. OOP should mean "objects talking through message passing."

@amirrajan
Copy link
Author

I can definitely get behind that explanation @napcs. My javascript code (recently) usually takes one of the following forms. 1. An object that provides a "suite" of related data structures and functions that act on those structures (essentially the module). 2. mutable objects with no methods.

Somewhere, "object oriented" programming became "make a class, create an object from said class"

Exactly, hence my inital aversion to calling javascript OO, this blog post does a good job in explaining my hesitations: http://leongersing.tumblr.com/post/11561298378/my-perception-of-coffeescript

@gvaughn
Copy link

gvaughn commented Oct 4, 2013

I largely agree with Brian (napcs) above. Javascript is a prototypal OO language with first class functions. I completely agree that the term OO has mostly been morphed to mean Class-Oriented in common usage. However, when I first encountered Ruby I wanted to make it more prototypal and it loses the concept of the current receiver ('this' in Javascript) and can't quite achieve prototype-ness.

I'd argue that the "purest" OO concepts as originally envisioned by Alan Kay when he coined the term "object oriented" is alive today in actor frameworks, most notably in Erlang. So, if I may add to Amir's list above of language categories:

  • Erlang: non-strict functional (with optional types) in the small, but Kay-ish OO in the large. Joe Armstrong, the inventor of Erlang calls it a "Concurrency Oriented" language. Also, Elixir is a new dialect (quite promising IMHO).

@BjRo
Copy link

BjRo commented Oct 6, 2013

The only remark I would have is regarding the 'Where to start?' sections and the ordering of the different languages.

I think there's room for alternative paths, focussing on different aspects or personal preferences. For instance one learning path might lead from Java over Ruby to Erlang, building and extending more on more on the Kay-ish message passing idea.

Another way might lead from Java over Scala to Clojure or Erlang, focussing more on functional concepts (Or C# -> F# -> Haskell).

What I like about those paths, is that it allows you to somewhat build upon your existing knowledge step by step, making it easier to leave the comfort zone one step at a time. It's just less scary for some people, you don't have the feeling of standing in front of a giant mountain with no clue how to conquer it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment