Difference between event-driven and command line programming

 Event Driven programming 

Event driven programming is a programming paradigm in which the flow of program execution is determined by events.

Example A user action such as a mouse click , key press , or a message from the operating system or another program.

Event-driven programs can be written in any programming language, although some languages (eg Visual Basic) are designed to facilitate event-driven programming, examples being Visual Basic, Visual C++, and Java.

How event driven programming works.

when you perform an action on a graphical component you generate an event. in event driven programming the program responds to events. the program responds to events that the user generates in interacting with GUI components. the order of events is controlled by the user.



command line programming

Command line programming is a programming paradigm that uses a linear top-down approach while executing instructions sequentially. This is one of the first programming paradigms a new developer will have to learn 

A command line program is a program that operates from the command line or from a shell. A program is a sequence of instructions that are understandable by a computer's CPU (central processing unit) and that indicate which operations the computer should perform on a set of data.

command line interface "CMD" programmers use a command line interface (CLI) to issue text commands to the operating system (OS) , instead of clicking on a graphical user interface (GUI) . this is because command line interface is much powerful and flexible than the graphical user interface.


Difference between event-driven and command line programming

The most obvious distinction between the two is that a procedural program typically runs in the console or command line . event driven programming is necessary when you want a graphical user interface where  a user can click on buttons , menus and so on. in event-driven programming, a graphical user interface is provided. Typically, a visual programming IDE provides most of the code for detecting events automatically when a new program is created. Hence, the programmer can focus on interface design. But in command line programming a character user interface is provided to write the commands. After the completion of the user interface, the programmer can work with event-handling code. Typically an event-driven program focuses on selecting the user interface whereas a command line program focuses on sequential step execution.

in an event-driven program, actions are defined by certain events such as keyboard strokes or mouse clicking. However, in a command line program commands are written linearly and executed linearly. Event-driven programs can acquire single instances of events such as keyboard strokes or mouse clicks to run a program. This means that the user doesn’t have to worry about the internal process required to accomplish a task. Rather initiating the events is enough. However, in command line programming, the user needs to specify every instruction to run a program since command line programs don’t accept external instructions once they are executed.




CLI-Command line interface

GUI- Graphical user interface




Difference between CLI and GUI

   BASIS                               CLI                                                                            GUI

1) Definition   interaction is by typing commands  | interaction with devices is by graphic and visual components and icon                                                                                                                      

2)understanding   commands need to be memorized       visual indicators and icons are easy to    understand                                                                                                                                                     

3) working speed |   use of keyboard for commands makes |      use of mouse for interface make it slow CLI quicker                                  

4)resources used  |   only keyboard                                            mouse and keyboard both can be used

5) accuracy         |      high                                                    |            comparatively low     



Distinction of GUI and command line Operating System.

GUI                                                                                      Command line

makes use of emerging software/and hardware             Hardly makes use a emerging hardware/software    technologies                                                                                   technologies

Their interface have                                                               Their interface have

-ribbons                                                                                      -typed commands

-control buttons                                                                         - prompt

- menus                                                                                     -editor window

The user interface                                                         users interact by typing in commands

-clicking

-scrolling

-mouse over

more user friendly                                                                less user friendly





Comments