Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
COM S 207 Basic Concepts: computer, program, programming … Instructor: Ying Cai Department of Computer Science Iowa State University [email protected] In the beginning Everything in computer is coded as 0 and 1 lowercase "a" 1100001 integer 20 10100 What is computer about 8-bit, 16-bit, 32-bit, 64-bit CPU? Computer Anatomy Program A sequence of instructions for a computer to execute All instructions are encoded into a string of 0/1 Program = stored instruction Program = CODE + data Programming The act of writing programs Programming language Machine language Computers use the alphabet 0 and 1 ONLY. Instructions are built from combinations of 0 and 1! Example 00101000 00000001 00000010 might mean ADD 1 and 2 Programming language Assembly language Still machine language alike, but more readable Example: ADD 1 and 2 00101000 00000001 00000010 Programming language High-level language: English-like languages FORTRAN, COBOL, Pascal, Basic, C, Icon C++, Java, ML Scheme, Lisp, Prolog Perl, Python, Ruby Language Elements Data types Primitive (integer, character, double, boolean, etc.) Constructed (string, list, array, object, etc.) Decision (if, switch, etc.) Loop (for, while, until, etc.) To write a program, it is critical that you understand the syntax and semantics of each instruction (also called statement). Compiler Convert a program into machine language instructions that can be executed by a computer Compiler Platform dependency In general, different languages and platforms need different compilers Portability and convenience are issues Compiler for Unix Compiler for Linux ::: Compiler for Mac Java Virtual Machine A virtual machine that can execute Java binary code Java Compiler Convert a program into machine language instructions that can be executed by a computer Tools Editor: allows you to enter and edit instructions Programmer converts pseudo-code (which he understands) to java code (something java compiler can understand) Compiler Converts java code (something java compiler can understand) to class files (something that a Java Virtual Machine can understand) JVM (Java Virtual Machine): executes/runs class files Debugger Allows you to have the JVM execute one instruction at a time and lets you see what is going on during the execution. This will help you to find runtime errors. Tools Integrated Development Environment (IDE): (e.g., Eclipse) has all above tools integrated into one tool.