140 likes | 182 Views
Understand the basics of computer science and programming, from algorithms to Java specifics. Discover the roles of Computer Science in society and the significance of programming in problem-solving.
E N D
Topic 1Introduction to Computer Scienceand Programming Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, andinstructor materials prepared by B. Ericson. Topic 1Introduction to Computer Scienceand Programming
Outline • What is Computer Science • Some of the roles of Computer Science in our society • What is in a computer • What is programming • What is a program • What a compiler does • Some specificities of Java
What is Computer Science? • The design, analysis, implementation, … • of algorithms, • that solve problems. Why study Computer Science? • computing is part of everything we do • develops your problem solving skills • Lots of jobs! • Network and data analysts, software engineers are projected to be some of the fastest growing professions, 2006-2016
Roles of Computer Science • Maintaining the technical infrastructure • network, software • But also many algorithmic challenges • AI for games • search or auction algorithms (Google, Bing) • medical imaging • cryptology (RIM) • low-power chips
CPU and RAM • Central Processing Unit (CPU)(processor) executes instructions • MainMemory (RAM) • Internal storage that holds the programs (instructions and data) currently executed • Made of switches, each of whichrepresents 0 or 1 and iscalled a bit(binary digit) • Information is lost when power is turned off
External memory and I/O • Secondary Memory: hard disks, CDs, DVDs, USB sticks • Provide long-term storage • Organized as files,each of which has a file name and a folder (directory)that contains it. • Input/Output (I/O) units: keyboard, mouse, screen, printer, webcam, etc. • Used for communications with the user
What is programming? • Programming is the process of creating detailed instructionsthat a computer can execute to accomplish some task • It is much like: • writing a recipe for your favorite dish • giving someone directions to your house • making a robot do what you want
What is a program? • Programs consist of • Instructions to perform a task • Datavalues used in performing the task • Programs are written in a language that a computer can understand • System.out.println(…) prints to the screen public class HelloWorld { public static void main(String[ ] args) { System.out.println("Hello World!"); } }
High-level languages • Programmers usually write programs in high-level languages • Java, C, C++, C#, Visual Basic, Python, Scheme, Lisp, Pascal, Fortran, etc. etc. • People-oriented: created to make it easier for programmers to write complicated programs • Machineindependent: not written for any particular kind of computer (Intel, Mac, etc.) • But computers do not understand high-level languages directly
Machine language • The machine language consists of the set of instructions that the CPU can execute directly • Instructions to the CPU (to add, subtract, read, store, etc) are made up of 0’s and 1’s • Machine dependent: each type of computer has its own machine language 000100111000010100100110101111001
High-level to machine language High-Level Language Program (source code) Compiler Machine Language Program (executable code) CPU
Java • A high-level language developed by Sun Microsystems in the early 1990s • Cross-platform • Object-oriented (later) • Widely used in business, science and education • One of the fastest-adopted technologies of all time! • Different from previous high-level languages
From program to execution Java source code Java Compiler Bytecode CPU Java Virtual Machine
Summary • Terminology introduced: • CPU, RAM • Bit • Program • High-Level Language • Machine Language • Compiler • Bytecode • Java Virtual Machine