The benefits of learning languages that you won

2020-05-19 06:14发布

I have read numerous time that learning a language such as Haskell, Lisp or Smalltalk will somehow make you a better programmer while you program in other languages.

Is there more than just anecdotal evidence for that claim? Or is it just the way people rationalize having spend a lot of time learning a programming language that they will never use?

19条回答
贼婆χ
2楼-- · 2020-05-19 07:03

Some examples that come to mind:

Knowing C and having to deal with memory management and do-it-yourself data structures can help you understand performance issues when programming in a higher level language where those details are hidden from you.

Conversely, learning an OO language can affect your C programming - with, for example, the concept of Polymorphism prompting you to use function pointers in ways you might not have otherwise.

Learning a language where functions are first class objects that can be passed around can make you think of similar techniques in other languages, even if, in those other languages, you have to make the functions methods in objects that get passed around.

Learning about the way Erlang handles concurrency can make you rethink how much shared state you use between threads in other languages.

Any language that has a built-in feature you find useful can prompt you to implement your own version of that feature in another language that doesn't have it, and thus allow you to solve problems in ways you might not have thought of if you hadn't been exposed to the feature in the language that has it built-in.

Learning about Interfaces in Java can make you think about the benefits of precisely specifying your (small "i") interfaces in other languages that don't have them as a formal construct in a type system.

No doubt there are others.

查看更多
Viruses.
3楼-- · 2020-05-19 07:06

Some good points have been made.

I would add that learning languages you won't use in production work can be of value

  1. To better appreciate and absorb the arguments and methods in texts and papers that will improve programming ability in languages I do use for production work (e.g. MIX/MMIX for Knuth's Art of Computer Programming; RATFOR for Kernighan and Plauger's Software Tools; I still use some ALGOL-based syntax for some pseudocode although I never wrote runnable code in ALGOL outside University)

  2. To be able to check or prototype programs that will be written in a different language (e.g. some routines for numerical computing in C can be quickly checked or scaled using languages that have appropriate functionality built in such as Fortran, Python or Haskell)

  3. Learning a new language can give insight as to how it could be used to more easily solve problems that were put to one side because of time or complexity constraints.

查看更多
\"骚年 ilove
4楼-- · 2020-05-19 07:07

Learning a language, especially one that practices a new paradigm, is very beneficial for every programmer. For example learning Scheme will help someone understand functional programming. The programmer can later practice what he/she learned with other languages like C#. She can think of new ways of doing things.

Also, as languages evolve, it's high likely that the language you use will adopt some features of other languages. Having taught myself Ruby, I was able to grasp the changes in C# 3.0 much easier.

查看更多
叛逆
5楼-- · 2020-05-19 07:09

If you give any credence to the Pragmatic Programming guys, consider their advice from page 14 of their first book:

Learn at least one new language every year. Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut.

查看更多
来,给爷笑一个
6楼-- · 2020-05-19 07:10

Programming is a way of thinking, not writing code in programming language X: that is "coding", not "programming".

By knowing at least something about more than just one programming language - preferably across different paradigms, so imperative/OOP/functional/logical - you train that way of thinking about problems outside the context of the specific details and quirks of language X.

I think this always improves your abilities to be(come) a better programmer tremendously.

查看更多
别忘想泡老子
7楼-- · 2020-05-19 07:14

I don't have any hard evidence, but I have really appreciated the different way of looking at problems that I have since learning lisp (the same goes for python and c).

The key isn't necessarily learning different languages though, I believe that the key is actually the different viewpoints that you gain by learning different programming styles.

Good examples are functional, imperative, object-oriented, etc. Also, there are common design differences is interpreted vs compiled languages; static vs dynamic typing, etc.

Although most people do a majority of their programming using a single style (most commonly OOP over the past few years), I think that all programmers should know multiple styles so that they are better able to see the shortfalls of their own style.

查看更多
登录 后发表回答