The benefits of Learning Java

Source: Internet
Author: User
Tags mathematical functions

First of all, I think the question is not interesting. Because, learning a language is not a goal, computer language is just the means to realize our ideas. So, there is no suitable language to learn, only we need which language. So, this question is equivalent to, I am Cantonese, suitable for learning Russian or French, the answer is, see you want to go to Russia or France.

So the question I'm answering is, in fact, "The math is better at learning which language is more advantageous" or "which language is more important in mathematics." Here I am not confined to Java and C + +, because it is possible that the master only knows java and C + +temporarily, But you should not mind learning more languages.

Of course, if the problem of mathematics refers to the high school mathematics, or "Elementary algebra" good, it does "learn the procedural language and mathematics does not matter." But it also makes sense that at least it shows interest in mathematics and is likely to continue to be interested in abstract algebra.

Well, my answer is Lisp and Haskell, and of course other functional languages. I keep the functional English, not said to be "functional language", not loaded, because of this word, in mathematics there is another widely known name: "Functional." (However, I would like to speak directly in the functional language.) )

The reason why mathematics studious functional language is more advantageous. Because 1) compared to other languages, functional language and mathematics "more like",2) functional language more dependent on mathematics.

The function language is more like mathematics, the most basic is "function". Note that although they are called functions, they are completely different. A function in mathematics is a mapping from a domain to a range, while a "function" in a computer language includes at least two meanings:procedureand thefunction(Pascalis the separation of the two concepts, uh ... SayPascaldoes that mean it's exposed?OIhistory ... ),functionyou can also roughly equal the mapping from the space of the parameter to the space of the return value, butprocedureIt's all about the program jumping to another location, and it's basically nothing to do with the "function" thing. and learningC, we call it a function, but basically we understand it asprocedure. There are functions that have input and output, and one of the biggest differences in mathematical functions: certainty, or, side effects.

Generally speaking, the function in mathematics is a definite mapping relationship from the domain to the range of the definition. In other words, the determined input always produces a definite output. But this is not guaranteed in a procedural language, such as allowing modifications to variables outside of the function. In pure functional languages, functions are often required to guarantee no side effects (e.g., by forcing variables to be immutable), which guarantees the consistency of functions in the language and in mathematics.

Another example that may not be appropriate: in a pure function language, the variable is usually immutable. So, confused with countless small white, such as "a=a+1" such as the violation of mathematical knowledge of the statement is unlikely to appear.

Because the functions in the language and the functions in mathematics are unified, the concept of recursion is much more understandable. Because recursion is no longer a "piece of code call itself" Such a mouthful of concept, is the mathematical recursive definition or recursive formula just.

Furthermore, the functional language is just "looking" and more like mathematics, in conjunction with the pattern matching that is common in functional languages. For example , the Fibonacci sequence is implemented in Erlang :

FIB (0)->1;fib (1)->1;fib (N)->fib (N-1) +fib (N-2)

It's basically a mathematical definition.

Then, the functional. In mathematics, a function is usually defined as functions that define a field, whereas in a functional language, a function is first-class , that is, like a normal variable, a function can manipulate a function. See, and the unification of mathematics. The use of functional language is entirely from the point of view of mathematics. This operation is not directly implemented in C and Java . Of course,C can use pointers to functions, andJava typically uses an interface. But this is all about thinking from a machine perspective, or from an object-oriented perspective, not from a mathematical perspective.

In addition, learning functional language does require a mathematical basis.

The programming language, the package object-oriented language and so on, all can be understood by Turing, but the function of the program is not, understand the functional programming you need to understand the lambda calculus, and then inevitably need the formal system of reasoning and proof, these also really need mathematical foundation. Haskell Further, even without touching monad, requires at least the knowledge of the set theory or even part of the functional (vector space), and if it involves monad , there is no basic concept of abstract algebra and categorical theory that can be really understood. (yes I have to admit I haven't really understood yet)

In summary, if the math is good, "fit" to learn functional language, and what I have to give is two typical. Other people mentioned Clojure, I think clojure can be regarded as a dialect of Lisp. Other functional languages that are recommended for learning include Erlang and OCaml.

And then to answer the original question, if the future will be the computer, then the two languages can not jump over, but the choice of both, it is recommended to learn Java, because C + + is too complex (sorry I am C + + Black, not arguing). However, it is more recommended that C and Lisp.

c, the recommended tutorial only one: "C programming language", the author K&r, do not go to see any other books.

Learn Lisp, the recommended tutorial does not need to say more: "Computer program construction and interpretation."

And then, while I spend most of my time using python, (java:http://www.ytbdqn.com/show-4-75-1.html) but I strongly disagree with a professional programmer from python Getting Started. Although Python is quick to get started, it is not helpful to understand how a computer works, nor is it conducive to understanding the mathematical nature of the program. Of course,Python is a good language, (Perl?) haha haha, escape ~).

Say so much, not to expressLispand theHaskellthanJavaand theC + +high-end, orJavaand theC + +is aInferior languages. c/java/c++There is no doubt that the application is wider than the functional language, and the greater benefit of functional language learning is that it is not for engineering applications (in most cases,LispWidely used in the field of artificial intelligence). Mathematics and machines are part of the computer, interested in machines, learningC, learning system, interested in mathematics, to learnLisp, learning the theory of calculation, will eventually find that the same. Just choose the same time and remember to remain curious about the other.

The benefits of Learning Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.