120 likes | 272 Views
CS 0004 –Lecture 1. Wednesday, Jan 5 th , 2011 Roxana Gheorghiu. Administrative Stuff. My Office : 6414 Email : roxana@ cs.pitt.edu Web Page: www.cs.pitt.edu/~roxana / cs4 Class : Mon, Wed, Fri : 10 : 0 0am -10:50am Office Hours (tentatively): Mon : 11 :00am -1: 00pm
E N D
CS 0004 –Lecture 1 Wednesday, Jan 5th, 2011 Roxana Gheorghiu
Administrative Stuff • My Office: 6414 • Email: roxana@cs.pitt.edu • 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
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, modem • Input/Output (I/O) Devices: keyboard, mouse; monitor, printer
Hardware, Software and Servers • Hardware • Refers to physical components of the computer • Includes all components (even I/O) • Software • All the programs written for a particular computer or for any computers • Servers vs. Personal computer • Term “Personal computer” indicates that the machine is operated by one person at a time • Term “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 Code • High-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 )
VB Source code WindowsProgram (.exe) Private SubForm_Load() MsgBox("Hello, World!”) End Sub 11001001000101110101010100100010101101010101000101011101011010101001 0111100010101010110101001001001001 Communication protocolHuman-Readable to Machine-Readable Compiler Execute
Computer Programs • A 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 input • Process Data • Outputs results Input Output Process
Why Visual Basic? • Core of Microsoft Office Products • VBA (Visual Basic for Applications) allows us to “program” Excel • Allows you to make programs easily • Lets 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 handled • coding event handlers to handle the events generated
Event-driven Programming • What 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 Programming • What is an event handler? • A piece of code in our program that tells the program what to do when an event happens • e.g. when a particular button is clicked, update the display • How do events drive a program? • Each event has a handler • When 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 ?