340 likes | 1.15k Vues
CS 141 Introduction to Computer Science and Structured Programming Dr. Randy L. Ribler Lynchburg College First Reading Assignment Read Bronson Chapter 1 Today’s Topics Studying computer science Careers in computer science CS141, and where it fits in Hints on how to succeed in this course
E N D
CS 141Introduction to Computer Scienceand Structured Programming Dr. Randy L. Ribler Lynchburg College
First Reading Assignment • Read Bronson Chapter 1
Today’s Topics • Studying computer science • Careers in computer science • CS141, and where it fits in • Hints on how to succeed in this course • Compilers and Computer Languages
What is Computer Science? • Computer science is the study of computers and computer software. • It is really more like an engineering discipline than it is like a science. • Computer science is a very new field of study, yet it already has scores of subfields
A Sampling of Subfields in Computer Science • Artificial Intelligence (AI) • Software Engineering • Human-Computer Interaction (HCI) • Parallel Processing • Computer Graphics • Computer Aided Design (CAD) • Compiler Development/Tools • Robotics
Simulation • Performance Analysis • Operating Systems Design • Speech/Natural Language Recognition • Database Design • Theory of computation • Virtual Reality (VR) • Computer Architecture • Web-based Technologies • and many, many more.
What do these subfields have in common? • Programming is central to almost every one of these subfields.
Good things about Computer Science • You might really enjoy it! • It is a very dynamic field • but the “basics” tend to stay the same • It is an applied “science.” • You should be able to apply virtually everything you learn. • It can provide a very good career • It can support work in virtually every other field
Programming can be a very creative process. • Programmers are writers and engineers. • There are many, many ways to accomplish the same task. • Computer science is very new. There are a lot of opportunities to be innovative. • You can build new products without investing a lot of cash.
What do CS majors do when they graduate? • Most are hired to develop software (program) • Productivity Programs • Operating Systems • WEB Applications (e-commerce) • Computer Graphics • Artificial Intelligence • Medical Software (CT Scan, MRI) • Aerospace Applications • Computation Biology • Research • Embedded Systems • Military Applications • Business Applications • Educational Software • Games • Movies/Entertainment
What do CS majors do when they graduate? • Some work as network and system administrators • Some go to graduate school • Some get research jobs • Some teach • Some start their own companies
The Outsourcing Scare Media Stresses Threat to US Jobs
Employment Outlook is Very Positive for Computer Science Graduates
National Trends in Computer Science Enrollment • Enrollment Trends 2000-2005 • 50% reduction in enrollment in CS courses • 70% reduction in major declarations
Why is CS141 important? • It provides the basic tool set required in virtually every other CS class. • With CS141 and CS142, you can probably get a job as a programmer. • Without at least CS241 and CS242 (or equivalent) you probably shouldn’t be allowed to get a job as a programmer
Why do many students have trouble in CS141? • It’s probably not how the course is taught. • Every college with a CS program has a course similar to CS141. • They all have relatively high numbers of students who have difficulties • They underestimate the amount of time they need to devote to it. • They get behind -- and because each concept builds on the others, it is hard to catch up.
How to Succeed in CS141 • Spend time working on the programs • Don’t miss any classes • Read the textbook as assigned • Come to office hours • Ask questions in class • Stay with the class (Don’t get behind). • Start programs as soon as they’re assigned • Expect to encounter problems • Don’t get frustrated. If you keep trying, you’ll get it. • Understand that the programs are good teachers -- learn from each mistake.
Learning to program is like learning to play tennis. • At first, you need to master fundamentals. • It will get to be much more fun as you become better at it. • You need to practice. You can’t do all the practicing the night before the match. • It might be frustrating at first, but you will be rewarded if you persevere. • You can’t really judge how much you like it until you get to a certain level of competency. • Anyone can do it if they dedicate enough time to it.
A more gentle introduction is available • CS131 (3 credits) MWF 9:30 • Visual Basic • Recommended for those who have never done any programming before.
What do computers do? • They do very, very, simple things • basic arithmetic on values in memory • Input/Output • Comparison and Conditional Execution • if-statements • They do it very, very, fast and very, very reliably. • Programmers build systems to do complicated things using these simple basic capabilities.
Think of a recipe. • We can use instructions that provide different levels of detail. • High Level • Make an apple pie • Lower Level • Slice 4 apples into one inch squares... • Even Lower Level • Pick up a knife, place the knife on the apple, apply pressure, …
Cooks use a standard set of instructions • Poach • Blend • Whip • Fry • Filet Recipes consist of a known set of instructions. Cooks translate these higher-level actions.
Computer Languages • A computer language defines the set of instructions that the programmer can use. • Programs are collections of these instructions.
Computer Hardware Executes Low-level Instructions • Programmers typically want to write programs using higher level instructions. • Different computer manufactures provide different low-level instructions.
High-level Languages • High-level languages allow programmers to use a more expressive set of instructions. • A compiler translates the high-level instructions the programmer writes to the low-level instruction set the computer understands. • Compilers allow programs to be portable, because the instructions are not tied to an particular instruction set.
Compilers Translate High-level instructions to a particular machine’s (native) instruction set. Program written in High-level Language Program using native instruction set Compiler The program the programmer writes is called source code. The program the compiler generates is called object code.
Compilers Translate High-level instructions to a particular machine’s (native) instruction set. Object code Source code Program written in High-level Language Program using Intel instruction set Microsoft Compiler Program using Motorola instruction set Apple Compiler
Programming Languages • FORTRAN - Scientific/Engineering (1957) • COBOL - business oriented language (1959) • C - applications and systems, dominated much of the eighties and early nineties. (K&R published 1978) • C++ - applications and systems, dominated much of the late nineties. (1980-1985) • Java - applications and network/web-based applications, rapidly gaining popularity. (1995) • Lisp and Prolog - Languages for AI (1959, 1970) • Pascal - language used to teach programming (1971) • Ada - language used in military applications (1983) • Basic - language used to teach programming (1965)
Generating a simple program • Write the program with a text editor or word processor. • Compile the program using a compiler. • Execute the compiled program.
Example using Windows • Write a program using the “notepad” editor. • Compile the program using Microsoft’s Visual C++. • Run the resulting program