Monday, 17 November 2014

Key Features of Event Driven Programs. (P1)

Key Features of Event Driven Programs.


  1. Service orientated.
  2. Time driven.
  3. Event handlers.
  4. Trigger functions.
  5. Events (e.g. mouse, keyboard, user interface.
  6. Predefined functions.
  7. Local variables.
  8. Global variables.
  9. Parameter passing.
  10. Modularity.
  11. Procedures.
  12. Programming libraries.
  13. Event driven programming paradigm for simplicity of programming and ease of development.
  14. Include two example programming languages as examples.


A: Service orientated programs are programs are used by many things such as phones, computers and tablets, These are in place to satisfy the users requirements, For e.g. if i wanted to wake up at 7 Am i could set an alarm on my phone for 7 Am to wake me up. Likewise if i wanted to access the home on my phone i would click a button to take me to the home page in response a service has been provided which has taken me back to the homepage.

B:  Time driven programming is known as a programming paradigm, where the control flow of the computer program is driven by a clock.  This method is often used in real time computing. In event driven programming the time driven feature uses a specific code on a timely basis such as once an hour or once a month therefore this means it is pre-set to do tasks on time. An e.g. of this can be your operating system which will check for updates using time such as an update once a month. 

C: An event handler is a subset of a computer program that executes a specific event when a trigger is activated. Subset means “Being part of a larger group of related things” An example of this is if I clicked on the start button on my computer codes which relate to that very button will be activated.

D: The majority of event driven programming languages use trigger functions to choose which event handler needs be responsible for which event has occurred.  Every object has its own trigger function. In other words in event driven programming trigger functions are mechanism that decide what code to run at a specific event which can occur. For e.g. when you click an application and it sends a signal to open it.

E: There are many types of events firstly mouse events, moving a mouse in a certain direction will cause the cursor to react by responding to the movements. The left and right click buttons and the scroll all have triggers that are specific and event tied to them. Keyboard events, Pressing any key on the keyboard will have some sort of response for e.g. if you press the letter “A” then the display may display the letter “A” but whilst your playing a game pressing “A” may make your character jump. 

F:pre-defined functions, Predefined functions are methods which are already defined or in other word are built in the library of the program your using. For e.g. java have many pre-defined functions. I will give a few examples….
String sName;
SName = sName.toUpperCase ();
This is a pre-defined function within java as it is automatically tells the program to put the text into uppercase letters. This phase is already built into java therefore it is a pre-defined function. Alternatively another pre-defined function is….
SName = sName.toLowerCase ();
This is the exact opposite to the first phase as this time it is telling the program automatically to turn the letters into lower case letters.  Both examples are pre-defined functions as they are already built into the program. There are many predefined functions.

G:Local variables.  A local variable is a variable that is declared in the body of a method that you make. They you can use that variable only in the method you made. If you have other methods in the class they will not even be aware that the variable even exists. Here is an example of a program using a local variable…..
Public class HelloWorld
{
String sMyName;
      sMyName="Husnain";
      System.out.println(sMyName);
This is an example of a local variable. You don’t specify the static on declaration for a local variable, but if somehow you do the compiler will read the program and in return send you an error message and will refuse to compile your program. 

H:   Global variables;

 int g_nX; // global variable
int main()
{
int nY; // local variable nY
// global vars can be seen everywhere in program
// so we can change their values here
g_nX = 5;
} // nY is destroyed here

This is an example of a Global variable. Variables that are declared outside a block are known as Global Variables. Global variables have a program scope, in other words this means they can be accessed anywhere/everywhere within the program. The only way they can be destroyed is when the program ends as they are global. Unlike local variables Global variables can be accessed anywhere throughout the program. A global variable maybe used when you want to declare a variable that needs to be accessed by all parts of your program.   

I:Parameter passing; A parameter is a type of variable that you can pass into a function. Variables are the listed parts of each methods declaration. Each parameter must have a unique name and have a defined data type. For e.g. when you first open up java you get this code..
Public static void main (String[]args)
This this a type of function that takes one argument, an array of strings that’s called args. Furthermore there is a tye of way you write stuff to get input back.. System.out.println(“HelloWorld”). To sum up you have a function that takes one parameter. The value of the parameter is the string “HelloWorld”.

J)modularity;
Modularity is a general concept which applies to the development of software. It allows individual modules to be developed, in many cases this is done with a standardized interface to allow modules to work and communicate properly. Each module works independent to each other. Large software systems are really hard and complex to build this is where modularity comes in to break down a large system into separate physical entities that in a nutshell make it easier and more straightforward to understand.

K:Procedures are just small programs. They are sometimes known as sub-programs. The purpose of a procedure is to help a programmer avoid repetition. A procedure start off with a begin and end up with end;. The procedure can also have its own variables which cannot be used the main program. In a nutshell a procedure is a section of a program that performs a specific task or in other words an ordered set of tasks for performing some sort of action.

L:Programming Libraries; There are many Libraries in programming. They each contain some unique functions and subroutines for a specific program. For e.g. when I was programming to make graphical sub boxes to appear I had to write a specific code before inputting my codes.
  import,.javax.swing.*;
This code allowed me to have graphical boxes to pop up. When I typed this code it gave me access to a specific library. So I could use its functions and subroutines.

M: Event driven programming is a paradigm which is used to structure a program around multiple events. There are many events such as input in graphical user interfaces to networking requests. Nowadays most things use Event programming even non-graphical applications such as fire alarm. There are many advantages of Event driven programs...

  • It allows us to create and use more interactive programs, The majority of today's GUI are written with event driven programming.
  • It allows hardware to interact with software more easily 
  • Ease of development
  • Simplicity for GUI (Graphical user interfaces)
N: There are many Programming languages available, i will discuss two.
Advantages of Java....
Java is fast and easy to learn.
Java is object-orientated meaning you can create modular programs and re-usable codes.
Java is secure
And lastly java is platform independent……
Here are some advantages of c++
Great program for people who are interested in making games.
It is a good language to learn enabling you to limitless benefits
It is relatively clear and mature language
C++ is a great language however it may take more time to learn that a program like java as there is a lot more to learn
Java is a program used by many as it is easy and fun to learn. Java is now estimated to be running on 3 billion devices this shows how good and important the language is, C++ is used more for creating games and if you decide to become a programmer in the gaming section then you need to have brilliant C++ skills.

No comments:

Post a Comment