Historically, the Java™ platform has been the domain of object-oriented programming, but now even staunch supporters of the Java language are starting to notice a new trend in application development: Functional programming. In this new series, Ted Neward introduces Scala, a programming language that combines functions and object-oriented technology with the JVM. In this article, Ted will give you an example of why you should take the time to learn about Scala (concurrency, for example) and how to benefit quickly from it.
You will never forget your first love!
For me, her name is Tabinda (Bindi) Khan. It was a happy teenage hour, exactly in the seven grade. She was beautiful and intelligent, and the best of all was that she was always overjoyed at my clumsy jokes. In the seven grade and eight grade time, we often "go out" (that's what we said at that time). But in the nine grade, we parted, and the polite remark was that she was tired of hearing the same clumsy boy jokes for two consecutive years. I'll never forget her (especially since we met again at the 10 anniversary of our high school graduation), but more importantly, I will never lose these precious (and perhaps exaggerated) memories.
Java programming and object-oriented are the "first love" of many programmers, and we treat it as respectful and complete love as Bindi. Some developers will tell you that Java has freed them from memory management and C + + purgatory. Some others will tell you that Java programming has freed them from the desperation of procedural programming. Even for some developers, object-oriented programming in Java code is "the way they do things." (Hey, if it's good for my dad and grandpa!) )
However, time will eventually dilute all the memories of first love, life is still going on. Feelings have changed, the protagonist in the story has matured (and learned some new jokes). But the most important thing is that the world around us has changed. Many Java developers realize that while we love Java programming, we should seize new opportunities in the development arena and learn how to use them.
I will always love you ...
In the last five years, there has been a growing dissatisfaction with the Java language. While some people may think that Ruby on Rails is the main factor, I would argue that RoR (known as a Ruby expert) is just the result, not the reason. Or, to be more precise, Java developers use Ruby for deeper, more insidious reasons.
Simply put, Java programming is slightly senility.
Or, to be more precise, the Java language is slightly senility.
Consider this: When the Java language was first born, Clinton (first) in the office, very few people use the Internet, mainly because dialing is the only way to use the network at home. Blogs have not yet been invented, and everyone believes that inheritance is the basic method of reuse. We also believe that the object is the best way to model the world, and Moore's Law will rule the world forever.
In fact, Moore's law has aroused the special attention of many people in the industry. Since 2002/2003, the development of microprocessor technology has led to the creation of a plurality of "kernel" CPUs: essentially a chip with multiple CPUs. This contradicts Moore's law, which says that CPU speed will double every 18 months. Executing a multithreaded environment on two CPUs, rather than performing a standard cycle on a single CPU, means that the code must have strong thread security to survive.
Many studies have been carried out around this issue in academia, leading to the emergence of a plethora of new languages. The key problem is that many languages are built on their own virtual machines or interpreters, so they represent (like Ruby) conversions to new platforms. Concurrency conflicts are the real problem, and some new languages offer powerful solutions, and too many companies and businesses still remember the migration from C + + to the Java platform 10 years ago. Many companies are unwilling to risk migrating to new platforms. In fact, many companies still have a lingering fear of migrating to the Java platform last time.
Learn about Scala.
A Scalable language
Scala is a mixed language of functional objects, with some powerful advantages:
First, Scala can be compiled into Java bytecode, which means it runs on the JVM. In addition to allowing the continued use of rich Java open source ecosystems, Scala can integrate into existing IT environments without migrating.
Second, Scala is based on the Haskell and ML function principles, drawing heavily on the object-oriented concepts that Java programmers love. As a result, it can combine the advantages of two areas to provide significant benefits and not lose the familiar technology we have relied on.
Finally, Scala is developed by Martin Odersky, who is probably the most famous person in the Java community who studies the Pizza and the language of the spoken word, and is the Java 5 Generic working prototype. Moreover, it gives a sense of "seriousness", a language that is not created on the spur of the moment, nor is it discarded in the same way.
Scala's name shows that it is also a highly scalable language. I will introduce more information about this feature in subsequent articles in this series.