I compared the characteristics of Java and .NET

Preamble

The intent of writing this article is not to compare the technology with Java and .NET. There is often a religious war against language in the engineering community. Java engineers complain that .NET only rides on Windows, and .NET engineers complain that Java is noisy to write. I think that such a conflict is unproductive and meaningless.

I hope this article will help engineers who have only one experience to understand the technical characteristics of the other by comparing both language systems, web frameworks, and deployment methods.

Development tools

Kou, if you want to do that well, you will definitely use the vessel. (If a craftsman wants to do a good job, first sharpen the tools).

First, I will explain the tools that are indispensable for development.

Framework tool Commentary
.NET Visual Studio, Visual Studio Code, Rider Visual Studio, Microsoft's official IDE.NETCompatible with all platforms.
Java Intellij, Eclipse, Visual Studio Code Code execution and debugging roles, depending on the JDK
Java Mavan, Gradle Template management, packaging role. Depends on JDK
Java JDK Has the role of compile and run (Runtime)

Development of .NET can be started by installing Visual Studio (hereinafter abbreviated as VS). You can't just install the IDE for Java, you have to install and configure the JDK and Maven. There is an IDE (Intellij) that automatically installs the JDK and Maven, but it is better to install and configure it yourself if possible. Otherwise, you will step on a land mine that you do not understand.

If you just say the ease of building an environment, you will be better off in .NET. You just have to click one after another without using your head. Java first needs to understand and configure the characteristics and responsibilities of the tool.

For beginners, the first barrier to Java may seem a bit narrow. However, Java has a hard time building the environment, so you can understand the details of the project.

Well, both can be developed using Visual Studio Code (hereinafter abbreviated as Vscode), so Vscode is recommended for environment construction for the purpose of systematically understanding the technology.

Next, I will explain the various tools in a little more detail.

Responsibilities .NET Java Commentary
project management VS,Vscode,Rider Intellij, Eclipse, Vscode It's not much different if you use Vscode, but it's a little more efficient to buy Ideas and Riders for a fee. Eclipse~~garbage~~
Template management IDE+MSBuild or IDE+SDK IDE+Maven or IDE+Gradle .NETThe project is sln+Consists of csproj files. Java is pom.It consists of an xml file.
Compile / debug IDE+MSBuild+SDK or IDE+SDK IDE+Maven+SDK or IDE+Gradle+SDK .NETThe compiler is independent. The Java compiler is integrated into the JDK and the Maven project is pom.It consists of xml, but the compiler is pom.Maven is required to compile as it does not recognize xml
Package management Nuget Mavan, Gradle Nuget is easy. Java's Mavan and Gradle are flexible and powerful.
Packaging deployment IDE+MSBuild+SDK or IDE+SDK IDE+Maven+SDK or IDE+Gradle+SDK .NETThe compiler is independent. The Java compiler is integrated into the JDK and the Maven project is pom.It consists of xml, but the compiler is pom.Maven is required to package because it does not recognize xml.

The rich templates provided by the .NET SDK are simple and easy to use. Java Maven is flexible and powerful, but managing multiple projects feels more inconvenient than .NET.

This difference comes from the compiler and template.

Java projects don't have official standard templates, so the IDE only organizes project folders. You can decide any directory as SourceRoot or ResourceRoot by yourself, which is very flexible. However, due to its flexibility, it also has the disadvantage of increasing the burden of project management in team development. Well, thanks to Maven and Gradle, the chaos era of Java is over.

Language characteristics

Classification .NET Java
Class structure namespace :The namespace does not have to match the actual directory structure Package :Namespaces and directories must match
class cs file:It is OK even if the class name and the file name do not match java file:It is OK even if the class name and the file name do not match, but only one public class can be defined in one class
Compile output .dll, .exeFile .jar, .warFile

Web framework

The official Microsoft web framework is the de facto standard for the .NET web framework. Java has an official Servlet API, but the de facto standard is Spring. I would like to compare with the MVC framework.

function .NET Java Commentary
Core function ASP.NET Servlet
MVC framework ASP.NET MVC Spring MVC
Template engine Razor Thymeleaf Razor is intuitive and easy to use, Spring doesn't provide a template engine and you can put Thymeleaf from Maven
Data persistence layer Entity Framework Hibernate or MyBatis EF is easy and easy to learn. Java's Hibernate is easy but quirky, MyBatis needs to write sloppy SQL.

The .NET web framework provides a template engine and a data persistence layer from the beginning, so it's easy to understand and easy to learn. The Java web framework has a lot of choices for the template engine and data persistence layer, and can be flexibly configured according to the characteristics of the project. Hibernate is popular in Europe and the United States for Java's data persistence layer, and there are many MyBatis users in Asia. (* According to Google Drain research)

Personally, if it's a data persistence layer, .NET's Entity Framework is comfortable to use, taking advantage of Hibernate and MyBatis.

Deploy

Thanks to .NET Core, .NET is finally free from the curse of Windows only, and I am very pleased to have more choices. To be honest, there is no big difference between .NET and Java when it comes to deploying.

Responsibilities .NET Java
OS Window, Linux Windows, Linux
Web server IIS, Kestrel Tomcat

Since IIS is a GUI, it can be easily deployed, but it has the drawback that it can only be used on Windows.

Summary

Both Java and .NET have their own merits, and they cannot be compared.

Frameworks are just a means, and understanding the characteristics of both frameworks will help you make the best choices to achieve your goals.

However, Java has an overwhelming advantage in the biosphere. The number of committers is also not the ratio of .NET. I'm from the .NET field, so I'm definitely attached to .NET. However, if a newcomer asks, "Which should I study, NET or Java? ", I recommend Java," If you don't care about Windows, Java is better. "

After all, technology is temporary and the biosphere is eternal. That's why PHP is still active.

Recommended Posts

I compared the characteristics of Java and .NET
I summarized the types and basics of Java exceptions
I compared Java and Ruby's FizzBuzz.
I didn't understand the behavior of Java Scanner and .nextLine ().
I tried to summarize the basics of kotlin and java
[Java] I thought about the merits and uses of "interface"
[day: 5] I summarized the basics of Java
I tried to summarize the methods of Java String and StringBuilder
[Java] The confusing part of String and StringBuilder
I touched on the new features of Java 15
I translated the grammar of R and Java [Updated from time to time]
Try the free version of Progate [Java I]
I received the data of the journey (diary application) in Java and visualized it # 001
The comparison of enums is ==, and equals is good [Java]
Organizing the current state of Java and considering the future
Java language from the perspective of Kotlin and C #
[Java] I implemented the combination.
Advantages and disadvantages of Java
I studied the constructor (java)
[Note] Java Output of the sum of odd and even elements
Command to check the number and status of Java threads
Java beginners briefly summarized the behavior of Array and ArrayList
I tried JAX-RS and made a note of the procedure
I compared the build times of various Dockerfiles in Rust
Summary of values returned by the Spliterator characteristics method #java
What should I do after January 2019 regarding the Java payment issue and Java 8 end of support issue?
Regarding the difference between Java array and ArrayList, I compared and corresponded methods with similar functions.
[Java] Delete the elements of List
About fastqc of Biocontainers and Java
[Java version] The story of serialization
I read the source of Integer
This and that of the JDK
I read the source of Long
I tried the Java framework "Quarkus"
[Java] Judgment of identity and equivalence
I read the source of Short
I read the source of Byte
Differences between Java and .NET Framework
I read the source of String
The origin of Java lambda expressions
I tried using GoogleHttpClient of Java
[Java] Various summaries attached to the heads of classes and members
[Java] Get the dates of the past Monday and Sunday in order
I want to return to the previous screen with kotlin and java!
I tried the input / output type of Java Lambda ~ Map edition ~
Mechanism and characteristics of Collection implementation class often used in Java
Read the first 4 bytes of the Java class file and output CAFEBABE
From fledgling Java (3 years) to Node.js (4 years). And the impression of returning to Java
I passed the Oracle Java Bronze, so I summarized the outline of the exam.
[Java] I participated in ABC-188 of Atcorder.
Get the result of POST in Java
A collection of phrases that impresses the "different feeling" of Java and JavaScript
By checking the operation of Java on linux, I was able to understand compilation and hierarchical understanding.
Check the contents of the Java certificate store
Examine the memory usage of Java elements
The story of forgetting to close a file in Java and failing
[Java] Get the day of the specific day of the week
After 3 months of Java and Spring training
Memo: [Java] Check the contents of the directory
I tried the new era in Java
I tried to summarize the key points of gRPC design and development