10 Programming Languages You Should Learn

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5

66 Replies - 8487 Views - Last Post: 26 March 2014 - 02:25 AM

#31 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 11:34 AM

View Postmodi123_1, on 17 March 2014 - 09:15 PM, said:

I am pretty sure if you are doing a quicksort in any language the natural language rendition of what you are doing would be about the same.


I really disagree with that. It is true that it eventually does the same thing, but if you try to describe what every part of the code does to a student, it can be confusing. Anyways, I agree with Jon that we can all just agree to disagree. It's obvious that we're all biased. So let's just leave it at that.
Was This Post Helpful? 0
  • +
  • -

#32 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5826
  • View blog
  • Posts: 12,681
  • Joined: 16-October 07

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 11:35 AM

View Postmostyfriedman, on 17 March 2014 - 11:02 AM, said:

I find functional languages to be much more natural.

You would find like minded folks in the early MIT Computer Science professors. They taught Scheme and felt that any student who understood basic math would find the approach natural. However, those who think in Lispy terms seem to be in the minority. Which may be why MIT officially switched from Scheme to Python recently. http://cemerick.com/...ate-cs-program/

Functional languages are interesting. I enjoy playing with them. I do not consider them particularly natural. Some, indeed, seem rather unnatural.

You inspired me. The same quicksort in F#:
let rec qsort = function
  | [] -> []
  | x::xs ->
    let lesser, greater = List.partition ((>=) x) xs
    qsort lesser @ [ x ] @ qsort greater


Was This Post Helpful? 1
  • +
  • -

#33 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 11:51 AM

Indeed, I am in the minority. Few people had a problem with switching from a functional language to an imperative language in their curricula. Dijkstra was one of those people, and he was quite upset when they had to switch from Haskell to Java, I think. I also think that a lot of people see functional programs as unnatural because they most probably started with an imperative language and stuck with it long enough that it became "natural" to them. At least that was the case with me. After spending some time with FP though, I started seeing how much more elegant it was.
Was This Post Helpful? 0
  • +
  • -

#34 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10563
  • View blog
  • Posts: 39,087
  • Joined: 27-December 08

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 11:58 AM

In the early days of computer science, many people were coming from either a math or EE background. There were some linguistics folk as well. So in that sense, FP may have been more intuitive. Nowadays, CS programs are focused on applications rather than just theory, so it makes sense to switch to more practical (more commonly used) languages. I'm not diminishing FP in any way, but I think it's worth noting the practical value as well.
Was This Post Helpful? 0
  • +
  • -

#35 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 12:10 PM

I totally agree, but in my experience FP can teach one a lot of great things that will make you a better programmer, even if you don't actually use FP in your job. If you want to know what I am talking about, read Structure and Interpretation of Computer Programs. It uses Scheme, and it's available to read online for free. The video lectures are also available on the book's website.
Was This Post Helpful? 0
  • +
  • -

#36 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7744
  • View blog
  • Posts: 13,083
  • Joined: 19-March 11

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 12:16 PM

View Postmostyfriedman, on 17 March 2014 - 01:51 PM, said:

Dijkstra was one of those people, and he was quite upset when they had to switch from Haskell to Java, I think.


You mean Edsgar Dijkstra? I didn't know he ever advocated FP.

Quote

After spending some time with FP though, I started seeing how much more elegant it was.


I've noticed that the term "elegant", in both math and programming, generally indicates something which has been rigorously golfed down to its minimal-length expression, with no concern for readability. When I see the term "elegant" I usually expect to read something which makes perfect sense to someone who already understands it perfectly, but which communicates nothing to a reader coming to it fresh. That is, it's usually a piece of writing that shouldn't have happened, since it's perfectly useless.

View Postmostyfriedman, on 17 March 2014 - 02:10 PM, said:

I totally agree, but in my experience FP can teach one a lot of great things that will make you a better programmer, even if you don't actually use FP in your job. If you want to know what I am talking about, read Structure and Interpretation of Computer Programs. It uses Scheme, and it's available to read online for free. The video lectures are also available on the book's website.



Yes, I agree that learning to use a functional programming language can help someone become a much better programmer, and I've said so many times. I just don't think it's a good place to start programming.
Was This Post Helpful? 0
  • +
  • -

#37 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5826
  • View blog
  • Posts: 12,681
  • Joined: 16-October 07

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 12:29 PM

Well, what is natural for computers is registers, register manipulation operations, memory pointers, and a whole lot of gotos.

Computers are wonderfully, frustratingly, linear. Imperative languages are how a computer thinks. You can take a simple C program and go one to one to assembly and then machine instructions. For computer science, you must understand this.

Functional programming is a level of abstraction intended to allow the human to think of the problem in a different way. Unfortunately, the computer will still keep on chewing one instruction at a time, regardless of the language those instructions started in.

And, when you have to debug, guess which paradigm is the most transparent.
Was This Post Helpful? 2
  • +
  • -

#38 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 12:54 PM

Quote

You mean Edsgar Dijkstra? I didn't know he ever advocated FP.

Yes, see here.

Quote

I've noticed that the term "elegant", in both math and programming, generally indicates something which has been rigorously golfed down to its minimal-length expression, with no concern for readability. When I see the term "elegant" I usually expect to read something which makes perfect sense to someone who already understands it perfectly, but which communicates nothing to a reader coming to it fresh. That is, it's usually a piece of writing that shouldn't have happened, since it's perfectly useless.


That's totally fine, it depends on how you define elegance.


Quote

Computers are wonderfully, frustratingly, linear. Imperative languages are how a computer thinks. You can take a simple C program and go one to one to assembly and then machine instructions. For computer science, you must understand this.

Functional programming is a level of abstraction intended to allow the human to think of the problem in a different way. Unfortunately, the computer will still keep on chewing one instruction at a time, regardless of the language those instructions started in.

And, when you have to debug, guess which paradigm is the most transparent.


That is very true, but because of that we need to build abstractions that make our lives easier. I believe FP is one such abstraction. I have written and debugged both functional and imperative programs, and definitely debugging a higher level program is much easier.

This post has been edited by mostyfriedman: 17 March 2014 - 01:00 PM

Was This Post Helpful? 0
  • +
  • -

#39 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 01:28 PM

*
POPULAR

I loathe these articles, threads, and everything relating to this concept that you should learn certain languages and a certain number of languages because REASONS.

I'm an advocate for functional programming. Why? Because it's another tool in the toolbox, and it's one that a lot of people walk right past as if it weren't there and any person who has actively put effort forth to write code in a functional style, or has used a language like Haskell for any remotely substantial portion of work, will tell you this. It's not about "functional programming is better because of x". It's just another tool. Lots of problems are elegantly represented in functional style, some more elegantly represented in other ways.

Finally, I think that if we spent 70% of the time we spend bitching about which languages we should learn instead actually learning and hacking with some unfamiliar languages, we'd all benefit from it substantially, as would the quality of these discussions. I swear, if I see another debate on whether or not FP is "academia" I'm going to just explode to pieces. I've spent the vast majority of my career writing code in Clojure for a living. Recently got a new job and write Python for a living. Tools. They're tools. I use them to get work done the best way I can.

Furthermore, guess what happened when I and a coworker suggested we use Clojure for some potential future projects? Screaming and employees running with fear? Nope, interest and excitement. At the very least, startups are embracing new technologies. I attended a meetup at Whisper recently. They use Erlang and Elixir, and you can be sure that they can justify why.

They're just tools and if you *can* learn a new tool, you should probably do it.

As an aside, I'm unclear what baavgai means by asserting that imperative languages are easier to debug. I'd assert the opposite, that languages (and even just code written in such a style) that focus on immutable values and referential transparency are in fact more or less *designed* to be easier to debug. For pure functions you can more or less just write a unit test covering your inputs and it will be pretty guaranteed to work. Throw in some state and who knows what's going to go down.
Was This Post Helpful? 5
  • +
  • -

#40 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 04:54 PM

First off, everything Raynes times 9000. Couldn't agree more.

Quote

For pure functions you can more or less just write a unit test covering your inputs and it will be pretty guaranteed to work.

Many of my professors research program specification, and static analysis; this rubs off in much of their teaching and makes it way into the classes. I've become somewhat adept at thinking about the logical predicates that define a function completely due to this. Sense I don't want to use a giant proof based program verification tools to check that my function meets these predicates(and often can't sense the language I chose for the job is not covered by their tools) I use unit tests which check these very well defined predicates by randomly generating unit tests. The best framework for this I've thus far found is for sure QuickCheck in haskell. While not as rigorous as finding a proof that the predicate was met it cuts down my "gotcha's" by quite a bit.

As for debugging in a functional language the answer is REPL. Visual Studio has a REPL called it's "immediate window" which I like to use when it is possible. Debugging changes from a "run this code up to this point and let me inspect the values" to "lets just test this little function here".

This post has been edited by ishkabible: 17 March 2014 - 08:12 PM

Was This Post Helpful? 0
  • +
  • -

#41 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2262
  • View blog
  • Posts: 9,464
  • Joined: 29-May 08

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 05:03 PM

With Pure Functions you cant do anything. IOMonad any one?

Input and Output involves mutable state.
Was This Post Helpful? 0
  • +
  • -

#42 xclite  Icon User is offline

  • LIKE A BOSS
  • member icon


Reputation: 905
  • View blog
  • Posts: 3,167
  • Joined: 12-May 09

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 05:13 PM

Not really a compelling argument against functional programming, though.
Was This Post Helpful? 0
  • +
  • -

#43 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2262
  • View blog
  • Posts: 9,464
  • Joined: 29-May 08

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 05:31 PM

I never said it was / wasn't.

Question, Any OS written total written in purely functional language?
Was This Post Helpful? 0
  • +
  • -

#44 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 07:20 PM

View PostAdamSpeight2008, on 18 March 2014 - 12:03 AM, said:

With Pure Functions you cant do anything. IOMonad any one?

Input and Output involves mutable state.


Two things here.

First of all, why is this relevant to this discussion? Is it entirely necessary? It's the kind of pointless nonsense I was talking about in my previous post.

Secondly, I mean absolutely no offense by this, but you do not know what you're talking about in this case. Monads are one method with which to isolate IO. You can do input and output just fine in Haskell, which is a purely functional programming language. It's wrapped in the IO monad as a way to isolate and manage side effects. Read the answer here: https://stackoverflo...e-io-monad-pure

I can happily provide more resources if this is unclear, but how Haskell does IO and still remains purely functional is a commonly asked question and thus is easily googleable.

Your next question is likely "HAH! BUT IF I CAN DO IO THEN WHAT DOES IT MATTER?". Well, monads isolate side effects so that side effectful code is clearly separated from pure code. You assert that with pure functions "you can't do anything", but that's clearly false and can be proven so by browsing the code inside the Haskell package list, which has libraries and programs for most things you could imagine. The only reason that most of the code we write in imperative languages is tangled up in side effects is because we don't have Haskell's type system forcing us to write our code as purely functional pieces inside of a thin IO layer. It's more about how you structure your code than anything. You can do the same thing in most languages that give you a few foundational tools -- it's just that Haskell is designed around it and forces it on you.

View PostAdamSpeight2008, on 18 March 2014 - 12:31 AM, said:

I never said it was / wasn't.

Question, Any OS written total written in purely functional language?


http://programatica.cs.pdx.edu/House/
Was This Post Helpful? 1
  • +
  • -

#45 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3573
  • View blog
  • Posts: 11,112
  • Joined: 05-May 12

Re: 10 Programming Languages You Should Learn

Posted 17 March 2014 - 08:03 PM

I wasn't all that interested in this thread in the beginning because I saw it as another "Top 10 Language" and another source of religious wars.

The last few posts have inspired me to take time to learn some F# and see if it is possible to write a disk defragmenter using functional programming. To me, disk defragmenting is the ultimate in procedural operations because I only have limited space to shuffle things around. Right now functional programming feels like magic where I can start off with a fragmented disk and end with a perfectly optimized disk in what feels what would amount to the same number of lines of code for quick sorting. Wow!
Was This Post Helpful? 2
  • +
  • -

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5