CISC 124: Introduction To Computing Science II instructor: Margaret Lamb instructor's home page: www.cs.queensu.ca/home/malamb office: Goodwin 527 current office hours are always on my home page 1
Moodle & Web Site Both under construction at the moment. Hopefully available tomorrow. When initial versions are ready I will post on news forum with link to web site URL. 2
Textbook Official Textbook: "Absolute Java", 6 th edition available in book store Also acceptable: 5 th edition of "Absolute Java" "Introduction to Java Programming" (Lang) except 10 th edition is missing a topic we need other Java text if you already own one Warning: If you have an "unofficial" textbook you may have to search for topics. 3
Reading You are required to do the assigned readings AND come to class! It's not either/or...
Academic Integrity Everything you hand in must be your own work (assignments, quizzes, final) Exception: may do assignments in group (2-4 students), all names must be on submission Why? It's only fair! Queen's reputation, value of degrees 5
Accommodations If you require special accommodations for CISC 124, please give me a copy of your Accessibility letter as soon as possible. If you require special arrangements for your quizzes, I need your letter at least 10 days before the first quiz or I may not be able to arrange things for you. If your accommodations for quizzes include writing on a computer, you MUST apply to the exams office at least 10 days before the first quiz. If you miss the deadline I will not provide a computer for you. 6
Labs We will not be having labs every week! Some weeks we will have one-hour labs as help sessions before quizzes or assignment due dates We will also have some evening TA help sessions All labs & help sessions will be announced with the Moodle news forum
Learning about Object-Oriented Programming (OOP) Gaining more general programming experience Language used: Java What's This Course About? 8
A Brief History of Java Predecessors: CPL, BCPL (1960s) B (Bell labs, 1969) C (Bell labs, early 1970s) C++ (1980s, object-oriented) Java: Sun Microsystems (now part of Oracle) first public version 1995 design team led by Jim Gosling (Canadian!) initial target: embedded systems goals included: portability & reliability 1994: World Wide Web 9
Computer Languages & Translation Computers speak machine language binary codes for very simple operations. Very cumbersome for humans to read and write! No standard: every make/model has its own language. Assembly Language: Symbolic form of machine language Easier for humans to handle Simple program ("assembler") translates to machine language Still involves a lot of detail Still machine-dependent 10
High-Level Languages Idea: Languages that are closer to the way we think: logic, data types, mathematical notation Advantages: Easier/faster to read & write Can be translated into different machine languages Disadvantages: Needs a complicated translation program Not always completely portable depends on language design and translation programs Some efficiency penalties, depending on language and translation program. 11
Interpreter (Python, Basic) Compiler (C, C++) Hybrid Approach (Java) Translation Methods 12
Interpreter Reads & executes a program in a high-level language. Read a line or statement Figure out what it means Make it happen Repeat! Python Program input to program Python Interpreter output of program 13
Compiler Reads a program in a high-level language. Creates an equivalent program in machine language. Step 1: C Program C Compiler machine language program Step 2: input to program machine language program output of program 14
Pros & Cons Need For Extra Program: Compiler: Program is compiled once. You don't need the compiler to run the program. Interpreter: You need the interpreter each time you run the program. Efficiency: Interpreted languages traditionally viewed as less efficient. Changing with clever new technology ("just in time" compilation). Portability: Compilers: You need to write a compiler for every "platform" (hardware & OS) Interpreters: Not always necessary Both: Great care is needed to make a language truly portable (same results on all kinds of computers) 15
Java's Hybrid Approach JVM = Java Virtual Machine A hypothetical computer "Bytecode": the machine language of the JVM. Designed to suit the Java language, still pretty low-level. Step 1: (once) Java Program (.java) Java Compiler bytecode program (.class) Step 2: (every time you run the program) bytecode program (.class) Program Input Java Interpreter Program Output 16