Home  >  Article  >  Java  >  Java Journey: Traveler’s Map

Java Journey: Traveler’s Map

黄舟
黄舟Original
2017-02-06 11:40:231075browse

Some time ago, I was invited by CSDN to review the content of the Java knowledge base. I also had the opportunity to sort out my own Java knowledge system. I hope this article can help programmers who are about to enter or are trekking into the Java world.

The first picture, basic picture

I started to know Java around 2003 (I was still using Delphi at the time), but it was not until I graduated from my undergraduate degree in 2004 that I officially decided to learn Java. At that time, I felt that using Delphi to write C/S architecture programs was not interesting. The J2EE standard concept and enterprise-level architecture proposed by Java at that time felt all kinds of high-end, and I couldn't suppress my inner desire, so I started the journey of Java. To be honest, I was dizzy as soon as I entered the Java world. Various specifications, concepts and English abbreviations can make people dizzy.

  • J2SE

  • J2EE

  • J2ME

  • JSP

  • JDBC

  • JMS

  • EJB

  • JNDI

  • JDBC

  • JTA

I just recalled what it was like when I came in. The first thing I saw was a lot of unfamiliar English abbreviations (fortunately, Java didn't have all kinds of frameworks blooming at that time, otherwise I would be even more dizzy), and I didn't know where to start. It happened that my classmate had a JSP book, so I started with JSP. To be honest, it was a really bad book. I don’t even remember the name now. I probably remember that I started with some examples to build a JSP Demo site. After being tortured thousands of times by various environment and container issues, I finally ran an example. I finally saw the page in the example through my local browser. I felt a sense of accomplishment for a second, and then I was at a loss. Because I simply don't understand how it all works, what's the principle? It has been a long circle and many detours. If I were given a chance to start over again, I would start from the basic Java language foundation.

What is the basis? Java is an object-oriented language. The most important concept is objects, and all its syntax revolves around it. The basic structures and variables of other programs: sequences, loops, and branches are based on other languages ​​​​before, but they are just in a different form. Once you understand objects, the concepts surrounding objects: classes and interfaces are natural extensions. Of course, if you master the core concepts and basic grammar, you can only write Hello World. But the point is that if your starting point is right, the journey is near.

At this stage, you can become familiar with the language and related class libraries by reading good books and doing some basic exercises. In my mind, "Thinking In Java" is a suitable book for getting started with Java (hey, I took a long detour before I saw this book). Of course, there are also other good books, such as "Introduction to Java Programming", " Core Java》. My feeling is that you can get a few more starting books of this kind and read each knowledge point with reference. After all, an author may have made some omissions. Read horizontally instead of reading one book vertically from beginning to end. Grasp one knowledge point one by one, understand it, and make a deep footprint in one step. Don't run around, the results will be general. Start slowly, and then you can go faster.

Regarding the basics, in my eyes there are not many core and important parts. I will briefly list them here:

  • Core concepts

  • Object model

  • Interface design

  • Class library

  • lang

  • collections

  • concurrent

  • io

I won’t write much about the core concepts here. They are basically reflected in all Java code libraries. From the beginning, the difference is only in the appropriateness of understanding and abstraction. There are so many libraries in JDK, but only the above ones are listed here. In fact, the most important one in lang is String, which many people ignore. There is no concept of String in C. Java provides this object, but if you fail to understand and make good use of this object, you will step into endless pitfalls in the future, and you will step on them again and again. If you don’t believe me, go search and find out how many low-level problems there are about various character encoding garbled characters. In addition, there are various performance problems caused by String. The core object of String emanates from the encoding of characters, the byte expression of characters (big endian, little endian, network byte order), the impact on GC, regular expressions, and pattern matching. This may be the richest content in Java. object.


The Collections framework provides a large number of commonly used data structure encapsulations, which basically allows Java programmers to say goodbye to manually implementing most of the common data structures you learn from data structure courses. It is much more useful to correctly understand the applicable scenarios of different data structures than to implement them manually. If you have nothing to do, take a look at the code in Collections. They are all master-level implementations. I remember that when I was learning Java, it was still JDK 1.3. After I started working, the mainstream was JDK 1.4, and there was no concurrent library at that time. When handling inter-thread communication by myself, various notifications were missed, early notifications were made, and deadlocks were caused. So today's Java programmers are much happier. Concurrent is another master-level class library implementation, and you can take a closer look and figure it out. The IO library, whether it is file IO or network IO, is what Java programmers deal with most. It is important to be familiar with its API, but more important is to understand how to abstract and model IO operations, and to understand the different IO models. The essence and principles behind it.


Okay, after completing the above basic content, we got the first map, like the one below.

Java Journey: Traveler’s Map

Second picture, skill picture


#Even if you master the first picture, you still have to run freely in the world of Java It's still a little difficult. One of the mainstream usage scenarios of Java now is back-end development. In its previous era, this field was dominated by J2EE (now called Java EE), also known as Java Enterprise Edition. J2EE contains many contents, the core of which is EJB. At that time, I had just finished studying distributed object technology in school and implemented it using CORBA and EJB as examples. I read several books on EJB design patterns and best practices, and before I graduated and entered the company for an internship, I found that everyone said that EJB is no longer needed, and we use something called Spring. New English abbreviations such as IoC and DI appeared again. Before a mouthful of old blood could be sprayed out, I got back on my feet and started a new learning journey.


Yes, EJB began to slowly withdraw from the mainstream at that time (2005). The book "Expert One-on-One J2EE Development without EJB" written by Rod Johnson, a doctor of musicology, pronounced the death sentence of EJB, and Spring entered the stage of history. Since then, Java has entered an era of great development of frameworks. The combination of technical frameworks such as SSH/SSI has formed the mainstream of Java development and continues to influence it to this day.


There are more and more Java frameworks, and the ecology is getting bigger and bigger. Beginners must be confused when faced with such a complex framework. It feels like there is no end to learning. Gone. In fact, in real projects, there are not many frameworks that are actually used. SSH/SSI is basically the core framework of Java Web projects. It is the core tool for you to get started, and you need to be proficient in it. But to know this, you need to know why. Spring takes over the work of object creation and interdependence management, hiding design patterns in the use of the framework. Many people only know how to use it but never think about it. Web development has evolved from a mess of JSP in the early days (HTML + CSS + JS + Java + SQL. In the early days, I just put all these in a JSP, thinking about how difficult it is to maintain), to the division of responsibilities of MVC. Only a View layer has also experienced an evolution from tag library to page template (Velocity, Freemarker). Now I prefer the more thorough front-end and back-end separation model. Once upon a time, adjusting the CSS styles of a few pages killed me. Specialized division of labor is conducive to efficiency and depth. The evolution of the Web version caused by the rapid development of the Internet and mobile Internet has made today's front-end complexity no longer inferior to that of the back-end. .


#So as a Java engineer, how many frameworks do I need to master? This is a false proposition, because no matter how many you master, it will not be enough. The solution is to master a few core ones proficiently, understand a large number of them in general, and master the rapid learning framework. Taking SSH/SSI as an example, the trend of professional front-end division of labor is becoming more and more obvious, completely liberating the worries of back-end Java engineers. The framework taking Spring as an example solves a large number of general-purpose problems. Today's Spring is more than dozens of times larger than before (counting all sub-projects named after Spring), all of which solve specific general-purpose problems. So when you are writing code and suddenly want to write a class named after Util, stop and think about whether this is a class that solves a common problem. You might as well search for a ready-made class library. For example, Apache Commons may have what you need. code. General class libraries and frameworks free us to focus on business logic and efficiency. This is probably the most valuable part of your code. Some programmers may complain that these have no technical content, but I think the most effective technology can be used to achieve business. Maximizing value is the most technical thing.


The framework is like a weapon. I may not know all eighteen (far more than eighteen) weapons, but we must have the same ability, just like Zhang Wuji learns the Tai Chi sword. The enemy can still defeat him by learning the sword. The trick here is not to learn the tricks. For example, you may think that your Hibernate usage is perfect, but the database crashes as soon as it goes online. The essence here is still understanding relational (SQL) databases, and now it may also be necessary to add an understanding of the principles and mechanisms of specific non-relational (NoSQL) databases, and even an essential understanding of the O/R mapping model.


So, the basics are like internal strength, the framework is like weapons, and the use is like moves. With one mind and the best use, if the three are integrated, you can already dominate the Java world. As mentioned above, based on this we have a second map.

Java Journey: Traveler’s Map

The third picture, extended picture


And the third picture, I can no longer give a me Suggestions that I think are somewhat general. At this stage, each person's growth and development direction will be affected by his or her environment and actual situation. Let me explain a little using myself as an example. In the past few years since entering an Internet company, the development of Java technology has begun to evolve from J2EE containerized single applications to SOA and microservices. Large-scale distributed systems have become the norm, so more of my related work is focused on this area. On the one hand, in-depth excavation continues to complete knowledge blind spots. For example, the basis of distributed programs is RPC calls, and the essence of RPC is network plus object serialization. Accordingly, we need to thoroughly understand the principles of TCP, the network programming model under Unix/Linux, and several different network IO models. Then move up to the network programming models provided by Java based on this, BIO (blocking), NIO (non-blocking) and AIO (asynchronous IO), and combine it with actual work practice to gain an in-depth understanding.


In this process, I came into contact with a large number of different RPC technologies, from Java's own RMI to WebService technical specifications. Later, some simpler and more powerful RPC frameworks emerged one after another, such as Hessian, Thrift, etc. The essence of different frameworks remains the same. With the development of servitization, service frameworks that provide additional value-added functions have been further derived based on the RPC framework, such as Alibaba's open source Dubbo. With the deepening of work practice, it is possible to move down to the JVM level to analyze the memory usage of objects, thread scheduling and delay. What plays a core role at this stage is still the ability to learn quickly and apply it to work practice mentioned earlier.


#The other side of depth is horizontal expansion. As the nature of work changes, broader technical knowledge may also be required. For example, after becoming an architect, the breadth of technical knowledge required in some aspects will be higher. Methodical technical learning and dabbling skills allow you to expand the breadth of technology faster, examine different technical directions and products from a higher perspective, and make appropriate technical decisions most effectively.


Everyone at this stage may face different environments and practices, so the maps formed at this stage will vary widely. The following is my third picture, which is only for reference by fellow travelers on the Java journey. And the paths you take along these vastly different maps happen to form a unique you.

Java Journey: Traveler’s Map

Even if you don’t have a map yet, don’t be confused and stand still forever. If you keep moving forward, you will always find a way. In fact, this is how I got here. I have never dared to stop.

The above is the content of Java Journey: Walker’s Map. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn