Current location - Recipe Complete Network - Complete cookbook - How can I write a program and what is needed?
How can I write a program and what is needed?

Simply put, programming is the process of using a certain programming language to write program code in order to achieve a certain purpose or solve a certain problem with the help of a computer, and finally obtain the result.

Although computers are very powerful. It can allow you to surf the Internet, play games, manage company personnel relations, etc., but without programs, it is equivalent to a pile of scrap metal and will not pay attention to the "orders" we give it. Therefore, we have to tame it through only one way - program. This is also the only way for us to communicate with the computer.

So what exactly is the program?

A program is a collection of instructions that tells the computer how to perform a specific task.

For example, it is like a recipe that guides you to cook a dish or a traffic policeman (or traffic sign) that directs you to drive all the way to your destination. Without these special instructions, the intended task cannot be performed. The same goes for computers. When you want a computer to do something for you, the computer itself cannot actively work for us, so we must give it instructions, and it simply cannot and cannot understand human natural language about things. description, so we must use programs to tell the computer what to do and how to do it? Instructions are needed for even the simplest tasks, such as how to obtain a keystroke, how to place a letter on the screen, how to save a file to disk, and so on.

It’s so troublesome that you have to consider these things even when programming! No wonder people say programming is difficult! You are wrong. In fact, many such instructions are ready-made and included in the processing chip and built into the operating system, so we don’t have to worry about them working. They are all completed by the processor and operating system and do not require us to Intervene in these processes.

The computer mentioned above does not actively do anything by itself. Therefore, we have to use programs to make the computer "serve" for us. And this process is what we "made up". Programming can be implemented using a certain programming language, and the syntax of this language is used to describe what the computer is supposed to do.

The grammar we are talking about here is completely different from the grammar in foreign languages. The grammar we are talking about here is just to read your program writing and make some rules.

After you write the program, special software will interpret or translate your program into a "computer language" that the computer can recognize. Then the computer can "understand" your words and follow your instructions. Did your bidding. Therefore, programming is actually a process of "people giving rules to computers".

There are many types of computer languages. Generally speaking, they can be divided into three categories: machine language, assembly language, and high-level language.

Every action or step performed by the computer is executed according to a program that has been programmed in computer language. A program is a collection of instructions for the computer to execute, and all programs are processed using the language written in. Therefore, if people want to control the computer, they must issue commands to the computer through computer language.

The only language that computers can recognize is machine language, which is a code composed of. But usually when people program, they don't use machine language because it is very difficult to remember and recognize.

Currently, there are two common forms of programming languages: assembly language and high-level language.

The essence of assembly language is the same as machine language. They both operate directly on the hardware. However, the instructions use English abbreviated identifiers, which are easier to identify and remember. It also requires programmers to write out each specific operation in the form of commands.

Each instruction in the assembly program can only correspond to a very subtle action in the actual operation process, such as movement and increment. Therefore, assembly source programs are generally lengthy, complex, error-prone, and use assembly language Programming requires more computer expertise, but the advantages of assembly language are also obvious. The operations that can be done with assembly language are not possible with ordinary high-level languages. Moreover, the executable file generated by assembly of the source program is not only smaller, And it executes quickly.

High-level languages ??are currently the choice of most programmers. Compared with assembly language, it not only synthesizes many related machine instructions into a single instruction but also removes details related to specific operations but not related to completing the work, such as the use of stacks, registers, etc., thus greatly simplifying the instructions in the program. Since many details are omitted, programmers do not need to have much professional knowledge.

High-level language is mainly relative to assembly language. It does not refer to a specific language, but includes many programming languages, such as the currently popular VB, VC, FoxPro, Delphi, etc. , the syntax and command formats of these languages ??are different.

(1) Interpretation class: The execution method is similar to the "simultaneous translation" in our daily life. The application source code is "translated" into the target code (machine language) by the interpreter of the corresponding language. It is executed simultaneously, so the efficiency is relatively low, and it cannot generate an executable file that can be executed independently. The application cannot be separated from its interpreter, but this method is more flexible and can dynamically adjust and modify the application.

(2) Compilation class: Compilation refers to "translating" the program source code into target code (machine language) before the application source program is executed, so the target program can be executed independently from its language environment. , easier to use and more efficient. However, once the application needs to be modified, the source code must be modified first, and then recompiled to generate a new object file (*.OBJ) before it can be executed. There is only an object file but no source code, making modification very inconvenient. Most of the programming languages ????now are compiled, such as Visual Basic, Visual C++, Visual Foxpro, Delphi, etc.

This question is actually very simple. We mentioned earlier that programs are the only way for humans to communicate with computers. Therefore, if we want computers to serve us, we must have programs. Where do programs come from? Of course they are written by us. Maybe you will ask another question: What kind of programs are there now? Why should I program? You are wrong. Although there are many programs now, it doesn’t take long to put what kind of programs you need directly online. It takes time to find something similar, and it might be just what you need. However, it's like buying clothes. Although clothes are sold everywhere, which one is "tailor-made" for you?

Programs can also do many things. Different programs can accomplish different things. From the big aspects to managing the country's finances, to the small aspects of managing the family's accounts.

For another example, if you want your computer to play animations, then your computer must also have a corresponding animation player program. What is shown below is an F1ssh animation player. We will describe the preparation process of this program in detail in the following chapters.

With the rapid development of computers, there will always be a day when people who cannot program will be classified as "illiterates". You don’t want to, right? Then learn a programming language.

Will programming become obsolete?

Will programming become obsolete? Let me ask you a question first: Will computers disappear? The answer is the same for both. If you know whether computers will disappear, you will know whether programming will become obsolete.

Programming tools will become obsolete, but programming will never become obsolete

Computer systems are composed of visible hardware systems and invisible software systems. For a computer to work normally, it is not enough to have a hardware system alone. A computer without a software system (that is, without a program) can be said to be just a pile of scrap metal, unable to do anything. For example, when you write an article, you need to use text editing software in the operating system to input text. But without these text input software, have you ever thought about how to input an article into the computer? It is difficult to imagine. Show how to input text on a computer without any software (we call it a bare machine). These software are actually what we usually call programs.

Will programming become obsolete? Let’s think about this problem from another angle. Will computers disappear? If one day when computers are no longer needed to process everything in the world, then computers will will soon disappear, when programming will not only become obsolete, but will disappear with it. But will computers disappear? Of course not. Today, computers are used in every field and have made immeasurable contributions to the development of mankind. Just imagine what the world would look like if one day all the computers in the world suddenly disappeared. It might be as scary as if the whole world had a power outage, and there would even be greater losses. The existence of computers must be maintained by software systems. Therefore programming will never and cannot become obsolete.

Computer programming languages ??have developed to this day, from the most primitive machine language to today's visual integrated development environment, and even integrate multiple languages ????on the same development platform, such as Microsoft's NET platform. Looking back at the development history of programming languages, it is not difficult to see that for programming, only programming tools will become obsolete, and programming itself will not become obsolete.

Changing technologies require ever-changing programmers

Since the 1960s, computers have developed by leaps and bounds. It seems that no science in history has developed faster than the development of computers. Regardless of hardware, software, or networks, they are all advancing at an alarming rate. The development speed of computer hardware follows "Moore's Law" and the speed doubles every eighteen months (actually it has now exceeded this speed). Software develops at the same speed as hardware. China's software industry was not very mature in the 1990s, but now software companies of all sizes are standing everywhere, and shared software can be seen everywhere on the Internet.

The ever-evolving technology requires ever-changing programmers. For example, Visual Basic can now quickly construct applications under Windows. Programming technology is constantly developing, and new concepts and methods are constantly being introduced, such as from structured C At first, when the object-oriented idea was proposed, C++ appeared. Based on C++, Microsoft launched Visual C++ to make it more convenient for users to build win32 applications. This also requires programmers to constantly update their technology.

Computer science is very different from other disciplines. Unlike linguistics and history, it is almost permanent. Computer science requires you to constantly update your knowledge, otherwise you will soon be eliminated, even for programming.

Writing programs is a very interesting thing, because you can do many advanced things by writing programs. For example, in the following chapters we will introduce how to use Visual Basic to write a Flash animation player, and how to write a download software manager, etc. If you want, you can write more advanced programs than these.

With the development of the computer software industry, the position of "programmer" was born. So a concept was formed that the person who writes the program is the programmer, so programming is a matter for programmers. But programmers are not programmers at the beginning, they also slowly become programmers from where we are now.

Writing programs is a very interesting thing, because you can do many advanced things by writing programs. For example, in the following chapters we will introduce how to use Visual Basic to write a Flash animation player, and how to write a download software manager, etc. If you want, you can write more advanced programs than these.

Programming can also be regarded as a hobby or interest. If you are interested in it, it will be much easier to learn! Because if you are interested in programming, you will read more books and learn more about it. Compiling some small programs to practice on the computer is very helpful for learning programming, and as the learning process continues to advance, you will find that it is not very difficult, on the contrary, it is very easy.

In short, you must be persistent when learning programming. As long as you have confidence and perseverance, you will be able to learn it well; you cannot shake your confidence because of some specious concepts.

Let’s program together

Faced with how to operate the computer in front of us, I believe this problem is no longer the primary issue that troubles everyone. There are so many types of software now. When choosing one, do "computer enthusiasts" also think that one day they can write their own software? Do friends who want to learn programming choose a programming language because they don't know? How to choose and feel a headache? When you don’t know how to start, will your friends have the thought of "Can I program?" But which programmer can succeed without learning! In fact, writing programs is not as difficult or complicated as people think. Everyone who is committed to learning computers can try it!

The necessity of choosing a programming language that suits you

There are many types of basic programming languages ??commonly used at present, the simpler ones include: Pascal, c language, qBasic, Fortran, Visual Basic, etc. But the first few are tools for programming under DOS. Visual Basic is a programming tool for application design under Windows. Nowadays, most computer users no longer use DOS, so we usually choose Visual Basic as the initial tool. Programming tools for academics. Visual Basic is the easiest programming tool to use in Windows application design, and the learning steps are also relatively easy for beginners to accept. For beginners who are just starting to learn programming, it is better to choose Visual Basic. You cannot imagine that you can reach the sky in one step when learning a programming language. Learning step by step is the best way.

Strengthen your confidence in learning to write programs

Writing programs is not a patent only for those with professional knowledge. Everyone who studies computers can write programs, and everyone’s inspiration Different, there are differences in the ideas and methods of writing programs. But the same idea is to write successful programs. Learning to program is a long process that requires hard work and sweat, but the joy of success is something that others cannot experience. Overcome difficulties in learning, work hard to practice, and have the thought that you can do what others can do. The popularization of computers has given more people the opportunity to learn, and also allowed more people to participate in the ranks of programmers. Everyone has the right to program, and opportunities are given to everyone equally. Be confident that you will win, be brave and enterprising in the field of programming, and believe that success will be around the corner.

3. Can I program?

With the development of the computer software industry, the position of "programmer" was born.

So a concept was formed that the person who writes the program is the programmer, so programming is a matter for programmers. But programmers are not programmers at the beginning, they also slowly become programmers from where we are now.

Writing programs is a very interesting thing, because writing programs can do many advanced things. For example, in the following chapters we will introduce how to use Visual Basic to write a Flash animation player, and how to write a download software manager, etc. If you want, you can write more advanced programs than these.

Programming can also be regarded as a hobby or interest. If you are interested in it, it will be much easier to learn! Because if you are interested in programming, you will read more books and more about it. Compiling some small programs to practice on the computer is very helpful for learning programming, and as the learning process continues to advance, you will find that it is not very difficult, on the contrary, it is very easy.

In short, you must be persistent when learning programming. As long as you have confidence and perseverance, you will be able to learn it well; you cannot shake your confidence because of some specious concepts.

4. Let’s program together

Faced with how to operate the computer in front of us, I believe this problem is no longer the primary issue that troubles everyone. There are so many types of software now. When choosing one, do "computer enthusiasts" also think that one day they can write their own software? Do friends who want to learn programming choose a programming language because they don't know? How to choose and feel a headache? When you don’t know how to start, will your friends have the thought of "Can I program?" But which programmer can succeed without learning! In fact, writing programs is not as difficult or complicated as people think. Everyone who is committed to learning computers can try it!

The necessity of choosing a programming language that suits you

There are many types of basic programming languages ??commonly used at present, the simpler ones include: Pascal, c language, qBasic, Fortran, Visual Basic, etc. But the first few are tools for programming under DOS. Visual Basic is a programming tool for application design under Windows. Nowadays, most computer users no longer use DOS, so we usually choose Visual Basic as the initial tool. Programming tools for academics. Visual Basic is the easiest programming tool to use in Windows application design, and the learning steps are also relatively easy for beginners to accept. For beginners who are just starting to learn programming, it is better to choose Visual Basic. You cannot imagine that you can reach the sky in one step when learning a programming language. Learning step by step is the best way.

Strengthen your confidence in learning to write programs

Writing programs is not a patent reserved only for those with professional knowledge. Everyone who studies computers can write programs, and everyone’s inspiration Different, there are differences in the ideas and methods of writing programs. But the same idea is to write successful programs. Learning to program is a long process that requires hard work and sweat, but the joy of success is something that others cannot experience. Overcome difficulties in learning, work hard to practice, and have the thought that you can do what others can do. The popularization of computers has given more people the opportunity to learn, and also allowed more people to participate in the ranks of programmers. Everyone has the right to program, and opportunities are given to everyone equally. Be confident that you will win, be brave and enterprising in the field of programming, and believe that success will be around the corner.

1. The Development Process of Computer Languages

So far, there are thousands of programming languages ??published in the world, and there are more than 30 commonly used ones. In order to have 21 For the correct selection and use of them, let's give a brief introduction below.

(1) Assembly language:

It is a language that depends on the specific computer. Programs written with it have high execution efficiency, but only in some special requirements or special occasions. Just use it.

(2) High-level language:

Everyone may have heard of using high-level language for programming, but because they don’t understand it, they always think that these are very advanced things. In fact, this is not the case. After studying the following chapters, I believe students will realize that programming is nothing more than this.

But computers do not understand natural language (which can be understood as high-level language), and how can a computer execute a program designed in a high-level language? It is actually very simple. I believe you will understand after reading the picture below. many.

Now we will introduce you to several common high-level languages:

Fortran language is the main programming language used in scientific and engineering computing. Currently, most of the versions used in China are Fortran 66 and Fortran77. The main disadvantage of the Fortran language is that it does not directly support structured programming.

Cob0l language is a widely used language in business data processing.

Due to its structural characteristics, it can effectively support a wide range of process technologies related to commercial processing. Its disadvantage is that it is not concise.

The Algol language is the forerunner of all structured languages, with rich procedures and data structures. However, this language has not been widely adopted, mainly due to its own historical reasons.

Basic language is a conversational language that is interpreted and executed. Because of its simplicity and ease of learning, it is widely used in microcomputer systems.

PL//1 language is a widely used language. It can support common scientific engineering and commercial applications, and can describe complex data structures, multi-task processing, complex input and output and table processing, etc.

The Pascal language is a structured programming language developed in the early 1970s and has a particularly rich range of data structure types. Since its advent, it has been praised by everyone and widely supported by software developers. The Pascal language has been used in science, engineering, and systems programming. Our Computer Professional Education Conference of the Ministry of Education once designated Pascal language as a professional computer programming language.

C language is the main language used as the UNIX operating system. Due to the success of the UNIX operating system, the C language is now widely used. The C language was designed by experienced software engineers and has strong functionality as well as a high degree of flexibility. Like other structured languages, it can provide rich data types, widely used pointers, and a rich set of operators for calculation and data processing.

The C++ language is an extension of the C language. In 1980, Dr. Bjarne Strotstrup and his colleagues at Bell Labs began to improve and expand the C language. It was initially called "C with classes" and was named C++ in 1983. As well as continuous improvement and development, it has become the current C++ language. On the one hand, it takes the C language as its subset, making it compatible with the C language. On the other hand, many C language codes can be used by C++ language without modification, and many library functions and practical software written in C language can be directly used in C++ language. The C++ language supports object-oriented programming, which is its most important improvement to the C language.