Having used Java for more than ten years, I dare not say "proficient"

I have been using Java since I graduated as a programmer and have been working for almost 20 years now. Deducting the few years I spent in C++ and Lua for mobile games, and the time I spent on writing code for management, I have been writing Java code for at least 10 years.

If you ask me "Have you been proficient in Java?", to be honest, I'm still a little guilty.

Java is broad and profound, with so many knowledge points, there must be something I don't understand. In addition, everyone has their own understanding of "proficiency". Some people think that they are good at using, some people think they are good at the underlying principles, and some people think they are good at frameworks.

But, having used Java for over a decade, I can speak to my own understanding of "Java proficient".

The knowledge covered by the Java language is extensive, but in general, the three most important aspects are:

  1. Java Basics
  2. Java Concurrent Programming
  3. Basic knowledge of JVM

Therefore, the so-called proficiency in the Java language can be roughly equivalent to the proficiency in the above three aspects.

The mastery of the basic knowledge of Java is mainly reflected in the ability to smoothly integrate various basic data structures and various built-in objects of Java into the actual scene, and to solve the actual problem with the fastest speed and the best solution. work problems in .

For example, in the project, people often do not distinguish whether the object is a strong reference or a weak reference, and they are all strong references. If an engineer is proficient in the basic knowledge of Java, he will use strong references and weak references flexibly according to the actual situation.

The proficiency of Java concurrent programming is mainly reflected in the ability to use various multi-threaded design patterns and various tools in concurrent packages to solve various concurrency problems.

For example, use Future and related subclasses to improve program efficiency, and use CountDownLatch to control thread order.

The mastery of the underlying knowledge of the JVM is mainly reflected in the ability to quickly optimize the JVM to improve the performance of the project, and to find the underlying problems of the project very quickly and accurately, and directly solve the root causes.

For example, we are writing a monitoring client to be embedded in the other project. This client needs to ensure that it does not cause a lot of CPU and memory consumption of the embedded project because of its embedding. It is also necessary to ensure that data can be delivered quickly and error-free without consuming large resources. At this time, we should use our in-depth understanding of JVM garbage collection to engage in object pooling.

In short, the proficiency of the Java language itself is reflected in the ability to use Java to optimally provide technical solutions, and to creatively solve various complex technical problems.

Let's take a look at how to master these knowledge and skills separately.

1. Proficient in Java basics

To master the basics of Java, you can think deeply about a few questions I asked about each knowledge point:

Type Conversion in Java

Java is a strongly typed language, and various type conversions are inseparable in programming.

But have you ever wondered what the underlying details of forced transformation are? Ever wondered why Java upcasts are automatic, but downcasts are mandatory?

Java's Collections Framework

Java's collections framework is so versatile that as long as you develop a slightly complex project, you can't avoid using it. As you study, you can think about the following questions:

  • What are the best use cases for the various collections in Java's collections framework?
  • What are the deficiencies of the various collections in the collections framework that are implemented by subclasses to solve their superclasses?
  • Why should we use the Guava framework when we have Java's collections framework?

Arrays in Java

Java arrays are often used by everyone, but have you ever thought about:

  • When do we use arrays and when do we use collections?
  • How does the underlying Java check for out-of-bounds arrays?
  • Why is the System.arrayCopy method so fast?

String in Java

  • Have you looked carefully at the String code?
  • Ever wondered why String is immutable?
  • Which methods in String create strings that share the same char array, and which create strings that have separate char arrays?

Interfaces and Abstract Classes

How to use Java's interfaces and abstract classes most appropriately in a project has always been a difficult problem to solve. When you learn about interfaces and abstract classes, you can think about:

  • What are the advantages of Java interfaces over abstract classes? What's the disadvantage?
  • What are the differences between their characteristics?
  • Have you ever seen how abstract classes and interfaces are defined and used in some open source projects?

equals 和 hashcode

There has always been an important connection between Java's equals and hashcode methods.

  • Why does overriding the equals method require the hashcode method to be overridden as well?
  • What are the uses of the hashcode method?

Generics and Enums in Java

Generics and enumerations in Java can be difficult for beginners to understand. Please also check it out:

  • What problems were generics and enums introduced to solve?
  • What are the unique characteristics of Java's generics and enumerations?
  • What are the most common mistakes in using generics and enums?

Java-like IO, NIO

IO and NIO The learning here, I have mentioned several times in previous articles. In addition to some study suggestions mentioned in previous articles, here are a few questions for you to think about:

  • What flaws does Java's IO have to introduce NIO?
  • Which of the NIOs are often heavily used by open source frameworks?

Network Programming in Java

Java's network native programming may not be commonly used by everyone, but it is indeed a very important foundation in Java. The various important open source frameworks related to the network in Java can have such excellent performance. Java is inseparable from it. The bottom layer of the native network is excellent.

  • Common Java open source network frameworks, what are the common programming patterns?
  • Are there any shortcomings in the network programming foundation provided by Java?

Regular Expressions in Java

Regular expressions in Java may not be well mastered by many programmers who have worked for many years. However, when doing business related to string matching, it cannot be avoided.

In addition to learning how to use regular expressions, you also need to think about:

  • Is there a big difference in performance between regular expressions that have the same function but are written differently?
  • Can regular expressions express the logic of negation?
  • What are the shortcomings of regular expressions in matching?

JDBC for Java

  • Why are we always used to the JDBC framework?
  • Is there any way we can use JDBC to get various metadata in the database?
  • What is the overall architecture of JDBC?
  • Is there anything unique you have seen in some open source frameworks?

Date、Time、Calendar

  • Why are Java's Date, Time, and Calendar difficult to use?
  • Is there anything you think could be improved?
  • Why is the JodaTime framework considered better than Java's native Date, Time, etc.?

Second, proficient in Java concurrent programming

To be proficient in Java concurrent programming, such as accurately understanding processes and threads, understanding deadlocks, Race Condition, programming patterns, etc., are already necessary prerequisites. On this basis, it is probably necessary to further study the following three aspects:

The basics of threading

This part pays attention to two subtle points of knowledge and understanding a model.

The first knowledge point is the characteristics of volatile, usage scenarios and underlying implementation details. The second knowledge point is the difference between wait and sleep. It is best to master the details of JVM implementation.

These two knowledge points are the two main obstacles that prevent us from being proficient in threading knowledge.

In addition to these two knowledge points, the more in-depth understanding is Java's memory model - in addition to understanding what Java's memory model is, you also need to know why Java's memory model is designed this way, what are the benefits of this design, and What's the problem?

Java Concurrency Framework

The concurrent framework mentioned here mainly refers to the interfaces and classes under java.util.concurrent.

It is recommended that in addition to practicing with the book, it is best to read the source code inside.

Multithreaded programming model

I said before that everyone finds a job to understand the multi-threaded programming model, and just read a book. But if you want to be proficient, in addition to reading books, it is best to find some famous open source projects to learn.

For example, Netty, compared with the multi-threaded programming mode, take a good look at the mode codes implemented in Netty, and understand the advantages and disadvantages of various modes and how to mix them together to achieve the best effect.

3. Proficient at the bottom of the JVM

For the learning of JVM, I once wrote an article, you can refer to learning.

JVM, you are too much

In addition to the suggestions in this article, I have recently gained some new insights into studying the JVM, adding the following:

  • Bytecode: You can see "In-depth understanding of JVM bytecode"

  • JVM garbage collection: It is recommended to take "Garbage Collection Algorithm and Implementation" as the program, and start to selectively read "In-depth Java Virtual Machine: Algorithm and Implementation of JVM G1GC", one of "JVM G1 Source Code Analysis and Tuning". Book.

The above is my understanding of "proficient in java".

How is it, do you feel very heavy after reading it and feel that you can't learn? It's normal to feel this way. If I go back more than ten years, I'll be worried when I see so much content at once.

The above is a reference for everyone, you can also ask the technical experts around you for their understanding of mastery. Then combined with the current situation of my work, I found a direction that I recognized, and slowly started to learn.

Anyone can be their own hero as long as we do our best.


Hello, I'm Shimonai.

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

I went from a non-computer graduate to a programmer, working hard and growing all the way.

I will write my own growth story into articles, boring technical articles into stories.

Welcome to pay attention to my official account. After following, you can receive high concurrency and algorithm learning materials.

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

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324084613&siteId=291194637