[Reprinted and sorted] preface to a Java book-development process

Source: Internet
Author: User
The following is the preface to a Java book. I think it is well written. Let's show it to your friends who use. net. I just made a simple arrangement of the text. I started the question and the copyright belongs to the original author.

I am familiar with the usage of many classes in JDK. I have been able to use STRUTS + hibernate to make a decent Forum. Many people in the company call me a master of hibernate, I have done a lot of large projects, I have many years of programming experience, I wroteCodeI have been using Delphi for three years and I have been writing many small files.ProgramWhat remote monitoring. API hijacking. trojan Horse, Windows API contains a lot of good things, Delphi controls are also very rich, I also studied C #, it is really convenient to do things with C # webform, by the way, I am currently researching very popular Ajax technologies! But ...... Are I a software engineer?

1. Heavy sword and no front. Unfortunately, no work

After a period of development, many developers often wonder how to write out highlights. due to the clever program, I used a lot of skills in the program and took pride in it. I was also praised by my colleagues: "It's really a master. People have a unique solution to this problem, I don't know. Sorry!"

But is this really good?

I once took over a piece of code, which is said to have been left by a senior employee. This code often has bugs and many people have taken over it, every attempt to modify a bug will lead to more bugs, known as a hard rock. after reading this code, I took a sigh of relief. This is indeed a code written by a senior. There are five layers of loops nested in it. The data is loaded and saved many times between the interface and the database, in addition, I intercepted a framework API in a clever way and implemented the function that could be implemented with complicated code. I read it for one morning and spent two days modifying the bug, but the more bugs, the more bugs. in one breath, I deleted all the original code and implemented it again in the most common but stupid way. From then on, this function rarely experienced bugs, the successor has never complained about difficult code.

This reminds me of one thing I did when I went to school. when I was a senior, I worked in a small software company for a call center system. I used a lot of advanced features of controls for development. The fast development speed surprised the project manager. I boast that I am a master, so when the function was almost done, he asked me to go to Beijing for a job. at, When I was sorting out the required materials for the next day's job fair in a hotel in Beijing, the project manager called me and said, "Brother, there is an intermittent bug in the program you are working on. The program cannot run now. I asked another brother to help change your program. He said that after reading the program for a long time, he did not know how you implemented it. "I was very proud at the time, so I was very proud to tell the brother who changed my program on the phone how I implemented it. later, this program encountered some problems, which could only be solved by me. When I left the city after graduation, the Project Manager said to me with a bitter face: "brother, who will maintain your program after you leave? At the beginning, you should have done it with simple technology. "At that time, my heart was still charming after listening to his sentence, but now I think it is sad.

In the field of software development, the advantage of the technique is that it can solve some problems independently. The disadvantage is that the technique is not well known to the public. if you use too many skills in the program, it may be hard for others to understand. the advantage of a local skill is insignificant for the entire system, and one person cannot understand it. bugs that cannot be changed may be fatal. in the case of collaborative development by teams, one important aspect of development should be the ease of application. When the performance indicators of the software can be guaranteed and meet the needs of users, you must make it easy for other programmers to understand your program.

Skills cannot be abused during programming. It should be programmed in a natural way. Simplicity is a kind of beauty. although the person who won't solve the problem is a "cainiao", this kind of person is very destructive, and the person who solves the simple problem in a complicated way is "half bottle of vinegar ", this kind of person is very destructive, just like me! Only those who can solve complex problems in a concise and direct way can be expected to become masters. Therefore, we are more willing to see code with no shiny words.

2. Framework and toolbox

I often hear people say, "I have made something using a framework." I have developed a framework to implement the function. "What is the framework?

The definition in design patterns is as follows: "Framework is a group of collaborative classes that form reusable designs for a specific type of software ...... The framework specifies the architecture of your application. it defines the overall structure, the division of classes and objects, the main responsibilities of each part, the collaboration between classes and objects, and the control process. the framework implements Reverse Control (IOC) for specific implementation details. The implementers do not need to consider the design that has been implemented by the framework layer, as long as they can be developed according to the framework requirements, then put the developed items in the framework to run.

For javacweb development, anyone knows that the MVC Architecture is easier to manage and maintain than the traditional model1 method. However, in actual development, many people cannot help the temptation of the simple development method of model. so how can I force myself to use the MVC mode? Of course, the MVC development framework is used, such as struts. after using struts, you must write a JSP as the view, inherit the action to implement control, and inherit the actionform to implement the model. The framework constrains the imaginative brain of developers, let's develop with the best design strategy.

Although the framework often contains specific available subclasses or toolkit, the advantage of using the framework is reusable design rather than reusable implementation. When using the framework, we do not need to consider some design policy issues, because we have virtually used the "best practices" designed by the framework ".

The toolkit corresponds to the framework ). the toolbox is a class pre-defined in the class library. It is a set of related classes. reusable. provides a set of common function classes. we often use arraylist. fileoutputstream. cglib. dom4j and so on are all toolboxes. these toolboxes do not force us to adopt a specific design. They only provide functional help, so the toolbox is used for reuse (or code reuse ).

In Java, there is a special class called the tool class (utils), such as Java. math. beanutils in ccommons-cbeanutils. these classes do not encapsulate any State in them, nor allow callers to instantiate them. They only expose some static methods for other classes to call. this type is in other languages that support function libraries (such as C ++. delphi) is called a "pseudo class", because these classes do not encapsulate anything, they do not have their own states, they are just a collection of functions, they should have been resolutely put to an end, however, Java does not support function libraries, so they are allowed to exist. many people have criticized that these classes are process-oriented and not really object-oriented. however, it must be acknowledged that the process-oriented and object-oriented hybrid products such as Java are exactly what is needed for industrial development. The process-oriented and object-oriented products do not conflict with each other, otherwise, why have the real object-oriented languages still lived in the school greenhouse?

3. Reframe

"Re-frame" is a word I want to use. It refers to the Framework Design Based on the existing framework to achieve more application-level design reuse.

Many people think that struts is used. cspring framework development is based on framework development and is the best design. I don't know if these frameworks only solve most common problems, the framework design is required for many specific implementation problems. Otherwise, the implementation is still hard to understand. difficult to reuse. difficult to expand. many people wrote forums based on some famous frameworks. websiteSource codeThere is actually a lot of repetitive code. Poor design, these things should be well "re-framed.

4. Enterprise framework

Many enterprises have established their own or self-use or open frameworks, such as SAP's NetWeaver. UAP of yongyou. bos of Kingdee. inspur loushang. EOS of Shanghai panyuan. developing these frameworks requires a lot of investment in capital and human resources, but the following benefits are also very obvious.

(1) module Reuse

Many modules are common in enterprise information systems, such as permission management. organization architecture management and enterprise framework extract these modules so that developers of specific business systems can focus on the implementation of specific business functions.

(2) Improve Product Development Efficiency

Enterprise frameworks usually provide many general toolboxes or auxiliary development tools. Business system developers can use these toolboxes or auxiliary development tools to complete function development in the shortest time with the minimum workload. imagine if 1st functions are as time-consuming as 1,000th functions, what is the purpose of this framework?

(3) ensure that the business system uses best practices

Enterprise frameworks often adopt a very reasonable design and how to obtain remote interfaces. where to verify the data. A series of problems such as how to store data have been designed. Developers only need to design according to the framework requirements to ensure that the developed products are properly designed.

(4) Important to knowledge management
The enterprise framework integrates the commonalities of all software projects of the company and the essence of the most important knowledge of the company. With the application of the framework, the framework itself will be upgraded and optimized accordingly. as long as a new employee understands and masters the framework, the employee can be well integrated into the team, and the employee who leaves the company has already kept his knowledge in the framework.

(5) Improve Product consistency

The consistency here includes two aspects: product function consistency and product implementation consistency. function consistency mainly refers to the product interface. the consistency of Operation Methods ensures that users can easily learn and use all modules of the system. The consistency is mainly to standardize the product implementation mode.

Developers are smart and imaginative. The programs written by Different developers are individually different. Here is an example.

You can enter the person's name, age, gender, address, and other information in the interface, and then click "save" to save the information to the database.

If there is no unified framework, developers can use it at will: Someone will read the control values one by one when clicking the "save" button, then, execute an insert statement in JDBC to save the data to the database. Someone will use the open-source data binding framework to bind the control to the database field, then let the data binding framework process data storage. Someone will first create a hibernate configuration file for the person, and then read the control values one by one to fill the value object and call the session. the SAVE () method saves the data to the database.

It is a very big risk for developers to make full use of such information. It is very important to ensure that the code of the resigned personnel can be quickly understood by the successor, if there are so many implementation methods for such a small function, the problems that will be faced by large-scale function aggregation will be even more conceivable.

After using a specific development framework? For the above interface function, the system requires that you only need to override the initdatabind method of the parent class, and register the binding relationship between the interface control and the database field in the method. How can the rest connect to the database. the Framework processes how to save the data. I believe that if this is done, the people who take over will be able to know how the program is implemented without looking at the code.

One of the major changes brought about by the adoption of enterprise frameworks is that developers have little room for free and must develop with the framework constraints, it is impossible to reflect your "Superb Skills" in the development process ". from the perspective of improving management efficiency, software enterprises should welcome such changes. On the other hand, outstanding developers who are passionate about challenging new technologies can continuously improve and improve the enterprise framework, it injects new vigor into enterprises' technical routes.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.