001_GUI program Principle Analysis

First, the command-line application

Features command-line applications (Command Line Interface)

1, is based on the structure of the executable program sequence.
2, during program execution and does not require user interaction occurs.
3, after the program execution to give the final results of the operation.

Run mode command-line application


Features: Run the program has a fixed beginning and a fixed end.
This programming method is a process-oriented programming method: a big problem into a variety of small problems, small problems will then one by one break, then the whole big problem will be solved.

Applicable scene command-line application

1, single-task applications
2, no interaction or simple interaction occasions
3, server applications (as command-line application system resources to run its own occupied is relatively small)

Example: ls corresponding application is a command-line application, when a carriage return after typing ls lists the directory and files inside this process and we will not have any user interaction. ls command-line application, once started, then it is bound to complete a single task, when it lists the files and folders on the initiative to quit.

Second, the graphical interface application

Graphical interface features of the application (Graphic User Interface)

1, is based on a message-driven model executable.
2, program execution depends on the user interaction.
3, during program execution in response to a user operation in real time.
4, under normal circumstances will not take the initiative to withdraw from the program after execution.

Run mode GUI applications

Message processing model of GUI applications


To the average user will need to use a computer operating system, when the operating system is installed after the hardware above, ordinary users can use the computer.
User's operation is mainly divided into two categories, namely, mouse and keyboard. When the user operates a computer, the operating system kernel will detect the user's operating system kernel will generate a system message to the user according to the current operation, then sent to a focus put this application system messages.
For graphical applications, each application has a message queue, the message is to be thrown into the system message queue currently has the focus in the application, and message queue inside the cycle will be taken out of the system messages, It will call the message processing function after taken out. So our GUI applications which must write a message processing function for processing the corresponding message.
For example: In notepad this GUI application program, after which the message will be in response to keyboard interface to print characters above, it is possible to infer the programming GUI applications most of the time is to write a function to deal with system messages.

GUI applications application scenarios

1, where multitasking
2, strong user interaction occasions
3, non-professional computer user

Example: GUI applications are often powerful feature set with a variety of functions, such as powerpoint can write text, draw graphics, can be programmed, the current slide can also store other file formats.

Third, the summary

GUI applications and command-line application is a complementary relationship, contemporary architecture among large software products, we will use both. Command-line application due to the characteristics of a single task, it can be used to develop back-office applications; GUI applications due looked like a good-looking, its user interaction is better, so used to develop the user interface.

 

Guess you like

Origin www.cnblogs.com/luosir520/p/11615928.html