Title: Advanced Interactive Programming COM533J1 BSc IMD
1Advanced Interactive ProgrammingCOM533J1 (BSc
IMD)
- Dr Luke Chen
- Room 16E06
- School of Computing and Mathematics
- Email l.chen_at_ulster.ac.uk
- Telephone 68837
2Outline
- Module overview
- Aims, content, teaching methods, learning
outcomes, schedule, assessment methods, etc. - Basic computing concepts
- Computer, computer system, operating systems,
programming languages, etc. - VB IDE and language walk-through
- IDE and menus, statement and control structures,
procedure, etc.
3Module Overview
4Module Aims
- To enable students to master the concepts of
object oriented and component-based programming
for interactive systems. - To provide students with practical experience of
writing and managing large scale programs with
graphical user interfaces. - To introduce students to various advanced
applications in multimedia programming, esp, in
the context of the Web.
5Learning Outcomes
- Use a project development environment to design,
create and test software components, integrate
them into a software, and test and distribute the
software. - Analyse an existing software component and use it
effectively in a program. - Specify, design and implement a software
component using object-oriented techniques. - Use effectively usability principles throughout
the development process. - Use various multimedia programming techniques in
an advanced piece of software.
6Module Content (1)
- Introduction
- Operating systems
- Graphical components in message-based user
interfaces - Message queues and event handling
- Object oriented programming - classes and objects
- Concepts Classes, objects, encapsulation,
properties, methods, message-passing,
polymorphism and inheritance, - How to create, reference and delete classes,
objects, objects methods and variables, - How to program and use
- Programming classes setting and editing property
procedures, methods and event handling, - Programming polymorphism and inheritance,
- Programming exceptions.
7Module Content (2)
- Software Process Management
- The project concept, libraries, modular
programming. - Creation and distribution of executable software.
- Verification, validation and usability testing.
- Component-Based Programming
- Components, component interfaces and
re-usability. - Creating and using components
- Components for distributed programming
- Advanced Applications
- Graphics programming
- File handling
8Learning and Teaching Methods
- A combination of lectures, tutorials, practicals,
self study, directed study and exercises. - Lectures 24 hours
- Tutorials 12 hours
- Practicals 24 hours
- Assignment prep. 42 hours
- Directed reading 12 hours
- Private study 86 hours
9Lecture Schedule
- Week 1 Introduction to the module and computer
fundamentals - Week 2 Visual programming concepts and
components - Week 3 Object oriented programming concepts
such as object, class, information hiding - Week 4 Object oriented programming
inheritance and polymorphism - Week 5 Object oriented programming delegation,
error handling - Week 6 File handling
10Lecture Schedule
- Week 7 Mid-term Revision and class test
(Assignment one) - Week 8 Component-based programming ActiveX
technologies, ActiveX components - Week 9 Component-based database management
- Week 10 Advanced multimedia programming
- Week 11 Component-based Internet programming
- Week 12 Software process management
11Tutorials and Practical Sessions
- Each lecture will be followed by a tutorial and a
practical session - Tutorial and practical sessions will complement
lectures. - Tutorial is used to help understand concepts and
assist with problems, assignments and exam
preparation. - Practicals are mainly used to develop your
programming skills. - Attendance is mandatory and all work will be
assessed weekly.
12Assessment Strategies
- Coursework/Examination Weighting 50 / 50
- Written exam
- Unseen, closed book examination of 3 hours
duration. - Candidates should answer ALL questions in Section
A (40 marks) and attempt any THREE questions out
of FIVE in Section B, each 20 marks - Question types
- To explain particular concepts
- To apply these concepts to solve a particular
problem.
13Assessment Strategies
- Coursework assignments
- Assignment One Class test Tutorial time in
week 7 (50 minutes). - Assignment Two Create a piece of software which
makes use of the concepts acquired throughout the
module (week 3 to week 11). - Marking Criteria
- Correctness of the solutions
- Usability of the solution,
- Programming style (indentation, commenting etc)
- Assignment weighting
- Assignment One - 40
- Assignment Two - 60
14Supporting Material
- Recommended text book
- Harvey M Deitel and Paul J. Deitel. (1999) Visual
Basic 6 How to Program. Prentice-Hall ISBN 0
1345 6955 5 - Indicative reading list
- Dan Appleman. Dan Applemans Developing ActiveX
Components with Visual Basic 6. (1998) Sams
ISBN 1562765760 - F. Balena. Programming Visual Basic 6 (1999)
Microsoft Press International ISBN 0735605580 - Matt Curland and Bill Storage. (2000) Advanced
Visual Basic 6. Addison Wesley. ISBN 0 2017 0712
8 - Dan Fox. (1999) Pure Visual Basic 6. Que. ISBN 0
6723 1598 X - Some directed reading materials will be given in
classes
15Timetable
- Semester one
- Weeks 1-12
- Monday
- Lecture 1115 1315 - 05B01
- 10 minutes break at 1210am
- Tutorial 1315 1415 05B01
- Practical 1515 1715 - 16C29
16Question Answering
- Your feedback, suggestions are welcome, as our
class has small number of students, could be more
flexible and informal - Asking questions are encouraged
- Office hours
- Tuesday morning, Wednesday afternoon 16E06
- Other weekdays by appointment via email or
telephone - Tel 68837 (ext.), email l.chen_at_ulster.ac.uk
- If you are unhappy with me or the lecturing,
speak to me directly or the course director.
17Requirements
- Prerequisite Interactive Programming COM148J2
- Attend all lectures except with a good reason
- Complete all exercises in practical classes
solutions to lab practicals should be submitted
by the end of the week. - Self-study and read relevant materials
- Participate discussions via module mailing list
- All lectures slides, tutorial and practical
materials will be available on the module website
in WebCT.
18 19Basic Computing Concepts
20Computing Concepts
- Computer
- Computer structure
- Operating systems
- Programming languages
21What is a Computer?
- Computer
- Device capable of
- Performing computations
- Processing information
- Making logical decisions
- Works billions of times faster than human beings
- Programs
- Sets of instructions that process data
- Guide computer through orderly sets of actions
specified by computer programmers
22Computer System Structure
- A computer system can be divided into four layers
- Hardware Provides basic computing resources
such as CPU, memory, I/O devices - Operating system - Controls and coordinates use
of hardware among various applications and users - System programs Perform file management,
programming language support, program loading,
communication - Application programs Define the ways in which
the system resources are used to solve users
specific computing problems such as Word
processors, web browsers, database systems, video
games - Users - People, machines, other computers
23Abstract View of a Computer System
24Computer Organization
- Every computer can be divided into six units
- Input unit
- Receiving section of computer
- Obtains data from input devices - usually a
keyboard, mouse, disk or scanner - Places data at disposal of other units
- Output unit
- Shipping section of computer
- Puts processed information on various output
devices - screens, printers, speakers, etc. - Makes results information available outside the
computer
25Computer Organization (II)
- Memory unit
- Rapid access, low capacity warehouse
- Retains information entered through input unit
- Retains information that has already been
processed and is going to be sent out to output
unit - Often called memory, primary memory, or random
access memory (RAM) - Arithmetic and logic unit
- Manufacturing section of computer
- Performs calculations (addition, subtraction,
multiplication and division) - Contains decision making mechanisms and can make
comparisons
26Computer Organization (III)
- Central processing unit (CPU)
- Administrative section of computer
- Coordinates and supervises other sections
- Secondary storage unit
- Long-term, high-capacity warehouse
- Stores programs or data not currently being used
by other units on secondary storage devices (like
discs) - Takes longer to access than primary memory
27Operating System
- A program manages hardware, provides a basis for
application programs and acts as an intermediary
between a user of a computer and the computer
hardware. - Objectives
- Control/execute application programs,
- Make the computer system convenient to use,
- Make user problem-solving easier,
- Use the computer hardware in an efficient manner.
28Operating System Services (I)
- User interface - Almost all operating systems
have a user interface (UI) such as CLI or GUI - Program execution - to load a program into memory
and to run that program, end execution, either
normally or abnormally. - Access to I/O devices - to provides a uniform
interface for various devices - File-system manipulation - to read and write
files and directories, create and delete them,
search them, list file information, permission
management, protection mechanisms
29Operating System Services (II)
- Communications
- Processes may exchange information, on the same
computer or between computers over a network - Program development
- Editors, compilers, and debuggers not part of
the core, but usually supplied with the OS. - Error detection and response
- Internal and external hardware errors such as
memory error, device failure, - Software errors such as arithmetic overflow,
access forbidden memory locations - Operating system cannot grant request of
application
30Operating System Services (III)
- Resource allocation
- When multiple users or multiple jobs running
concurrently, resources (such as CPU cycles, main
memory, and file storage) must be allocated to
each of them - Accounting - To keep track of which users use how
much and what kinds of computer resources - collect statistics
- monitor performance
- anticipate future enhancements
- used for billing purposes
- Protection and security access control,
authentication and authorization - Data system resources
- Resolves access conflicts
31Evolution of Operating Systems
- Early mainframe systems
- Single-user batch processing
- Jobs on decks of punched cards
- One job ran at a time
- Results took hours to process
- Operating Systems
- Managed transitions between jobs
- Increased amount of work computer could
accomplish - Multiprogramming
- Simultaneous operation of several jobs
- Computer resources split between jobs
- Still took long hours for results
32Evolution of Operating Systems (II)
- Early mainframe systems
- Timesharing Operating Systems (1960s)
- Computers accessed through terminals - devices
with keyboards and screens - Hundreds of people use system at once
- Quickly performs small portions of each persons
job - Gives appearance of running simultaneously
33OS for Personal Computing
- Pioneered by Apple and IBM (1970s)
- Used by people in office environments
- Primary goals not maximum utilization of resource
but convenience and responsiveness - Neither multiuser nor multitasking at the
beginning - Transported disks to share information
- Computer prices dropped get currency in the
1980s, 1990s - Modern operating systems such as Windows2000,
Window XP, Linux, etc. - Support nearly all feature of mainframe systems
34OS for Distributed Computing
- Machines linked together
- Local Area Networks (LANs)
- Wide Area Networks (WANs)
- Two structures for distributed systems
- Client/Server systems
- One machine as client, one as server
- Peer to Peer (P2P) systems
- All nodes are peers
- Modern OSs support distributed system by
including protocols and drivers
35Programming Languages
- Computers cannot work without programs
- Programs are written using a programming language
- A vocabulary and set of grammatical rules for
instructing a computer to perform specific tasks.
- Low level or high-level languages in terms of the
level of abstraction from machine language - Machine languages
- Assembly languages
- High-level languages
36Machine Languages
- Language only understood directly by computer
- Defined by computers hardware design
- Machine-dependent - Languages specific to
particular computers - Incomprehensible to human readers
- Streams of numbers - Ultimately reduced to 0s and
1s - Instruct most elementary of operations
- Slow, tedious and error-prone to write - Led to
Assembly languages - Run very fast and efficient as executed directly
by CPU no need for translator or compiler
37Assembly Languages
- Low level language
- Represent elementary operations of computer using
English-like abbreviations to help programmers to
remember individual instructions (mnemonics) - Hardware dependent
- More clear to human readers
- Huge improvement but still tedious to use
- Many instructions for simple tasks
- Led to high-level languages
38High-Level Languages
- Instructions comprehensible to humans
- Look like everyday English
- Contain common mathematical notation
- More portable across platforms
machine-independent - Single statements accomplish substantial tasks
- One instruction can be broken up into many
primitive operations
39Example High-level Programming Languages
- C language of UNIX, Procedural programming, used
for most operating system, evolved from B
language at Bell Labs - C extension of C, support both procedural and
object oriented programming, developed at Bell
Labs - JAVA based on C and C, used mainly for Web
application, write once, run anywhere, platform
independence, developed at Sun Microsystems - C Roots in C, C and Java, adapts best
features of each language, designed for .NET
platform specifically developed at Microsoft - Each language has a unique set of keywords and a
special syntax for organizing instructions. - Many others such as Prolog, lisp, Matlab, etc.
- VB is a high-level programming language
40Translation
- A computer cannot directly understand or run a
program written by high level languages. - Every program must be translated into a machine
language that the computer can understand. - This translation is performed by either a
compiler, an interpreter or a mixture of the two. - This is the job of an OS
41Running a Program
- Three ways
- Through a compiler - translate a program into an
executable (.exe) and then run the executable. - Through an interpreter - translate and execute a
program one statement at a time in succession,
without looking at the entire program. - Through a compiler and an interpreter - compile a
program into an intermediate form, and then
translate and execute the intermediate form code. - This is the job of an OS
42VB IDE and Language Walk-through
43Visual Basic
- VB has been specifically designed to build
applications for the Windows environment. - One of the most widely used windows programming
language. - Relatively easy to learn.
- Useful for prototyping (rapid application
prototyping (RAP)) - create professional looking
systems very quickly. - Support Internet connectivity.
- Provides wizards to assist users.
44Integrated Development Environment (IDE)
- An IDE is a programming environment that has been
packaged as an application program. - Typically it will consist of a code editor, a
compiler, a debugger, and a graphical user
interface builder. - IDEs provide a user-friendly framework for many
modern programming languages, such as .NET
framework in Microsoft, WebSphere Studio from
IBM, JBuilder from Borland, NetBeans from SUN,
etc..
45VB and IDEs
- The VB IDE consists of a number of elements such
as menu bar, project explorer, toolbar,
properties window, toolbox, editors, etc. - The VB environment can be used to create and
execute programs - Programs can also be created within the VB
environment as executable files to be run outside
of the environment. - VB uses the term project as an analogy to
program
46The VB IDE
47VB Language Fundamentals
- Data types the most commonly used types of
variables in VB are - Boolean Values can be true or false
- Byte 8 bit an integer in the range 0-255
- Integer 16 bit whole number (-32768 to 32767)
- Long 32 bit whole number (-2 billion to 2
billion) - Single 32 bit decimal number (7 Sig Figs)
- Double 64 bit decimal number (14 Sig Figs)
- String strings of text
- Variant can hold any type. (This is the default
if the type is not declared.)
48Variable Scopes
- Local variables only have the scope of the
procedure in which they are declared. They cannot
be accessed outside of it. - Module variables apply to variables declared in
the general declaration of a module, which can be
accessed by all procedures in the module. - Global variables have the scope of the entire
project and as a result can be accessed or
modified by any procedure. A global variable must
be declared as public.
49Variable Manipulation
- Arithmetic operators
- Mathematical calculation such as , -, , /, mod,
etc - Relational operators (comparison)
- Simple conditions such as gt, gt, lt, etc
- Logical operators
- Complex conditions by combining simple
conditions, such as and, or, not
50Control Structures in VB
- There are three main types
- Sequence
- Selection
- Iteration
- Note You should have been able to draw
flowcharts or interpret them. - Sequence
- This is when one statement follows another
51Control Structures
- Selection
- This is when the computer will make a decision
and proceed based on the result of this decision.
52Selection Statement (I)
- There are two main ways for a computer to make
decisions - If Statements
- Case Statements
- If statements can have a few different forms but
the general structure is shown below. - If Condition1 Then
- Statements executed if condition 1 true
- Else If Condition2 Then
- Statements executed if condition 2 true
- Else If Condition3 Then
- Statements executed if condition 3 true
- Else
- Statements executed if all above false
- End If
53Selection Statement (II)
- Case statements can be for the same thing, but
they look slightly different. - Select Case Expression
- Case Criterion 1
- Statements to be executed when Criterion 1
matched - Case Criterion 2
- Statements to be executed when Criterion 2
matched - Case Criterion 3
- Statements to be executed when Criterion 3
matched - Case Else
- Statements to be executed if none of the above
matched - End Select
54Control Structures
- Iteration
- This control structure tells the computer to do
something a number of times.
- Determinate loops
- Repeating a section of code a specific number of
times - Indeterminate loops
- Repeating while a condition is true
- Repeating until a condition is true
55Determinate Loops
- For loops repeat something a preset number of
times. - Useful for populating or working with arrays.
- For i 0 To 4
- Print WeekDays(i)
- Next I
56Indeterminate Loops (I)
- Do and while loops these loops are executed
based on the result of a test.
57Indeterminate Loops (II)
- Do and until loops these loops are executed
based on the result of a test.
Repeats until the condition is true. Loop is
never executed if condition is true initially
Do Until condition Statements Loop
Do Statements Loop Until condition
Repeats until the condition is true. Loop is
executed at least once
58Arrays and Loops
- In VB we could create an array of data.
- Dim someArray(1 To 10) As Integer
- We could use For..Next Loops to carry out
operations on arrays. - For i 1 to 10
- someArray(i) 0
- Next i
- This will go through each element of the array
and assign 0 to that element.
59Multidimensional Arrays and Nested Loops
- We can create a matrix type structure using a
multidimensional array. - Dim NewArray(1, 2) As Integer
- To carry out operations on such an array we need
to use nested loops (loops inside each other). - For i 0 To 2
- For j 0 To 1
-
-
-
- Next j
- Next i
60Programming Procedures
- Procedures
- Different types
- Event procedure
- VB procedure
- Sub procedure
- Function procedure
- Scope
- Private
- Public
- parameter passing
- call-by-reference
- call-be-value
61Summary
- This lecture has given an overview about the
module, introduced the fundamentals of a computer
system. - The tutorial will refresh the basic VB concepts
through reading notes. - The practical session will refresh the use of
these basic VB concepts in three exercises. - Further reading on computer architecture is
expected. An online book is available here
http//www.ipp.mpg.de/de/for/bereiche/stellarator/
Comp_sci/CompScience/csep/csep1.phy.ornl.gov/ca/ca
.html