Lightning App Event Handling :

App event is used to communicate between any dom containment unlike parent child way.
Using this approach , an event can be communicated between component parent -> child or child to parent sibling or child sibling to parent sibling etc

Event Firing for Component Event works by firing the event and all event handler registered can have access to it


In lightning component event handling invovles registering events and handling events

Event Firing :
Declare event 

<aura:registerEvent name="any event name" type="c: Event created name"/>

Then fire this event in js :
var appEvent = $A.get("e.shivalight:DemoEmptyAppEvent"); 
// access the app event using event source name , here shivalight is my namespace
appEvent.setParams({});
appEvent.fire();

Event Handling :

Register handler can handle the app event fired from any of the component loaded at that time


<aura:handler name="event handle name " event="c: Event name"
    action="{!c. handler action name }"  />

Name - name doesnt matter for app event
action - action should be the same action method present in the handler component
event - must match the same type as the event that fired


The below program shows an hello world for Component event handling and firing

Create the Lightning Event as below  and save it as DemoEmptyAppEvent

<aura:event type="APPLICATION" description="Event template" >
</aura:event>

Create Lightning Component and name it as EventHandlingParent_AppType_Cmp

<!--
 * created by 		:		Shiva RV
 * Date				:		13-10-2018
 * Description		:		Hello World Comp Event Handling Parent
  
-->
<aura:component >
    <!-- For Application Event , handler name is not required
	 -->
	<aura:handler  event="c:DemoEmptyAppEvent"
    action="{!c.handleAppEvent}"  />
    
    <!-- place the child component so as to make the event fire happening -->
	<c:EventFiringChild_AppType></c:EventFiringChild_AppType>
</aura:component>
EventHandlingParent_AppType_Cmp Js Controller Code:
({
	handleAppEvent : function(component, event, helper) {
		alert("congrats , we have captured the App event ");
	}
})

Create Lightning Component and name it as EventHandlingParent_AppType
Note that the child component is instantiated in parent and onclick of the childcomponent button ,an event is fired

<!--


 * created by 		:		Shiva RV
 * Date				:		13-10-2018
 * Description		:		Hello World App Event Firing Child
  
-->

<aura:component >
    <!-- Register Event in the component which fires the event 
	for app event name of the registerEvent doesn't matter
	-->
    <aura:registerEvent name="DemoAppEvent" type="c:DemoEmptyAppEvent"/>

	<lightning:button label = "Fire App Event" variant="brand" onclick = "{!c.handleClick}" />

</aura:component>
EventHandlingChild_AppType Js Controller Code:
({
	handleClick : function(component, event, helper) {
       	//use the actual event file name for app event in js
		var appEvent = $A.get("e.shivalight:DemoEmptyAppEvent");
        //better to set empty param attribute's even though the event has no attributes
        appEvent.setParams({});
        console.log("App event is fired ");
		appEvent.fire();
	}
})
Below is the hello world App code:
<!--


 * created by 		:		Shiva RV
 * Date				:		13-10-2018
 * Description		:		Hello World Lighting App
  
-->

<aura:application extends="force:slds">
  <!-- App Event Firing  and handling Eg -->
   <c:EventHandlingParent_AppType></c:EventHandlingParent_AppType>
</aura:application>
Output:

Key Notes :
*Always try to use component Event whenever possible instead of application event
*When component event doesn't suit the requirement , go for the application event approach
*Indept understanding of the handler concepts will be explained later