"Do you know Scala?" "Oh, it's a spell that boosts your defense, right?" "(゚ Д ゚) ha?" So that you don't have to, I've put together a feature for those who don't know Scala.
--A programming language that combines the characteristics of an object-oriented language and a functional language. --The name comes from "scalable language". --It runs on Java and can be linked with existing Java programs. --Is your rival groovy? In performance, Scala seems to win overwhelmingly.
--Everything is an object. There are no primitive types. --An error is detected at compile time due to static typing. -Automatically determine the type with powerful type inference. So the declaration just decides whether it is a variable or a constant.
//Variable declaration
var user = getUser()
var user: User =null Null cannot be inferred, so a type declaration is required
//Constant declaration
val str = "TEST"
--Null can be used, but the policy is to avoid using it as much as possible. (Use Option type. Some or None) --Pure functional programming is possible. (Use val (constant) and immutable collection (List, Set, Map)) --Procedural programming is also possible. (Use vars and variable collections (List, Set, Map)) --Functions can also be treated as objects. --Existing classes can be extended. (You can make it look like you added a method by declaring an automatic type conversion.) --There is a trait. (Implementation and interface with fields) --Closers can be used. --A Build tool is available. (SBT) --Java classes can also be used. (Java library can also be used) * However, note that Java and Scala collections are different and need to be converted. It's quite annoying. --XML (HTML) can be written directly inside the program.
var html =
<HTML>
<Body>
getcontent()
</Body>
</HTML>
convert(html)
--There is a multi-line character string. ――If you do your best, you can also develop Android apps.
――There are so many language conventions, and the language itself is relatively difficult, so the learning cost is high. ――When it comes to web application development, you may choose the Play framework. (There are others.) --There is no break or continue. (Although it is, it is difficult to use because it is forcibly implemented by try-catch.)
--The founder of java (James Gosling) and the developer of JRuby (Charles Nutter) say "Scala is the successor to java". --Groovy's creator (James Strachan) has also expressed his support for Scala. --Twitter moved the backend from Ruby to Scala in 2009. --Play framework supports Scala. --There is also a crazy library called Scalaz made by people who aren't satisfied with Scala. (A library that supplements the Scala library) --There is also a plugin for scala eclipse and eclipse for scala.
If you remember the above characteristics, one day a nice woman will say, "You are familiar with Scala." May be said.
By the way, when I said "Let's use Scala" at the scene, it was rejected. Therefore, I have no practical experience with Scala, and I am an amateur who just touched it as a hobby. I want to use it for business someday.
But I really like kotlin.
Recommended Posts