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.

Thursday, 13 November 2014

Event Driven Operating Systems (M1)

Event Driven Operating Systems

Today many things run on an event driven operating system. By event driven operating systems i basically mean a system that triggers an event in reaction to your action. For e.g. when you click the start button on a normal windows OS it reacts by opening this is done because when you click on the start button a trigger is activated and in response it opens the start button as an event.
As you can see on the screenshot when i clicked on the start button a trigger was activated and in result the start button opened up. We all benefit from an event driven OS as it makes using systems easier. An example is windows. Windows was first developed in 1985 and it was one of the first event driven OS on computers, this was revolutionary as users did not have to enter text on CLI (Command line interfaces) but could now navigate through a system with a mouse and could open graphical files and folders and applications with a click of a button. If it was not for event driven based OS then it would be harder using text based interfaces as we would have to remember a lot of text and phases to remember however event driven OS have made our life's easier as we don't have to remember text we just have to navigate with a mouse and with a click of a button we can open up graphical applications. These event driven OS have also been introduced to mobile phones making them more advanced and easier to use, They have also made it easier for people with disabilities to use products such as computers, tablets and mobile phones. This had made us inclusive as a society. Event driven OS allow us to use more dynamic interfaces. Taking this all in account event driven operating systems have allowed us to make brilliant GUI and without them using systems with out event driven would have made life more difficult.



This is an example of a GUI in apple. This is the shutdown screen, When i click on restart then an even will take place which will make the computer shutdown and automatically power back on. This shows having an event driven GUI is is much better than having a CLI. When i click on restart an event will take place where the computer will power off but automatically turn back on when it powers off.



This is an example of Linux the image shows someone playing music, When the user clicks on the music file and tries to access the music then an even will be triggered where the audio card in the computer will be notified it has to output music, The music is then outputted through speakers or headphones. Another example of viewing an operating system as an event driven application is the fact that we have the ability to drag and drop items such as files and images. A drag and drop event may happen on your computer when you want to place something within something else, For e.g. i may want to place a file in the recycle bin to do this i will click the file which i want to put in the recycle bin and drop it there.

















































Tuesday, 11 November 2014

Suitability of Event Driven Languages (D1)

Suitability of Event Driven Languages

Even driven can refer to any type of event, it is not necessary that it always thought to be linked to the programming side. Every day objects use event driven, particularly those products or objects which need to handle responses or requests. There are many non-graphical applications which use event driven programs. An example it a air conditioner. A air conditioner uses event driven programs because it has sensors. When it is hot they you may turn on the conditioners an supply cold air likewise when it's too cold you will turn it off. You also have an option to set the temperature when you do this and want to confirm it you will press a button and an event will be triggered where the conditioner will take the input and will output the cold air through the heater inside. Another example is a fire alarm. An fire alarm will sound off when it detects smoke, When it detects smoke an event is triggered and in response an alarm is sounded, This is one of the more important products which use event driven programs. As you can see the answer to the question is that Event driven programs are most definitely suitable for non-graphical applications. Lastly my last example is the fuel tanks in a car, When you are running low on fuel and even is triggered and a light flashes on your dashboard indicating this, This makes life a lot more easier as you will know when to fill up your fuel and when your running low. In a nutshell Event driven programs are most suitable for non-graphical applications. However for non-graphical applications you could use procedural programming, but event driven is now used in everyday products and its the way forward.