Basic software development skills

Source: Internet
Author: User

Basic software development skills: How to program better and faster

-- Read "programming pearl I:

 

 

Program. program better. program faster.

To engage in software development, you must first learn programming. How to program? How to write more efficient and elegant programs? Through simple and familiar examples, "programming Pearl" reveals many very useful programming principles and techniques, which are very enlightening.

 

Basic Process:

Problem definition-application framework and interface design-select an appropriate data structure and efficient algorithms (objects and messages) -- Performance estimation -- interface declaration -- pseudocode -- program verification -- code -- test and debugging -- [code optimization] -- code review and review.

 

Problem definition: Win at the starting point. A clear description and definition of the problem determine almost half of the success. As a solution to a problem, how to correctly understand the problem and from which perspective to think about the problem often produces a world of different results. As a software development, "what is done and what is not done" should be the basic principle. Everyone expects to develop software with strong performance and multiple talents, but not everyone can afford such R & D costs (time, money, and manpower ). Appropriate trade-offs and trade-offs must be made between costs and the final products that can be obtained.

After a good abstraction of the problem, it is easier to obtain reusable problem solutions. For example, in chapter 12th of programming pearl I, the sampling problem is abstracted from the random selection list to the question of "randomly extracting M ordered integers from N integers, the solution can also be used for sampling problems in other fields.

 

Application Framework and interface design: After clarifying the goal of solving the problem, you must think about how to solve the problem. There is usually a preliminary idea, and then gradually forms the entire mature solution and application framework. At the same time, well-defined interface design is also critical. On the interface, it is implemented by the interface service application. Under the interface, it is used to provide the implementation of the data structure and algorithm of the interface service.

 

Data structures and algorithms: You can write programs by mastering a language. data structures and algorithms can help you write more powerful programs. I read "programming Pearl" and found that the root of a computer program is Data Structure + algorithm. Data structures and algorithms are usually critical to estimating and improving the expected performance of the system.

Objects and messages are actually encapsulation of data structures and algorithms. In an object-oriented program, each class is a carrier of the "Small Data Structure" and "small algorithm" bound together and provides its own services through interfaces. Each object is a state carrier, state changes are used to characterize system changes, so as to realize the features and functions of the system.

Data structure plays an important role. Sometimes, complex logic can be greatly simplified with certain data views, such as date computing. Important data tools mentioned in programming pearl I include hypertext, value-pairs, dictionaries, databases, tables, templates, and so on.

 

Performance Estimation: Generally, the system performance may be roughly understood through the large O analysis of the algorithm. In addition, a certain rough estimation capability is also necessary (see chapter 7 of programming ): common sense, key parameters, empirical rules, dimensional test, and safety factor.

 

Interface Declaration: Involves system design. Which data structures (or objects) are composed of the system, and how they interact (functions, messages) to complete system functions; define the declaration of each interface (function description, parameter list, return value, precondition, and post condition) carefully, and enable good collaboration.

 

Pseudocode: Do not rush to programming. Use pseudocode to express ideas and outline the general framework of the program. This often makes the idea clearer: In this process, we can usually find out which sub-functions of the system are to be implemented, which is conducive to modularization.

 

Program Verification: Can you ensure that your programs are correct at any time? Or is it true only within your sight? Is the program you want to write only true? Of course, we all hope to be able to finish the work early. However, we are not in a hurry, so we are too lazy. Learning a certain degree of procedural verification technology is also beneficial and harmless. Although it may be a little troublesome at first, it won't feel like it after a while. Everything is hard at the beginning. It's good to go through the commit.

Common Methods for program verification: loop-free and assertion. This is actually a technology established based on three control flows.

 

Encoding: Finally, you can write the program. I'm afraid that after the above-mentioned tossing, the interest in programming has long been reduced. However, everything is to make the code smoother and more creative. We do not expect to find that the encoding is in ctrl + C/V; when the encoding reaches a certain level, the shell is suddenly stuck; suddenly we find that there is a problem with the idea; suddenly we find that the performance cannot meet our expectations; I suddenly found that all my previous efforts were in vain?

Many people complain that there is no creativity in coding at work, but have you ever thought about how to write programs more creatively? Do you expect that creativity will automatically come to you? If you don't try to use algorithms and data structures, will they automatically come to you and ask you to use them? If you don't take the initiative to think and discover, do you expect a miracle to automatically come?

When coding, we try our best to follow good code specifications to make it readable and lay a good foundation for code review and review.

 

Testing and debugging: How can we get a trustworthy and reusable program? Rigorous and thorough testing. Don't be in trouble. Just get used to everything. Write automated tests and use assertions for debugging.

Program testing can be divided into two types: Automated Testing and manual testing. Automated tests can be built for small datasets ranging from 0 to 10. Manual Tests must also be built to allow testing in special cases.

 

Code optimization: Code optimization usually means a slight improvement in performance. The principle of application Caching usually requires a deep understanding of computer components and operating systems. Code optimization usually reduces program reliability, readability, and maintainability, and increases Program Complexity. Therefore, proceed with caution.

 

Code review and review: Without summarization, there will be no progress; "drop if code is written" cannot be expected to make progress. Code review and review further improve code quality: availability, readability, scalability, portability, security, and reliability.

 

Others:

 

Big dataset processing problems: Beginners may usually consider processing small Datasets within 1-100, but entering the field of software development, big dataset processing, and massive data processing has become an issue that must be considered. For sorting problems, when n is less than 50, insertion sorting may be used. But when n is equal to millions or tens of millions, insertion sorting cannot be used. This shows that the solutions for small datasets and big datasets are often quite different.

 

Utilities and toolbox: Excellent craftsman will spare their favorite toolbox. Programmers are no exception. Beginners may mainly focus on programming exercises. However, after entering a certain stage, they must consider writing highly practical tools and programs, rather than staying at the level of toys.

Standard Library; utilities; familiar ide; open-source gadgets; common data structures; algorithm technology; Regular Expressions; database usage; programming technology; programming skills; design ideas; problem solving solutions; error recording.

 

Automated repetitive work: Always pay attention to the automation of repetitive work in daily life, and simplify it by writing utilities and tools. If the time is too late, you should try your best to make up later.

 

Changes in habits: Human nature is usually "can lie down without standing", therefore, cultivate a lot of bad habits. Programmers usually expect to be able to quickly compile programs that meet the functional requirements, and then run the program to check whether it is as expected, then they will lose sight of it. What is problem analysis and pseudocode? What program verification and testing? What code review and review? All to one side. The result is that you skipped one minute of test time, but it took nearly one hour of debugging time to compensate. Can this be done?

In fact, cultivating good habits is a very beneficial investment. As long as you stick to it for the first two months, it will become a natural thing. After that, you will just enjoy the benefits of good habits.

 

 

From programming to software development

 

In a sense, after understanding the professional knowledge of "data structure, algorithm technology, operating system, composition principle", coupled with the spirit of "Diligent Thinking, good at bottom-up, and a large number of programming practices, you can gradually master the basic principles and capabilities of programming.

After learning programming, you can read books about software architecture and understand how software is built. Databases and computer networks are actually the product of "programming principles + software architecture", but they can be used as components of a larger system.

Basic software development skills

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.