Difference between event-driven and command line programming

Peoples use computers for different tasks. To do this task, computers need information and instructions on how to do that. So, to do tasks, the process of creating a set of instructions that tell a computer how to perform a task is called programming. Also, there is a barrier between the languages, because the computer (processor) only understands binary. But people are not familiar with these binary codes. To avoid this problem today people, use high-level languages which familiar to human languages for programming, and compilers or assemblers convert those programs to low-level languages which can understand computer processors. Nowadays there are a lot of programming languages such as java, c, and python. Also, there are a lot of programming paradigms to make a program and there are many types of the User interface to make between the user and the system.

Command line programming

command line programming is the oldest way of programming between event-driven programming and command line programming. These programs run on a command line interface (CLI). A shell is also referred to as CLI. Command line interface communication between a user and a computer that is based solely on textual input and output. These programs take commands via keyboard and then execute. Nowadays most programs GUI based but command line programming is still in use. In command line programming, the flow of program execution was determined by the programmer, and controlled from within the application’s main routine.

Command Line Interface. Source — https://upload.wikimedia.org/wikipedia/commons/7/79/IBM_PC_DOS_1.0_screenshot.jpg
Command Line Interface. Image source- https://upload.wikimedia.org/wikipedia/commons/7/79/IBM_PC_DOS_1.0_screenshot.jpg

Event-driven programming

in event-driven programming, the flow of program execution is determined by events. These events can be a user action such as a mouse click, or key press from a keyboard. Also, an event can be a message from another program or operating system. These programs detect those events and deal with them using a pre-defined event-handling procedure. Normally for event-driven programming use GUI. In a GUI there are buttons, labels, text boxes, menus, etc. So, program flow depends on user action on that kind of object. But not only GUI, early command-line environments such as DOS, and embedded systems (where the application is implemented as firmware) had event-driven programming. Event-driven programs can be written in any programming language and some of specifically designed for event-driven programming by providing an integrated development environment (IDE) that partially automates the production of code, and built-in objects. object-oriented concepts used for this event-driven programming.

How to works Event-driven program. Image source — https://textbooks.cs.ksu.edu/cc410/ii-gui/11-event-driven-programming/02-gui-threads/embed.html

The difference between event-driven programming and command line programming

summery of the Difference between event-driven and command line programming



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store