[Switch] talking about technical principles and technical learning methods,CodeReading and other
Http://xiaotie.cnblogs.com/archive/2005/12/21/301634.html
I. Principles of Technology Selection
A relatively standardized software development process can be learned by a limited number of companies. Even the current method is the merge method.ProgramStaff, test driver, documentation and code written together, prototype. However, we basically stick to the following principles:
Take practicality as the leading factor in work, and take the least effort to achieve the maximum effect.
The first utility I have ever written is to import a legal disc into the database. The format of the disc source file needs to be analyzed. There are tens of thousands of data records. One method is to write a program for direct import, and the other method is to write an interface for manual import. The latter is selected. The program interface is as follows: there is a text box with a large button and a book with a button as big as that. The principle of this design is to keep your eyes closed. Let a irrigation buddy, CTRL + C, CTRL + V, keep filling. Paste the text into the database, automatically parse the text, and put it into the database. Alt + TAB Ctrl + C/V on the left hand, and click the mouse on the right hand to perform a rhythmic movement. Soon the data was finished in a few hours. A text box, a button, originally designed, is very PP, but the old point is not in the middle. Then I made the button the boss. This change increased productivity by more than doubled.
Work must adhere to this principle. Identify the bid value and find the bid that can increase the value. Even if this violates general rules, it violates technical principles.
Learning is based on simple and core things. If you want to learn, do not. Complex things should not be learned unless you want to become an expert in this field. I would like to give my own example. I was responsible for the specific implementation of GIS in the past. Low budget. I decided on the path of Open Source GIS software. I originally wanted to use C #, but I didn't have a good open source GIS software. I decided to write it in Java. I haven't even implemented Java yet. I even selected an open-source Lib, and asked a buddy to run a demo, and then asked him to draw a function call diagram from the main function of the demo until the database call. Even then, I ran to look at the GIS specification. Then, based on my normative knowledge, I quickly realized the number of layers in the middle of the Software. What is the use of each interface in each layer, how to call. Advantages and disadvantages of this software. Then the architecture and design came out, and then two Java programmers soon made it.
2. Technical learning skills
Using the above example, we will talk about the skills to learn software.
To learn something, you need to learn two types of knowledge: Structure and details.
Structural Dongdong is very important. You can start to study the structure, learn the details, and be able to do it well. The structure is not clear, and the details are not well understood. The structure is simple, that is, vertical and horizontal lines. In short, it is the execution of a program. You need to know which step is being done. Use ASP. net, that is, from receiving a request to returning a page, the middle of the call process, this is the main line, and further, the Program Load-> receive request (-> cache, session mechanism) -> return a page. The process is clear, Asp. net. Generally, APIs are called vertically.Source codeIt will be done soon.
The horizontal view is to look at the important interfaces, the implementation of important abstract classes, the location of which implementation is used, and the advantages and disadvantages. So it is better to go to school in the structure. The rest is the details. It takes a lot of time to get familiar with details. In this way, I think it is the most effective way to learn. You don't have to trace the cutting-edge technology. When a technology is in front of you, you will soon be able to see its skeleton, advantages and disadvantages, and performance, at least the approximate range can be estimated. In this way, we will gradually cultivate our understanding of a technology, so that we can focus on it, know where there may be traps, and where there may be innovation. Grasp the important points and context.
In terms of details, we are constantly practicing and restructuring. A useful software constantly puts forward higher requirements and constantly reconstructs it. It can't be used several times, and several important design patterns have become familiar with it. A single learning mode is not desirable. Each mode is designed for certain problems. Understanding these problems is the key to learning! There are a variety of technologies, but the changes are very fast, but there are not many problems that the technology has to solve.
At the architecture level, the main problems are: (1) solving complexity-how to simplify complexity? The point here is encapsulation. Oo is an encapsulation, and there are other encapsulation methods. In refactoring, the key point is to make your class name and method name clearly express its identity and functions. (2) solving the problem of program evolution and expansion-combination of Priority Inheritance, how to expose APIs, and how to write documents. In short, the simpler the program evolution and expansion, the better. (3) performance problems-80/20 principles, how to test performance tests, how to evaluate performance and cache mechanisms in different use cases; (4) functional problems-the main functions must be implemented. This is related to the business; (5) ease of use; (6) Vertical Scaling, horizontal scaling, concurrency ...... (7) Self-Development, third-party plug-ins, outsourcing, and selection.
For specific learning, I recommend problem-oriented, Case-Based Learning. Do not stick to the language or learn the best things you can learn. For example, the key to performance is scheduling. At this time, we can look at the resource scheduling mode. Hibernate is the best way to schedule resources. Event-based scheduling (for example. NET Web Cache), process scheduling, thread scheduling, workflow, all of which are behavior scheduling. If you integrate these tasks, you can master the advantages and disadvantages of each implementation. All the time, concurrency, and resource-related things in the software design are lost. For behavior scheduling, you can look at the cache implementation in. net, look for a workflow software, look for several thread frameworks, and look at the Process Scheduling Mechanisms of several typical operating systems.
Specifically, the problems faced are:
(1) object creation and destruction; (2) object encapsulation and inheritance system; (3) object granularity and semantic Division; (4) Object reuse; (5) object testing; (6) Object persistence; (7) Specific API exposure; (8) Common collections; (9)AlgorithmProblem; (10) performance problem; (11) callback; (12) elimination of semantic traps; (13) I want to become lazy with you ......; (14) What APIs can I use (15) Management of objects; (16) asynchronous calls; (17) Remote calls
There are not many specific problems. Each problem has some application scenarios. Each scenario can be implemented in several modes. Which variants of each mode are available? What are the advantages and disadvantages of the modes and variants ...... to understand whether it is easy to create objects, let's look at these situations:
(1) A hammer sale: Just new
(2) You are my only one: Singleton
(3) A thousand years and so on: Object pool, prototype, Cache
(4) Yan returned from deja vu: Yuan Xiang
(5) I have seen gof: factory, Abstract Factory
(6) do not ask where I came from: IOC
Details are also important in implementation. However, the so-called details involve a few points. The above-level implementation is nothing more than the UI, business, and data access layer. You can also add an integration layer. The UI is nothing more than the several modes, but mostly the template-based and control-oriented. There are also some main modes for pull in the business, and there are three main modes for data access. Ado. Net also has two usage modes. The database requires money, the database does not need money, and the database does not need money. The database has complicated and simple processes. Files include common files, indexed files, HTML files, XML files, and other files in specific formats. How can this problem be solved.
Iii. MSF experience
Software Process Control mainly solves some problems. Tradeoff is the only thing that I learned from MSF in code, bug, requirement, document, communication, release, and risk ). The most valuable idea of MSF should be trade-offs. What the purpose is to achieve, what to give, what to choose, and what to give up. I did some research on MSF for a long time two years ago and wrote a case Article (put it in a database on the Internet and watch it for money ). In the past, software was mainly used for industrial purposes, and stability was very important, so the program was too old. In early 1990s, software applications transitioned from the industrial field to the general application field. Functions and availability became very important, and stability was not valued. Windows stood out. The first version of MSF was developed in those years. From that point on, Microsoft's trade-off basically gave priority to the progress over the function, and the function over stability and security. Recently, Microsoft's trade-off has changed, and stability and security ranks first. That year, the background was that the development team of Microsoft had become larger, and the development management was a bit messy. As a result, Microsoft organized a group of experts, summed up the experience in the development process, and formed the first version of MSF. With the development of the times, MSF has gradually evolved into the current version. The current MSF is promoted to the outside world as a process method by Microsoft. In my opinion, MSF is first a summary of Microsoft's successful experience, and secondly a process method that can be referenced. MSF teaches you how to successfully develop software products, rather than how to meet project requirements. Moreover, MSF is not universal. There is a book called "Adaptive Software Development", which is actually the best interpretation of MSF. The book is thoroughly analyzed only in what organizations apply this method.
Iv. Four Methods
To sum up, we may find these four useful methods:
Apprenticeship: the first-hand materials are the most reliable and case-based learning. Let's look at the source code and the existing solutions. It's okay to write more code.
Internet influence: learn more about several solutions to the same problem. You can only learn one kind of software, a solution, or a design pattern that is easy to understand without comparison. If time permits, try different solutions.
Ding Jie Niu: When you get something, you have two knives at the vertical angle, divided into horizontal ribs and vertical spine, and the rest are flesh and blood. It is useful for the vast majority of OO software. Not practical, it's not your problem, it's a problem with software writing. You can try the software you have written if you have nothing to do.
Xingxingda method: Any software has historical problems and any method has historical problems. The software should be compatible, and the company should publicize it, so many things are not what it looks like .. Net is so powerful to the underlying layer, these are historical issues. So, to learn about something, we 'd better go through several versions to see what happened during the Software Evolution and what the background of these stories is. Every story means trade-off, you can learn a lot of software design knowledge from the middle. This learning is equivalent to taking others' practical experience as your own. Another significance of doing so is to cultivate your ability to predict technology, which is a great advantage if you look more than others.
5. Code Reading Skills
For Oo, generally a 500 ~ 1000 class libraries/software, the main class or interface is about 10 ~ About 20. Generally, these classes constitute a hierarchy. each layer has a lot of sub-classes/implementations for these classes or interfaces. about several hundred. the remaining classes are basically tool classes, helper classes, and classes for getting specific resources. the first step should be to find these main classes and interfaces, find out the main call process, and understand this process. in this way, we will almost understand how the software/library works. the second step is to look at these main classes, interface inheritance/implementation, so that you can understand what the software/library can do and how to expand. in this way, the number of M code can be 2 ~ Make it clear in 3 days.
the main difficulty of reading the Code is that the amount of code is too large, but oo greatly reduces the difficulty of reading the code. Good OO software can see the namespace, Class Name, the method name knows what to do (this intuition can be formed after reading a lot of code) and you don't have to read the specific code. reading is much easier with tools: You can use reverse engineering to obtain the class diagram and the sequence diagram of the main call process. The reading of these two diagrams is almost the same. ndoc, Visio, doxygen, and even word are useful auxiliary tools. You can't understand the code. this is probably the skeleton of the software. In addition, each software may involve one or two core algorithms or its unique data abstraction (Data Structure) to implement certain standards or known algorithms, now let's take a look at these specifications or known algorithms and quickly understand them with the code. in addition, there are some detailed knowledge scattered in those helper classes. After learning about the skeleton, there is probably a bottom for these things, but it cannot be determined accurately. at this time, Google will show you how to use it. What are the precautions. read the Code. If the order is incorrect, add the first part to these details. the master of the main process and the master of the level is the first. the second step is understanding of the design model. there are also a lot of non-OO software. Using this method is also very easy to read. for example, read the protocol stack code and move around with a package. in an enterprise, a single order is circled. these are very effective methods to deal with complex systems. in OO, I just followed the method. select a method and follow it. if this method is well selected, the software/database will be transferred in this circle. in this process, we may encounter dozens of objects, hundreds of method calls, and even understand them. however, the reading Main Line cannot be messy.