How Programmers Learn Technology

How Programmers Learn Technology

foreword

  Learning is the first productive force. I always think so. Only by continuous learning can people realize their own shortcomings and deficiencies. As a programmer, I think people should practice with the idea of ​​lifelong learning. This is What I have always practiced and believed in.

Landscape

  The heights are extremely cold, and only by standing on a higher place can you enjoy more scenery. When you revisit all this when you are old, you will find that it is all worth it.

 

 

"View Documentation"

Spring

  This is the fastest and best way to learn in my opinion. For the technologies commonly used in my work, I took the time to read through the official documents (in fact, the length is not large), and I will definitely gain a lot, because the official documents contain many details and are really worth reading. When you have nothing to do, look through the APIs of the framework/system/platform you use to see what functions you don’t know or have never used. Think about what this function can be used for, whether it can solve existing problems, or optimize it. current solution.

After reading the official source code of Spring Boot/Spring, I know:

  1. If you want to use XML-based configuration, SpringBoot also fully supports it. Just use @Configurationto load , and then @ImportResourceuse the XML configuration file through annotations.

    Import XML file configuration

     

  2. As we all know, Spring Boot's automatic configuration is famous. If you want to know which automatic configurations are configured in the current application, you can turn on --debugthe switch console.

    How to View Auto-Configuration Details

     

  3. What is the best way to inject dependencies? If you read Spring's official documents, you will know that Spring officials usually advocate the use of constructor injection because it can realize the components of the application as immutable objects and ensure that the required dependencies are not null . Additionally, constructor-injected components are always fully initialized in return client (calling) code. But as a side note, a large number of constructor parameters is bad code, which means that the class may have too many responsibilities, and the code should be refactored to better address proper separation of concerns.

    What is the best way to inject dependencies

 

  If you are a front-end engineer, you can instantly kill 95% of your peers by reading the HTTP protocol and the ECMAScript standard, no kidding. However, if we really don’t have time, we can also use the official documents as a reference book, and look through them when we have problems. I believe that most of the problems can be found through the official documents. Good solutions

 

"Read the source code"

the code

  It is said that details determine success or failure, so this method is the only way to learn open source technology in depth. Only when programmers understand how a certain function is implemented at the bottom layer can we truly grasp what this code or this method or tool class is more suitable for and what it cannot be used for.

  To give a few examples, the most commonly used String class in the Java language, if you have not read the source code of String, you will not know that the underlying implementation of the String class toStringmethod is to return the string itself;

	/**
     * 此对象(这已经是一个字符串了) 返回自身
     *
     * @return  字符串本身
     */
    public String toString() {
    
    
        return this;
    }

  The bottom layer of the sort method of the Collections tool class actually calls the Arrays.sort() method for sorting. When I first saw it, I found it incredible. The JDK official is really good at code reuse!

 	default void sort(Comparator<? super E> c) {
    
    
        Object[] a = this.toArray();
     	 // 这里调用了Arrays.sort()方法对数组进行排序
        Arrays.sort(a, (Comparator) c);
        // 然后使用迭代器重新设置元素
        ListIterator<E> i = this.listIterator();
        for (Object e : a) {
    
    
            i.next();
            i.set((E) e);
        }
    }

  In addition, if you haven't seen the underlying implementation of HashSet, it is definitely beyond your expectations. Its empty parameter construction is just a new HashMap, which means it is HashSetalmost equal HashMap. High EQ: HashSetblue is better than blue; low EQ: HashSetit’s just a scamHashMap

  	/**
     * 构造一个新的,空的set集合,其底层的HashMap实例默认初始化容量(16)、加载因子(0.75)
     */
    public HashSet() {
    
    
        map = new HashMap<>();
    }

  If you are interested, you can also take a look at the underlying implementation of LinkedHashSet, TreeSetand the above are almost the same.

  Just as we can drive a car even if we don’t understand how to build it. And if you know a little bit about the underlying things, it will be easier to drive. When there is a problem with the car, it is not completely helpless and can only squat on the side of the road and wait for rescue. How many years have you been using the Spring framework, but you haven't even read a line of source code? If it's your girlfriend, it's probably time to break up.

 

"Dare to try"

The picture is not important, look at the words

  Everyone has a chance, but not everyone has the courage, as long as you take this step bravely, I think you are halfway there. There are many awesome programmers in this world not necessarily because they have learned a lot and have a high degree of education, but because they have stepped on too many pitfalls, encountered more bugs, and experienced so many things. Can deal with all situations slowly, and eventually grow into a powerful boss (PS: maybe the hair will fall out)

  Lu Xun once said a word: There is no road in this world, if there are many people walking, there will be a road.

  I think being adventurous is the way to learn any technology. A lot of trial and error in a protected environment is the most efficient way to learn. Now that virtual machine technology is so mature and cloud servers are very cheap, why can't we build our own server in minutes and then do our best to die on it? I'm sure many novices have heard of rm -rf /countless accidents, but have you tried this command? Do you know what the output of this command looks like? You don't know that the most valuable thing that the company provides us is actually the opportunity for actual combat. The technology we have learned ultimately needs to be realized through work and become our experience. Through the company, we can get access to real data, understand real users, observe how the real system works, and accumulate real experience... Investing in ourselves is more cost-effective than anything else, but the so-called opportunities are only prepared in advance People, and most people just go with the flow, don't wait until the work is assigned to you to try. The company is not your testing ground, and you shouldn't use users as guinea pigs. If the company does not give you a chance, it only means that you are not ready yet.

Guess you like

Origin blog.csdn.net/qq_48052049/article/details/130439337