Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit 14 Event Driven Programming

Similar presentations


Presentation on theme: "Unit 14 Event Driven Programming"— Presentation transcript:

1 Unit 14 Event Driven Programming
Level 3 Computing Year 1 Lecturer: Julie Hodsdon

2 Previously ….. We developed a GUI based application.
We developed a console based application You carried out an evaluation of both BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

3 Today ….. We will look at the .NET environment
We will look at how event driven programs work. How Operating systems are event driven. We shall also look in more depth at forms and controls using Microsoft visual studio 2010/2013. BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

4 About .NET The .NET initiative was announced by Microsoft in June 2000 as a broad new vision for embracing the Internet and the Web in the development and use of software. A key component of the .NET architecture is Web services. These are applications that can be used as reusable building blocks over the Internet by clients and other applications. The vision is that companies running on different platforms can easily reuse each other's code. It also opens a market for Web services such as those to do with authentication, data storage, language translation. Programmers will therefore be free to concentrate on the non generic needs of their organisations BTEC Level 3 Year 1 - Unit 14 Event Driven lProgramming

5 About .NET Aims to support universal data access by allowing
centrally-held data to be seen and edited by a PC, a PDA, a cell phone or any other Internet-enabled device. The .NET framework is at the heart of the .NET strategy. This manages and executes applications and web services. Currently the framework only exists for the Microsoft platform, but is already under development for FreeBSD, a UNIX-like OS. IF the framework is installed on a platform, it can run any .NET program. BTEC Level 3 Year 1 - Unit 14 Event Driven lProgramming

6 Microsoft Intermediate Language
BTEC Level 3 Year 1 - Unit 14 Event Driven lProgramming

7 .NET compliant languages
APL C# Component Pascal Curriculum Eiffel Fortran Haskell j# JScript Mercury Oberon Oz Pascal Perl Python RPG Scheme Smalltalk Standard ML Visual Basic .NET Visual C++ .NET BTEC Level 3 Year 1 - Unit 14 Event Driven lProgramming

8 VB.NET Completely Object Oriented
– use of constructors and destructors – true inheritance Automatic garbage collection so fewer memory leaks caused by circular object references Structured exception handling – the error handling in VB6 dated back to the first versions of Basic (40 years ago) True multithreading e.g. reading s while downloading new ones Experience of VB.NET should improve employment prospects BTEC Level 3 Year 1 - Unit 14 Event Driven lProgramming

9 Two integral technologies
ADO.NET – used for working with data from all sorts of sources – flat files and databases – works on disconnected data sources ASP.NET – used for Web-based applications, you may be using this in other units. BTEC Level 3 Year 1 - Unit 14 Event Driven lProgramming

10 Web applications BTEC Level 3 Year 1 - Unit 14 Event Driven lProgramming

11 The event loop BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

12 The event loop cycle BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

13 Event loops in detail Programmers are not normally aware of event loops. The event loop keeps testing the user interface to see if anything has happened (e.g. clicking on a button or pressing a key etc.), this is called polling. When detected, the event is passed to a trigger function. Again the programmer is not aware of this. The trigger function then find the appropriate event handler and control is then passed to the code (programmer code) to handle this event if any. It is important to note that other (non user) activities can also cause an event to trigger – typically used with timer controls and file reading and writing etc. BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

14 Triggers Triggers: Not to be confused with triggers in SQL SERVER
Responds to an event (from the event loop). Usually allows a secondary event to occur e.g. text change BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

15 Service Orientated Driven Programming
This only runs when needed or when an event occurs that requires a system service. E.g. when a new file is created, new arrives or if a new USB device is installed. It can also run several services in parallel to each other. (This is an example of multi-threading). BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

16 Time Orientated Driven Programming
This runs code dependant on time and is often called a “timer” trigger. Some examples of this are google docs due to the fact that is updates regularly on all users documents. A stop watch is also another example. Google drive and Microsoft Skydrive are other example that synchronise files based upon a file change event or on a regular time interval. Another good example is anti-virus programs running a scan at particular times. BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

17 Advantages Flexibility: Suitability for GUI:
There is a wide choice of controls and trigger functions. Suitability for GUI: Uses WIMP system (Windows, Icons, Menu’s, Pointers) Simplicity and ease of development: You can add code one control at a time, this allows a programmer to build up their program gradually with simple building blocks. BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

18 Disadvantages Errors can be more difficult to spot than with simpler, procedural programs. Programs with complex GUIs my be slower to load and run than simpler programs, especially if RAM is insufficient. Programs with too many forms can confuse/frustrate the end user. However, the majority of programs are now event driven. This applies to form based (client based) programs as well as to web based (browser based) programs. BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

19 Event driven programs Good examples of event driven programs are:
Microsoft Word/Excel Microsoft PowerPoint Adobe Dreamweaver Adobe Photoshop etc BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

20 Operating systems Does the event driven paradigm apply to operating systems such as windows 7, Apple and Linux. What evidence can you think of which points to an operating system being event driven. One example could be the user clicking on the start button in the task bar which then causes a list of programs to show? What others can you think of? Task 1 find evidence in favour of operating systems being event driven. The evidence you get can be used in Assignment 1 task 3 which is an M1 task. You will need screen shot evidence to support your points. You are asked in the assignment to produce no more than 5 slides, so aim for 5 slides (no less, no more). BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

21 Task 1 You are now in a position to start Task 1 of assignment 1 (P1). The task asks for no more than 10 slides, please make sure you have about 10 slides and no more. Small diagrams to support your narrative would be good. BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

22 Operating systems Task 1.
Find evidence in favour of operating systems being event driven. The evidence you get can be used in Assignment 1 task 3 which is an M1 task. You will need screen shot evidence to support your points. You are asked in the assignment to produce no more than 5 slides, so aim for 5 slides (no less, no more). BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

23 Event loops task For this task you need to download the Event Loops document from the wiki and fill in the empty boxes. This should take about 5-10 minutes. Refer back to the slides if you need to. It is important you know the correct sequence. BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

24 Windows Forms and controls
BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

25 Controls/Toolbox BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

26 Form Design Form control TextBox Labels Buttons
BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

27 Control properties BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

28 Code Window and intellsense
Intellisense BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

29 Event handlers/procedures
Sub routine Control name Privacy Parameters Private Sub Button1_Click( ) ……. End Sub Your code End BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

30 Summary This lesson we have looked at these key features:
Service Orientated Event drive programs. Time driven programs. Event handlers. Triggers. Events and event loops. Flexibility. Suitability for GUI. Forms/Controls Simplicity and ease of development. Operating systems as event driven systems. BTEC Level 3 Year 1 - Unit 14 Event Driven Programming

31 Next time.. We will look at: Variables. Variable Scope.
BTEC Level 3 Year 1 - Unit 14 Event Driven Programming


Download ppt "Unit 14 Event Driven Programming"

Similar presentations


Ads by Google