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.
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.NET Compatible 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 | .NET The 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 | .NET The 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 | .NET The 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.
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 , .exe File |
.jar , .war File |
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.
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.
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