[JAVA] Understand the characteristics of Scala in 5 minutes (Introduction to Scala)


"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.

What is 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 =

--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

Understand the characteristics of Scala in 5 minutes (Introduction to Scala)
Output of the book "Introduction to Java"
Understand in 5 minutes !! How to use Docker
From the introduction of devise to the creation of the users table
How to write Scala from the perspective of Java
Review the multilingual support (i18n) of the ios app in 3 minutes
Understand how to use Swift's JSON Decoder in 3 minutes
Java classes and instances to understand in the figure
Understand in 3 minutes! A very rough explanation of the difference between session and cookie
The part I was addicted to in "Introduction to Ajax in Java Web Applications" of NetBeans
Understand the basics of docker
How to display the select field of time_select every 30 minutes
Understand the rough flow from request to response in SpringWebMVC
Introduction to Rakefile that can be done in about 10 minutes
How to derive the last day of the month in Java
[Rails] Where to be careful in the description of validation
802.1X authentication to the network of Bonding setting in CentOS7
Introduction of javaFX in Eclipse (April 2020)
Understand the basic mechanism of log4j2.xml
It doesn't respond to the description in .js of the packs file
Pass the i18n locale to JavaScript
[java8] To understand the Stream API
Introduction to algorithms in java-cumulative sum
I want to understand the flow of Spring processing request parameters
Fix the file name of war to the one set in Maven
From introduction to use of ActiveHash
How to get the id of PRIMAY KEY auto_incremented in MyBatis
The milliseconds to set in /lib/calendars.properties of Java jre is UTC
From introduction to usage of byebug
I examined the concept of the process to understand how Docker works
Order of processing in the program
I want to change the value of Attribute in Selenium of Ruby
Summary about the introduction of Device
How to get the length of an audio file in java
How to increment the value of Map in one line in Java
How to set the indent to 2 single-byte spaces in the JAXB implementation of the JDK
The story of forgetting to close a file in Java and failing
Introduction to Scala from a Java perspective (Class-Tuple edition) to decompile and understand
Procedure to make the value of the property file visible in Spring Boot
Confirmation and refactoring of the flow from request to controller in [httpclient]
How to change the maximum and maximum number of POST data in Spark
How to find the total number of pages when paging in Java
How to constrain the action of the transition destination when not logged in
How to change the value of a variable at a breakpoint in intelliJ
I tried to make full use of the CPU core in Ruby
How to get the absolute path of a directory running in Java
[Rails] The cause of not being able to post was in form_with
Android development, how to check null in the value of JSON object
[Rails] Articles for beginners to organize and understand the flow of form_with
Change the save destination of the image to S3 in the Rails app. Part 2
Introduction to Slay the Spire Mod Development (1) Introduction
Get the result of POST in Java
Understand the basics of Android Audio Record
The secret to the success of IntelliJ IDEA
Introduction to java for the first time # 2
Understand the official sample Coffee of Dagger2
How to determine the number of parallels
The story of AppClip support in Anyca
How to sort the List of SelectItem
How to get the date in java
The story of writing Java in Emacs