So easy! Those very useful tools in Java development

In recent years, the Java technology stack has developed very fast, and hundreds of technical tools are constantly pouring out, which also creates a problem:

As developers, which tools should we choose to build the most suitable technology stack?

Today I will recommend a wave of tools and frameworks that I commonly use and understand.

1. Project tools

1.1 IDE

The mainstream Java development tool is now IntelliJ IDEA. A few years ago, Eclipse may still be able to compete with IDEA, but now it is basically the world of IDEA.

Take myself for example. I used IDEA first, then Eclipse for a few years, and then back to IDEA.

Including the programmers around me, who used Eclipse before, many people have switched to IDEA in recent years.

If you ask me what is the best way to use IDEA, I think there are 3 points:

  1. Smart code tips, cool!
  2. The code is automatically generated, cool!
  3. Code debugging, cool!

And these three points are precisely the three points that can greatly improve the development efficiency of developers. Therefore, it is recommended to do Java back-end development, and IDEA can be given priority as a development tool.

1.2 Version management tools

For the code version management tool in the project, Git is already in a monopoly position, and there is no need to consider SVN and CVS for new projects.

The reason why Git is now in a monopoly position is mainly due to 2 points:

  1. Git is distributed and will not lose the complete version of the code history if the version management server crashes.

  2. Git branching is a very cheap operation, and branches can be created at will, making parallel development easy to implement. However, the version management tools such as SVN and CVS are very clumsy to create branches, and parallel development is very troublesome.

The first point above greatly improves the security and reliability of code assets; the second point is perfectly adapted to contemporary agile development needs. So it's no surprise that Git is so popular.

1.3 Build tools

The build tools for Java projects are now competing, and there are generally two choices in the industry: Maven and Gradle.

If it is a back-end Java project, most of them still use Maven to build the project. If it is a front-end Android project, choose Gradle.

Gradle itself is much more advanced than Maven: it has flexible configuration, excellent performance, and is really a very good build tool.

So why do most of the back-end Java projects use Maven?

Because Gradle itself is too flexible, this flexibility brings two problems that do not match the build characteristics of the backend project:

  1. Because Gradle is flexible, its usage rules are changeable, which leads to a high learning threshold. The construction process of the back-end project itself is relatively rigid and has very few changes, so it does not require too many construction features and construction rules. That is to say, the various usages, rules, and features introduced by flexibility itself are of little significance to the back-end project. In order to use the construction tool itself, it is not cost-effective to invest time in learning.

  2. As mentioned above, the construction process of the back-end project itself is relatively routine, and some strong constraints are required to ensure the reliability and stability of this routine. Gradle loses the strong constraints of Maven because of its more flexible configuration rules. This is likely to cause various conflicts and potential errors when the team uses Gradle due to the loss of constraints, resulting in project construction. The instability of the back-end project is not worth the loss.

2. Development framework

2.1 Web Framework

Most of the current Web project development has turned to SpringBoot. There are three biggest benefits of using SpringBoot:

  1. Very little configuration, it can be said to be plug and play
  2. Based on Spring, the entry threshold is very low
  3. Run directly, no need to consider the issue of web containers

SpringBoot is very familiar to most people, so I won't go into details.

2.2 Persistence Layer Framework

There are basically two types of persistence layer frameworks used in project development:

  1. Mybatis series derived framework
  2. JPA series derived framework

In China, Mybatis is still the first choice for most persistence layer frameworks. It seems that most projects abroad use the JPA framework.

In my opinion, Internet projects, toC projects are more suitable for Mybatis, and toB projects are more suitable for JPA.

The business requirements of the toC project are often flexible and changeable, so it often requires the technology of the project to be flexible and changeable. Mybatis itself is a simple encapsulation of SQL, and it is easy to add tables and fields and change SQL.

The toB project is different. The requirements are basically stable, and the designed data model will not change frequently. Therefore, the flexibility of Mybatis is not required, but a series of strong constraints are required to modify the model at will. And this is also the characteristic of JPA itself: it is very standardized, and there are many constraints, the cost of changing the data model of JPA is relatively high.

Therefore, when you choose a persistence layer framework, you should see the characteristics of the project clearly, and choose between Mybatis or JPA according to the actual situation.

2.3 RPC framework

Now the architecture of Java projects is basically turning to a distributed architecture. The core of the integration of distributed systems is RPC, so many projects have introduced the RPC framework.

RPC framework, Dubbo framework is more commonly used now.

Dubbo performance is very good:

  1. The communication protocol used at the bottom of many RPC frameworks is HTTP, while Dubbo chooses the TCP protocol as the communication protocol. In terms of performance alone, the performance of TCP is definitely much better than that of HTTP.

  2. And Dubbo itself also uses a lot of NIO asynchronous programming to further optimize performance.

Therefore, if you need to use RPC in your project, you can first consider the Dubbo framework.

3. Middleware

3.1 Web server

Since most of the current Java development uses SpringBoot, the commonly used Web containers such as Tomcat, Jetty, and Resin are not deployed and used separately.

However, there is one web container that is thriving, and that is Nginx.

Nginx has a very special status in Java project development. It plays two roles in the Java project architecture:

  1. A web container for processing static resource requests - Nginx In a Java project, it is specially responsible for processing Http requests for static resources such as pictures, html, js, and css.

  2. Reverse proxy for distribution - In addition to being a web container that specializes in processing static resource requests, Nginx also forwards requests for dynamic resources such as servlets and controllers to the Tomcat container built in SpringBoot.

One more thing, because of the feature of reverse proxy, Nginx will be deployed on the cluster later. When Nginx forwards requests, it will also act as a reverse proxy for load balancing request distribution.

3.2 Message Queuing

Nowadays, everyone's architecture is becoming more and more distributed. In a distributed architecture, the common means of communication, in addition to network requests, is message queues.

Now the mainstream message queue frameworks include RabbitMQ, RocketMQ, Kafka, etc.

I wrote an article comparing RabbitMQ and Kafka before,

Although the performance of RabbitMQ is lower, it is easy to use and more suitable for small and medium projects.

In addition, when working on projects related to the financial field, if you use message queues, you can give priority to RabbitMQ for the following two reasons:

  1. RabbitMQ is the implementation of the AMQP protocol, and the AMQP protocol itself was jointly formulated by software experts from the financial industry. It is very mature and comprehensive and has become an industry standard.

  2. RabbitMQ is written in Erlang. Erlang's virtual machine is very mature in protection of memory and CPU overload, which also shapes the reliability and robustness of Erlang applications.

For large projects and non-financial projects, you can choose between RocketMQ and Kafka.

Almost 90% of the functions and concepts of RocketMQ and Kafka are the same, but RocketMQ has made some improvements based on the Kafka concept, and it is more applicable to a wider range of business scenarios.

In stream data processing, everyone should give priority to Kafka, because Kafka's stream data processing ecology is more complete and comprehensive.

3.3 Database

In the Internet field, the mainstream database is MySQL. In some traditional industries, such as banks, Oracle is used a lot.

Oracle is expensive. One of the characteristics of Internet projects is that there are too many database servers. If Oracle is used, the cost is too high.

Moreover, everyone is more and more aware of copyright, and the state is more and more strict about this aspect. Therefore, MySQL is almost used in the Internet field.

Using MySQL, there is a common MHA scheme - MySQL's high availability scheme. The basic architecture is one master and two slaves. When the master fails, the slave will be promoted to master.

3.4 External cache

For high-concurrency architectures, external caches are indispensable, the most common of which is Redis.

There are three reasons why everyone uses Redis as an external cache:

  1. Redis itself performs very well.

  2. Redis has many data structures to adapt to different business caching requirements.

  3. Redis' cluster high-availability solution and sharded storage high-performance solution are relatively mature.

The above are the mainstream technical tools often encountered in Java development.

Due to space limitations, I have only listed some of the most core (or that everyone will use) tools and middleware.

There are some important middleware, I don't think everyone will use it, so I didn't mention it, such as ElasticSearch, MongoDB, Zookeeper, etc. (I will write an article and introduce it to you later).

I hope this article is helpful to you, can help you quickly and accurately find today's mainstream technical tools, and can help you improve development efficiency.


Hello, I'm Shimonai.

The technical director of a listed company, managing a technical team of more than 100 people.

I wrote a lot of original articles, compiled some of the best articles, and made a PDF - "climbing", which includes 15 technical articles (learning programming skills, architects, MQ, distributed ) and 13 non-technical articles (mostly programmer workplaces).

What is the quality of this document? I won't brag too much, many people say "benefit a lot" after reading it.

If you want to get "Climbing", you can scan the code in the picture below, follow my public account " Si Yuanwai ", and reply in the background: Climbing

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324074053&siteId=291194637