Confusing title. Generally, Program All members are developers. Yes, we are developers for our users. Therefore, for them, we have endless magic to create another world, and they can only act on the land we circled. However, have you ever wondered whether you are dancing in the applause of others as we point out a clear path for others.
As programmers, we often make some framework users. Presumably, Java programmers are no stranger to servlet. For a long time, I have always regarded it as a common API. When necessary, I can find out which methods are sufficient. Recently, considering the design of the system structure, we have implemented a simple life cycle framework with a mechanism for monitoring lifecycle events. The so-called listener is only an implementation of the observer mode, that is, after a specific event occurs, the listener is called to notify them of what happened. The reader turned to the "Java and mode" at hand, and the "mode in Servlet technology" Chapter suddenly attracted me. I have read this chapter before, but from the user's point of view, I just want to know something and never think about why these things are designed like this. When I become a developer, however, I found that it was a world with holes. Some Concepts in Servlet technology suddenly filled my mind and tasted it carefully. It had many similarities with the framework conceived in my mind: various listener (servletcontextlistener, servletcontextattributelistener, httpsessionlistener, and httpsessionattributelistener) provide the listener mechanism I want to design, the filter mechanism is similar to the interceptor mechanism in my conception (JBoss's flexibility is achieved by interceptor). servlet corresponds to the core service in my design. When I was thinking about Framework Design, flexibility was a very important factor. The validation with Servlet gave me a new idea of this familiar stranger. Good things are around, but they don't know anything about them. For the framework, its designers are the happiest people in the game. Apart from the fun of the development process, the fun of setting rules for others is beyond imagination.
framework designers should abide by the rules set by Language designers while enjoying their own happiness. For a simple example, we know that the C ++ language adds a reference based on the original values and pointers of C ). The C language has proved its omnipotence by facts. Its Values and pointers are sufficient to meet all the requirements, and references are not like classes or templates) and so on can provide another abstraction. What is its significance? My answer is that it is just a syntactic convenience. During the implementation of the compiler, the reference is represented in the form of a pointer. When the Code is displayed, it is no different from a common value. As a function client, the code is no longer required to use '&' as the previous pointer, so that the code looks much clean and there will be no loss in efficiency. Taking a fancy to the clean code, Java simply removes the pointer and enriches the referenced concepts (can be left blank, can be rewritten, and so on ). After experiencing the fun, the designers only give us a design result. If we are not clear about it, we can only follow it in most cases, rather than share the fun.
For another example, C ++ has the concept of copying constructor. In fact, in Java, we also use one object to construct another object, but Java never mentions this concept, why? The reason is the pass by value in C ++. Although we try to use pass by reference in an excellent programming style, pass by value is still inevitable. For example, we can construct a multiplication operation of rational number classes, we can only construct a temporary variable in the function to store the product by value and pass it to the external function. Pass by value requires a copy construction process. We cannot directly copy a piece of memory to the other side, because if the class definition stores the part of the dynamically allocated memory (that is, the pointer ), the code will have problems. For more information, see Objective C ++. Why does this problem not exist in Java? In Java, references are passed back and forth, and the copy construction process is not involved. Can C ++ be the same as Java? Sorry, no. One important reason for the pass by value mentioned above is that you cannot pass local variables out, because the memory of local variables will be destroyed after the function is executed, therefore, we will understand the dangling phenomenon. What if it is dynamically allocated? In the function, it is not a good behavior to output a new object. In this way, we should at least spend more time in the document to explain who released the memory. Why is there no such problem in Java, because the Java memory is the responsibility of GC. Now we can see that GC is never so simple as memory management, and it has a great impact.
Developers and users have different experience. Many people think that software development is boring. One important reason is that they are only rule-abiding, and developers are happy with this game. Many software development books can tell you "how", but seldom say "why ". For example, many source code analysis books will tell you how the code completes the function. After reading these books, we can draw a simple example at most. If we want to do it ourselves, but often do not know how to start. Because we only see the results, but the process is not displayed, and this process is often the essence.
It seems that rule making is a very distant thing. As a developer of our own software, we are not the rule maker. We try to understand some problems from the perspective of rule making, so that we can learn the rules and improve our understanding of the rules so that we can be more comfortable in this game.