Wednesday 19 November 2014

Event driven programming suitability for a Graphical user interface

Event driven programming suitability for a Graphical user interface
Event driven programming is very suitable for GUI (Graphics interface) due to the range of event commands that are available which proves very compatible with graphics user interface for example Mouse over, keystroke, click or touch.these are some of the events that are suitable for these events when using the graphical buttons labels or text boxes is effective

Service orientated
Service orientated is When a user use of an event driven program/app in order to get a service from it for example you go to setting and set a reminder on the calender for a certain day and time. So the service is the reminder going of on the right day and time.

Events
events can be sub categorized into five different categories which refers to different hardware and software uses of events. These events are: mouse events, keyboard events, HTML object events, Form events and User Interface Events.

Mouse events
mouse events refer to actions performed by the mouse which can be dependant on either mouse buttons e.g. left click, right click, double click; the scroll wheel e.g. scroll up, scroll down, scroll wheel click or even mouse motion and movement sensor e.g. mouse move forward, back, left, right.

Keyboard Events
Keyboard events refer to actions performed with a keyboard which is dependant on either individual key presses of any keys on the board or even a combination is a good example of this is Ctrl+Alt+Delete function which triggers a windows menu which allows you to lock your computer; change your password or open your task manager using a windows operating system.
Html Events
Html events such as on-click, on-mouse move and on-key down is used in online applications using software like JavaScript and cascading style sheets which are designed for working on browser applications. These triggers are not to be confused with hardware mouse and keyboard events despite being similar these events are only for use on web browsers. 

Time Driven
Time Driven programs such as antivirus scans, task scheduler and operating system updates are important features in the maintain and running of your PC and it is often used in real-time computing.
User Interface events are one of the key features of event driven programming because most applications that are created using event driven programming e.g. calculators apps use buttons as a graphical representation of the number. these buttons are required to trigger the event to begin inputting the sum to create a calculation.


Here is an example

package ran;



import javax.swing.*;



public class Ran {



    public static void main(String[] args) {


     int iMyage=18;  
    

String sMessage = JOptionPane.showInputDialog(null,"State your name?","Enter your name",JOptionPane.INFORMATION_MESSAGE);
      
System.out.println(" Welcome home YJC " + sMessage);
     
char cYou = 'j';
    
if (sMessage.contains("Benhur")){
    
System.out.println("B stands for Best of the Best");
    
}else {
      System.out.println(" Sorry " +sMessage+ " i don't recognize you but i know your name starts with " + cYou);
    
    }
    }

    

}

  

in this image the code is running.
the code is suppose to pop up a box to write your name after you write your name.


















Then it will say you entered your name, And if your name doesn't start with b is will say sorry i don't seem to recognize you but i know that your name start with the first letter in your name,But if your starts with b it will say your name starts with b which stands for best of the best . 







Wednesday 12 November 2014

Event Driven Programming

Event Driven Programming
  • Service orientated
When a user uses an event driven program/app in order to get a service from it, for example you go to setting and set a reminder on the calender for a certain day and time. So the service is the reminder going of on the right day and time
  • Time driven
Time driving is a computer programming paradigm, where the control flow of the computer program which is driven by a clock and it is often used in real-time computing.

  • Event handler
Event handler is a typical software that processes actions for example when you are moving the mouse and keystrokes. with web sites event handler can make web content dynamic. Java script is commonly used for this method.

  • Trigger functions
Trigger functions are the functions that execute the program when a certain event happens.the operating system waits for the user to press a key, move the mouse or or do something that would cause something to happen. then it sends a signal to the processor and then it would show you whats happening on the screen.
  • Event
Event in computing is when you use the mouse or keyboard to click and type in in applications and icons to interact with the computer this is called user interface.
  • Pre-defined functions
Pre-defined functions are a series of instructions that is known by a name in computer programming then it's built into higher level programming from which the program is compiled from. for example System.out.println() is predefined functions used for the program to remember the letter as a variable. 

  • Local Variable
A local variable in Java is variable that declared within a body of the method. then you can only use the variable within the method but if you try to use the same method in a different body it wont work because other methods in the class aren't aware the variable exists.


  • Global Variable
In a computer programming a global variable is a variable with a global scop. which means that it is visible and accessible through the program unless it is blocked off. all programming language use global variable except Java because using global variable is confusing and you can loose track on what you are doing this could affect your program, Java uses local variable because it is easier to keep track on what you are doing.

  • Parameter Passing
 In computer programming a parameter (arguments) is a value passed into (input) a function. function is like maths for example lets say we have "x" and "y" x would the input parameter and y would be the resulting output. value here is what it would look like
 function double(x)
{
 $y = 2 * x;
  return $y;
} 

  • Modularity
Modularity is the degree to which the system components separate and recombine. Modularity and modular are similar but the difference is modular separate programs in to smaller groups. for example work how much some one is paid in a month modular would put them like this:
  • hourly paid. 
  • hours of work day. 
  • hours worked in a month.
  • Monthly paid.
  •     Procedure 
Procedure is an order of the steps to be taken to do or how something is done.  


  • Programming libraries
programming libraries is a collection of pre-compiled routines that a program can use. Routines is sometimes called modules are stored in object format







  • Event driven programming paradigm for simplicity of programming and ease of development
  • Event driven programming is a code that waits for certain events to happen and then reacts to it accordingly.






  • Include two example programming languages as examples

  • Java Script and Java.