CS 0004 –Lecture 1Wednesday, Jan 5th, 2011
Roxana Gheorghiu
My Office: 6414
Email: [email protected]
Web Page: www.cs.pitt.edu/~roxana/cs4
Class: Mon, Wed, Fri: 10:00am -10:50am
Office Hours (tentatively): Mon: 11:00am -1:00pm Wed: 11:00pm -1:00pm By appointment
Administrative Stuff
An Introduction to Computers
What are the main components of a computer
Processor (microprocessor, CPU –Central Processing Unit)
Memory (RAM –Random Access Memory)Hard Disk Drive (HDD)Several device cards: graphics card, sound card,
network card, modemInput/Output (I/O) Devices: keyboard, mouse;
monitor, printer
Hardware, Software and Servers
HardwareRefers to physical components of the computer Includes all components (even I/O)
SoftwareAll the programs written for a particular computer
or for any computers
Servers vs. Personal computerTerm “Personal computer” indicates that the
machine is operated by one person at a timeTerm “Server” indicates that the computer
provides resources to other computers
Make a computer understand
Language =any system of arbitrary signals such as voice sounds, gestures or written symbols
Computer languages classification Lowest level: Machine Code (binary) (110100100)Assembly language: symbolic representation of
Machine CodeHigh-level (Human –readable): Visual Basic, Java, C+
+It consists of instructions to which people can relate
(Click, if, do)
Ex: Try to speak with a French guy who doesn’t know English (assuming you don’t know French )
Communication protocolHuman-Readable to Machine-Readable
Compiler
110010010001011101010101001000101011010101010001010111010110101010010111100010101010110101001001001001
WindowsProgram
(.exe)
VBSource code
Private Sub Form_Load() MsgBox ("Hello, World!”)End Sub
Execute
Computer ProgramsA computer is a machine that does ONLY what it
is instructed to
Instructions are used in addition to language
The tasks are broken down into a sequence of instructions . This sequence is called a program
The process of executing the instructions is called running the program
************
Make the robot leave the class and come back in the same position. Language: Move (#of stapes), Turn Left, Turn Right
What is a program?Collection of instructions that:
Accepts inputProcess DataOutputs results
Input OutputProcess
Why Visual Basic?Core of Microsoft Office Products
VBA (Visual Basic for Applications) allows us to “program” Excel
Allows you to make programs easilyLets you focus on problem at hand
Creates GUI’s not ugly command line
Interactive with user as an Event-Driven programming language
Event-driven programming paradigm
A way of designing a program: the application is driven by events
When creating an application, need to consider:How events can be (or should be) generated
creating an interface to accept actions from the user (e.g. button click)
How events are handledcoding event handlers to handle the events generated
Event-driven ProgrammingWhat is an event?
e.g. clicking a button, moving a mouse over a region, pressing a key, creating a form (window), timer going off
Something that happens in the program interface at a point in time (typically done by the user)
Event-driven ProgrammingWhat is an event handler?
A piece of code in our program that tells the program what to do when an event happense.g. when a particular button is clicked, update the display
How do events drive a program?Each event has a handlerWhen an event occurs, its handler is invoked If an event is not important, the programmer never writes an
event handler, so the program ignores the event
***************
Ex: click a button, text appear in my presentation. What is the event in this example ? What does the handler of
this event do ?