Thursday, 15 September 2016

Unit 14

Unit 14 – P1

Event driven programming is created using procedural programming and can use object programming. Event driven programming is based on how the program reacts to the user’s needs and isn’t related to the structure of the program. Event driven programming is only used when it is going to use a windows graphical interface as this may not be suitable on any other interface such as Apple computers and Linux. This could be made using Visual Basic by Microsoft. Event driven programs would be used as something such as an alarm clock, to set a time for a task and to sound an alarm when it is time to do such task. A limit of event driving programming would be that it doesn’t allow you to enter event loops and requires the user to do it manually instead of automatically.

Events:

Events can be separated into different categories that refer to different hardware and software. One of these events are keyboard events. Keyboard events refer to actions performed with a keyboard. You can use a combination of keys pressed at once to perform a certain task. An example of this would be opening the windows  menu, you open this by holding Ctrl, Alt and Delete at the same time, it will bring up a blue menu with 5 options, locking the computer, logging off your computer, switching users on the computer, changing your computer password and opening the windows task manager. With the task manager, you can then end applications and end processes that are currently happening on your computer.

VB:

One example of an event-driven language would be Visual Basic. Visual Basic is an event driven programming language that is useful to programmers and anybody that is interested in programming in general. It is mostly useful for programmers that are looking for programming things that include GUI. It is different from many other programming languages as VB does a lot of things that benefit you, such as finding any mistakes in your coding and may even suggest how to correct it if it would work. It can also give you a lot of the code to get you started off in the right direction. It can give you code about clicking a button and will write the starting code for you, you would then have to do the code yourself but it will almost act like a predictive text whilst you write the programme.
In VB, you can insert things into a form by using drag and drop from a bar at the side which as options to put into your form, this could be things such as labels, buttons and timers. This is the reason that it is called Visual Basic, as almost everything is ‘Visual’. It takes advantage of the graphics that modern operating systems work by allowing the user to draw the programme by dragging and dropping instead of just writing line upon line of code. Visual Basic is one of the most popular and most used programming languages as it is much faster to write a program and it is much cheaper too as lots of the program is done for you, saving you much time.

On the basic form screen of Visual Basic, you can see the form its self, the application files and the properties, you can place these wherever you want on the screen so that you can locate them easily. The form is what will show up when you run your created program, for a button to work, the button must be placed on the form and you will want to write some code for that button, you will rename the button so that you can identify it whilst programming. You can adjust the size and shape of the form by dragging the corner of the form and making it however you would like it, you can change the colour of the form and maybe even use a picture for it to pop up when it runs. You can add text to the form and edit the font style, the font size and colour of the font. You can get the button and labels etc… from the toolbox which is located on the left hand side of the form in a tab called ‘toolbox’. If you are creating a program with a timer, you can edit a timers’ interval from the property window, whether the timer has any modifiers or if it has been enabled or not.

For the coding stage of Visual Basic, there is a whole new window for you to use, this is where the coding will be written for programs so that they can function properly. Lots of code can be added automatically to this window by double clicking on an object like a button. Although this isn’t fully recommended as it isn’t always correct, most of the time it will be but there is a safe way of doing this. You can click on ‘View’ above your form tabs and then click on ‘Code’, this will bring you to a blank canvas, you will then click on the first drop down box that you see and click on your object that you wish to write code about that is on your form. For example a button, you will have placed a button on your form and then opened your coding screen. You would then select the second drop down menu and click on which ever function you wish to do with the button, this could be for when it is clicked. It will then insert a code for you to write from, it will say the name of your button and it will then say the procedure, for this example it is click. You could then write that you want a message box to come up when you click the button, you would write something like this.

You would run the program and a button will be on your form, you then click the button and a message box will pop up saying “My First Visual Basic 2012 Program”. You can also add in buttons that close down the program, this would make it easier than clicking the X button in the corner of your window, you could click a button that says ‘quit’ or ‘exit’.
  
Features of Visual Basic:

There are many features in Visual Basic which make it different to many other programming languages.
One of the features is attributes. Attributes are additions to lements already defined, they are mainly used to give the user more information. They are used to specify requiremtns of methods and to specify features required to enhance the security.
Multithreading is a helpful feature that is used in Visual Basic. Multithreading allows applications to handle many tasks at the same time and it enhances performance and stability.
Another new feature that Visual Basic has is windows forms. Windws forms allow the user to inherit a form from another form that already exists.

Advantages:


 The whole programming language structure is easy to learn and simple to use.
·        GUIs are very easy to develop with Visual Basic
·        There are many guides online to help you with programming languages
·        Visual Basic is built similarly to the other Microsoft programming languages, meaning that there isn’t much that can’t be done, whereas in C# there are many things you can’t do that you can do in Visual Basic.

Disadvantages:

·      As more people can learn Visual Basic, there won’t be as many jobs for other programming language, there will also be more jobs for people based around Visual Basic, there would be less of a chance of everyone getting a job as there wouldn’t be enough job offers.
·   If you would like to make really complicated games then you wouldn’t really use VB as it isn’t suitable to use.
·        Visual Basic is only useful for programming software that includes a GUI instead of a CLI



·       

No comments:

Post a Comment