Sie sind auf Seite 1von 5

EVENT DRIVEN PROGRAMMING

It is a flow of program in which execution is determined by events. A user action, for


example when you click on the mouse and press any key from keyboard these action
causes events. Event driven programming is a paradigm to handle event driven run time
procedure and it is done through event handling procedure. Event driven programs can
be made in any programming language. Some languages are specifically designed for
event driven programming and can provide integrated development environment, which
provide automation of events by providing selection of built in objects and controls.
Visual Basic, Visual C++, and Java are examples of EDP.
Before OOP, event handles were operate with procedural program. Programming
determined the flow of the program and controlled through the application. It will
become a highly complex program, and to ensure that code handle all the events
appropriately. Programming has to make sure the flow of the execution properly.
The change occurs by the introduction of the GUI Graphical User Interface which has
widely adopted for event driven applications. One of the positive effects of OOP in the
early days is the speed and later it was adopted for commercial use.
Major idea behind OOP is the presentation of programmable entities into objects.

Events are often actions performed by the user during the execution of the program, but
can also be message generated by other operating systems or another application. If a
user clicks through the mouse, there will be a certain event which occurs on the
operating system. If there is a file which is downloading and after completion it show
certain event. Whether it is a software or hardware error it will show the event to the
user.
Event handles can be seen as small blocks of code that deals with a specific occurrence.
[1] Events usually are visual occurrence to inform user of certain anomaly or any kind of
function that produces output. An event handler can able to produce another event to
inform the user for certain function.
We will write a pseudo code to show the event to occur, which consists of a main loop
and run continuously until some terminating condition occurs.

do forever: // the main scheduler loop


get event from input stream
if event type == EndProgram:
quit // break out of event loop
else if event type == event_01:
call event-handler for event_01 with event parameters
else if event type == event_02:
call event-handler for event_02 with event parameters
.
.
.
else if event type == event_nn:
call event-handler for event_nn with event parameters
else handle unrecognized event // ignore or raise exception
end loop [1]

GUI PROGRAMMING
Every software application has some GUI which contains event driven programming
compulsory. Visual programming languages now come with Integrated Development
Environment IDE, so they all are compatible for serving the purpose of event driven
applications. There are two task of the event driven programmer, one is to produce a GUI
and effectively write the code for event-handler. Though he should also take care of the
flow of the event.

.NET FRAMEWORK
.NET is a Microsoft based development platform which provides a model for
programming an application and a comprehensive software infrastructure with various
tools and services to build up robust software application.

Core features of .NET framework are as follows:


1. Interoperability: Component Object Model or COM assists the development of
software application by using different languages. In .NET we can shuffle COM with
newer binaries and vice versa.
2. Support Programming Languages: Many languages can be supported by .NET.
3. Common Runtime Engine: It has a well defined set of types which .NET can
understand easily.
4. Complete Language Integration: .NET supports cross language platform
inheritance, debugging and exception handling.
5. Comprehensive Library: .NET provides simple structure for complex APIs.
6. Simplified Deployment Model: There is no need to register binary unit into the
registry of the system, this is one of the good feature of .NET framework.

Component of .NET Framework


1. Common Language Runtime or CLR: It has many functions which includes,
exception handling, thread execution, verification, code execution, memory
management, debugging, security checking, and compilation. A code which was
directly managed by the CLR is known as managed code, when this code gets
compiled the compiler converts the source code into IL or intermediate language.
There is JIT or Just in Time compiler which then compiles the IL code into native
code, compatible with the CPU.
2. Class Library: A huge library in .NET which has reusable types of interfaces,
enumerated values, classes and structures, and are collectively called types.
3. Common Language Specification: It contains specification of .NET supported
languages.
4. Common Type System: It provides guideline for cross-language communication,
guideline for using and declaring, managing types at runtime.
5. Metadata and Assemblies: Information of the program which represents them in
binary form is known as metadata, which are stored in the memory. Logical unit
which contains manifest, IL code, metadata type is known as assembly.
6. Windows Form: it is graphical representation of the application.
7. ASP.NET & ASP.NET AJAX: ASP.NET is a web development model and AJAX is its
extension. AJAX helps to load the data without requiring re-loading the page.
8. ADO.NET: It is for database and its manipulation. It provides access to database of
almost every kind such as SQL server, OLE, DB, and XML etc.
9. Windows Workflow Foundation (WF): It is for workflow based applications. It
contains activities, runtime, design, and rules.
10.
Windows Presentation Foundation (WPF): It provides the boundary
between user interface and business logic to distinguish the application properly. It
will help in developing rich media interfaces and 3D graphics as well.

11.
Windows Communication Foundation (WCF): It is the technology used
for building and execution of connected systems.
12.
LINQ: It has the ability to communicate with data querying capabilities to
.NET languages. The syntax is quite similar to that of SQL.

EVENT HANDLING IN ASP.NET


As mentioned earlier, event is an action or an occurrence. For example, by clicking a
mouse, a key press, a movement of a mouse or any other notification generated by the
system. The whole process communicates through event. Events in ASP.NET are shown
or pop up in the client machine and are handled on the server. For example, when you
click a button in the browser, a click event is raised and browser handles the client side
event by posting it to the server.

Event Arguments
In ASP.NET, handler usually takes two parameters and return void. The first one is raising
the object which is event and the second is the parameter which is an event argument.
Syntax is as follow:
private void EventName (object sender, EventArgs e);

Application and Session Events


a. Application_Start: Raised when application or a website is started.
b. Application_End: Rasied when application or a website is stopped.
Similarly
a. Session_Start: Raised when the user first request the page from application.
b. Session_End: Raised when the session ends.

Page and Control Events


a.
b.
c.
d.
e.
f.

DataBinding: Raised whenever we binds a control with data.


Disposed: Raised when the page or control is released.
Error: Occurs when unhandled exception thrown.
Init: Raised when the control is initialized.
Load: Raised when page is loaded or control is loaded.
Unload: Raised when page or control is unloaded from memomry.

REFERENCES
[1]. Event Driven Application. Available on website:
http://www.technologyuk.net/computing/software_development/event_driven_programmi
ng.shtml
[2]. DotNET Infrastructure. Available on website:
http://www.codeproject.com/Articles/467118/DotNet-Infrastructure

Das könnte Ihnen auch gefallen