copyright © don kussee - 1120-intro # 541 cns 1120 copyright © don kussee 1120-intro.ppt
TRANSCRIPT
Copyright © Don Kussee - 1120-Intro # 54
1
CNS 1120
Copyright © Don Kussee
1120-Intro.PPT
Copyright © Don Kussee - 1120-Intro # 54
2
The Purpose of this Course
• Introduce programming concepts– Understand the words used– Practice the program development process– Understand the coding and debugging tools
available– Understand programming algorithms
• Look at programming languages & purposes
• Prepare for future programming classes
Copyright © Don Kussee - 1120-Intro # 54
4
Visual Basic Courses
• CNS 1120 Introduction to VB programming for Computer Science majors – 4 hours
• CNS 1200 Introduction to VB programming for Information Systems & others – 3 hours
• CNS 2200 Introduction to VB programming for programmers. 3- hours.
• CNS 3200 Advance VB programming after CNS 1120, or CNS 1200, or CNS 2200
Copyright © Don Kussee - 1120-Intro # 54
5
Computer Programs
• Input OutputProcess
Process
Process
Process
Process23
2-3
Yes No
9672
AC+
1421
49
Game restartsGame ends
6Copyright © Don Kussee - 1120-Intro # 54
The VB environment
Menu barTool bar
Toolbox
Code window
Form window Properties window
Project window
Copyright © Don Kussee - 1120-Intro # 54
7
1st programThunder storm
• 6 year old - afraid of noise - not lightening
• How far away was the lightening?
• How do we build a program?
• What is the Algorithm - the process of getting the job done
• ????
Copyright © Don Kussee - 1120-Intro # 54
8
A First Program
• How far away is the lightening?
• What are the elements
• Time difference between sight and sound
• Speed of light - who cares
• Speed of sound - 1089 feet/second @ sea level in dry air
• Time in seconds * speed of sound = distance
Copyright © Don Kussee - 1120-Intro # 54
9
How far away was the Lightning
• What is the input
• What is the output
• What is the process (What does the computer do), (speed of sound is 1089 feet per second in dry air - 5280 feet in a mile)
• The result
Copyright © Don Kussee - 1120-Intro # 54
10
• A demonstration: building the first Visual Basic Programming Assignment.
Copyright © Don Kussee - 1120-Intro # 54
11
TOE chartTask-Object-Event
Task Object Event• Seconds till thunder TextBox Change
• Compute distance None None
• Display distance Label None
Copyright © Don Kussee - 1120-Intro # 54
12
Printing Visual Basic programs
Copyright © Don Kussee - 1120-Intro # 54
13
Saving Visual Basic Programs
1 Create a folder with a descriptive name
2 Open the folder, Use Right mouse Button to create a VB program
4 Save As the Project3 Form, Classes, Code, Resources– Project - the files that make up the project
• Save frequently
• Backup often
Copyright © Don Kussee - 1120-Intro # 54
14
Saving Visual Basic Program
Copyright © Don Kussee - 1120-Intro # 54
15
What you must do for an A
• Practice the language - just like foreign language - Practice, Practice, Practice
• Attend the class• Read the book, practice writing programs• Get 2 floppy disks - Label them• Get two color high-liters• Access to your own computer, is helpful-
not required. CNS has computer labs.
Copyright © Don Kussee - 1120-Intro # 54
16
Tools we will use
• Book: “Programming Business Applications with Visual Basic 6.0”
• Lecture Notes: In the bookstore (copies of these slides)
• Program: Microsoft Visual Basic 6.0– Tools provided– Language - syntax and semantics– Programming concepts– Over 1 million copies have been purchased
• Computer Lab.
Copyright © Don Kussee - 1120-Intro # 54
17
Reference Books
• Not required but good for your library
• Microsoft Visual Basic 6.0 Reference Library, consists of 3 “official” manuals that are very good. $ 65.00
Copyright © Don Kussee - 1120-Intro # 54
18
Reference Books
• Not required but good for your library
• Visual Basic 6, Programmers Reference by Wayne Freeze; ITP Vantana Press
• Visual Basic How-to, by Waite Group, the Waite Group Press
• Win32 API’s for VB 6, By Dan Appleman, ZD Press
Copyright © Don Kussee - 1120-Intro # 54
19
Microsoft Visual Basic 6.0
• Creation Control Edition– does not include .exe, data controls, Wizards
• Learning Edition 99.95 49.95– Limited capabilities
• Professional 499.00 99.95– ActiveX builds
• Enterprise 1199.00 199.00– Group programming
Copyright © Don Kussee - 1120-Intro # 54
20
Visual Basic .Net (7.0)
• Should be available about the end of the year.
• Big change from VB 6.0.
• Very similar to Microsoft C# (Java)
• Improvement in the Error handling sub-routines, true OOP Inheritance
• We may teach it Fall 2002
Copyright © Don Kussee - 1120-Intro # 54
21
Microsoft’s Visual Basic 6.0
• In Computer Science Labs Professional Version
• At home - VB 5.0 or later, Any version including Creation Control.
• Professional Version (for $499) available to students $99
Copyright © Don Kussee - 1120-Intro # 54
22
Office Hours
• Monday 10-11 AM
• Tuesday 10-11 AM
• Wednesday 10-11 AM
• Thursday 10:30-11:30 AM
• Friday 11-12 AM
Copyright © Don Kussee - 1120-Intro # 54
23
Computer Facilities
• Good Lab computers - – hr. 7 AM to 10 PM Monday thru Thursday– hr. 7 AM to 6:00 PM Friday– hr. 8 AM to 3:00 PM Saturday– UVSC Net access available
• PC’s with Win98 & Visual Basic
• What your fees go for
Copyright © Don Kussee - 1120-Intro # 54
24
Lab Account
• You will need your account– To get updates of syllabus & requirements– To submit your programs for approval– To obtain messages from me– To download sample programs– To down load copies of these overheads
• All labs are open - unless they have a class
Copyright © Don Kussee - 1120-Intro # 54
25
Lab Visit – once only in this class
• We will go in as a class• Trained how to use the lab computers• You need
– 2 Floppy disks (3 1/2 inch, IBM Format)• Label them with your name
– To be registered for the class & pay lab fee
• Will spend some time on how to use Visual Basic
Copyright © Don Kussee - 1120-Intro # 54
26
Lab Assistants
• Will help if you have – Your book– A copy of the assignment– A design of the assignment
the TOE chart
• Few have had Visual Basic programming - but most have had programming of some type, and Visual Basic is very simple.
Copyright © Don Kussee - 1120-Intro # 54
27
Download area
• On the WWW - – http:/ftp.business.uvsc.edu./kusseedo/– PowerPoint slides are here– PowerPoint viewer is available– Programming assignments– Syllabus
Copyright © Don Kussee - 1120-Intro # 54
28
PowerPoint Slides
• View them with the PowerPoint viewer
• To Print them– Copy them to a disk (you could use the A: or H:)– Open the PowerPoint program on the
• Win95 programs
• Microsoft Office
• PowerPoint
– Print - Select 6 slides per page
Copyright © Don Kussee - 1120-Intro # 54
29
Assignments, Quizzes, and Tests
• Programming Assignments 36%
• Programming Assignments Style 7%
• Quizzes - 30 % Every Tuesday– At the start of class - I give free answer or two– Quiz is at the end of class– 2 low quizzes dropped
• Tests - 27% 2 mid-terms & final
Copyright © Don Kussee - 1120-Intro # 54
39
Floppy Or Zip disks2 at least
• Hard disk storage in the Lab is questionable
• Label your floppy disks
• Magnetic storage - so keep away from – Magnets (Refrigerators, TV’s, Speakers)– Magnetic screwdrivers– Sunlight …
• Backup your disks
Copyright © Don Kussee - 1120-Intro # 54
40
Windows 95 familiarityMust know
• Window• Icon• Click & Right Click• Double Click• Drag & Drop• Move• Copy & Cut & Paste• Minimize & Maximize• Resize
• Dropdown Menu• Popup Menu• Title Bar• Menu Bar• Tool Bar• Scroll bar• Mouse use
Copyright © Don Kussee - 1120-Intro # 54
41
Programming LanguagesA History Lesson
• Instructions to tell the hardware what to do
• Over 4000 popular languages
• Each invented for a specific purpose– some to be small– some to be fast– some for formulas– some for games– some for ease of use - Visual Basic
Copyright © Don Kussee - 1120-Intro # 54
42
1st Generation Programming
• Machine Language -
• All the computer can understand. All computer programs must be translated into Machine language ... a series of 1 and 0
• To add two numbers and put the result in a third we would do the following
Copyright © Don Kussee - 1120-Intro # 54
43
Machine Language program
00010001
00100010
1000
00111001
Copyright © Don Kussee - 1120-Intro # 54
44
To Add Two Memory Locations
0001 0001
• load CPU reg A contents of memory location 0001
0010 0010
• load CPU reg B contents of memory 0010
1000
• add reg A and reg B (sum remains in reg A)
0011 1001
• stores reg A into memory location 1001
Copyright © Don Kussee - 1120-Intro # 54
45
2nd Generation
• Assembly Language -– A translation to accommodate human memory– Must be re-translated back to Machine
Language– Still used for critical applications
• First WordPerfect program code
• Part of other CNS classes
– To add two numbers as before
Copyright © Don Kussee - 1120-Intro # 54
46
Add to locations in memory
• Instruction - memory location
• Machine Assembly0001 0001 LOA 0001 load A with location 0001
0010 0010 LOB 0010 load B with location 0010
1000 ADD add A and B
0011 1001 STO 1001 store into location 1001
Copyright © Don Kussee - 1120-Intro # 54
47
3rd Generation
• High Level Language
• A reduction in code that must be written
• Must be translated to Machine Language
• FORTRAN (FORmula TRANslation) 1957
• C introduced in 1972, C++
• Visual Basic introduced in 1991
• Java introduced in 1996-7
Copyright © Don Kussee - 1120-Intro # 54
48
To add Two memory Locations
• Machine Assembly High Level 0001 0001 LOA 0001 C = A + B
0010 0010 LOB 0010
1000 ADD
0011 1001 STO 1001
– Note: A is memory location 0001, B is memory location 0010, C is memory location 1001
Copyright © Don Kussee - 1120-Intro # 54
49
High Level Languages
• FORTRAN - Engineering & Scientific
• BASIC - Effective but slow
• COBOL - Business• JAVA• PASCAL - teaching
language
• C• C++• Smalltalk• dbase• PL/1• FORTH• HTML - WWW• Visual Basic
Copyright © Don Kussee - 1120-Intro # 54
50
4th Generation Higher Level
• PROLOG - Artificial Intelligence programs
• LISP - Knowledge based programs
• ADA - Multi-tasking government program
• Forth - very small
• OCCUM - Neural Net Language
• Delphi & Visual Basic
Copyright © Don Kussee - 1120-Intro # 54
51
Visual Basic• Visual Basic is simple but powerful language
– Much easier to use than C, C++, Java, Pascal– As easy to use as Powerbuilder, Delphi– Much faster than Basic, Java, Pascal– Has about 90% of the speed of C++– Has about 80% of the speed of Assembly Language
• Learning a language requires practice, practice
Copyright © Don Kussee - 1120-Intro # 54
52
1945 Von Neumann“Computer Program”
• A series of steps to be followed by the computer ---- input the required data and ---- test/manipulate/change ----– produce the desired output
• step-by-step instructions
• very detailed
InputInput ProcessProcess OutputOutput
ComputerComputerProgramProgram
Copyright © Don Kussee - 1120-Intro # 54
53
Language Translation
• Computers can only run Machine Language CodeAll other code must be translated into machine language
• Two processes are possible– Interpreted– Compiled
Copyright © Don Kussee - 1120-Intro # 54
54
Interpreted Code Visual Basic in Design Mode
• Each line is translated as it is run– BASIC and Java the usual examples
• Good - Debugging easy
• Bad - Programs run slow
• A line must be translated each time it is used
Copyright © Don Kussee - 1120-Intro # 54
55
Compiled Code Visual Basic in compiled mode
• Done as a whole program
• Hard to debug
• Runs quickly
• C and C++ are examples of complied code
• Java a composite