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
CMSC 202 Introduction CMSC 202 Fall 2012 Instructors & Lecture Sections • Mr. Max Morawski – Section 01 • Mr. John Park – Section 06 and 11 Version 9/12 2 Course Format 2 Exams (15% each) 30% 1 Comprehensive Final Exam 20% 10 Lab Assignments (1% each) 10% 5 Projects (6, 7, 8, 9, 10%) 40% 3 Project Policies • Cheating: – If you any of your code shows up in someone else’s projects, the minimum penalty is a zero for that project. You could also fail the course or possibly get expelled. – There is a VERY high chance of getting caught. Last semester we caught around 20 students. 4 Project Policies • Projects must be submitted on time. Late projects will receive a zero. • You may submit exactly one project a semester up to three days late with no reduction of grade. • If you believe your grade is incorrect, you may contest it with your instructor within one week of getting your grade back. 5 What is CMSC 202? • An introduction to – Object-oriented programming (OOP) and object-oriented design (OOD) – Basic software engineering techniques • Strong emphasis on proper program design and maintainability • Tools • Java programming language • Eclipse integrated development environment (IDE) Version 9/12 3 Course Web Site www.cs.umbc.edu/courses/undergraduate/202/fall12 Version 9/12 4 Why Java for 202? • • • • Popular modern OO language Wide industry usage Used in many types of applications Duke, the Java Mascot Desirable features – Object-oriented – Portability (cross-platform) – Easy handling of dynamic variables – Garbage collection – Built-in GUI libraries Version 9/12 8 Some Java Background James Gosling* • Created by Sun Microsystems team led by James Gosling (1991) • Originally designed for programming home appliances – Writing a compiler (translation program) for each type of appliance processor would have been very costly. – Solution: use a two-step translation process • compile, then • interpret Version 9/12 *Wikipedia, 8/12 9 Interpreters, Compilers, and the JVM Interpreted Languages (e.g. JavaScript, Perl, Ruby) source code translate & execute interpreter Interpreter translates source into binary and executes it Small, easy to write Interpreter is unique to each platform (operating system) Compiled Languages (e.g. C, C++) source code compile binary code compiler execute Compiler is platform dependent command Java source code compile Java compiler Version 9/12 bytecode translate & execute Bytecode is platform independent JVM is an interpreter that Java Virtual Machine is platform dependent (JVM) 10 Sample C++ Compilation & Linkage Linux C++ code library binary library code Linux C++ compiler Any text editor Linux C++ binary Linux linker Linux C++ executable code C++ source code Windows C++ compiler Windows C++ binary Windows linker Windows C++ executable code binary library code Windows C++ code library Version 9/12 11 Sample Java Compilation, Interpretation, & Linkage Any text editor Java source code Any Java compiler (Linux, Windows, etc.) Java Runtime Environment (JRE) for Linux Java bytecode Java Runtime Environment (JRE) for Windows JRE contains •The Java API binary code •The Java Virtual Machine (JVM), which translates and runs the Java bytecode Version 9/12 12 A Peek at Python vs. Java Python Java public class Hello { public static void main(String[] args) { int quotient; System.out.println("Hello, world"); quotient = 3 / 4; if (quotient == 0) { System.out.print("3/4 == 0"); System.out.println(" in Java"); } else { System.out.println("3/4 != 0"); Some things to note regarding Java: } • Everything has to be in some class } • We need a “main()” procedure (method) } print "Hello, world" quotient = 3 / 4 if quotient == 0: print "3/4 == 0", print "in Python" else: print "3/4 != 0" • • • • • Statements end with “;” Variables must be declared “if/else” syntax different Statement blocks demarcated by “{...}” Much that is similar Version 9/12 15 A Peek at the Eclipse IDE • Integrated Development Environment (IDE) for writing Java programs. Contains (minimally): – – – – text editor debugger Java compiler Java JVM • Free download for Windows/Linux/Mac – See course “Resources” page on the CMSC 202 web site • Available in all OIT labs around campus – We’ll show you more in Lab 1 Version 9/12 16 Eclipse IDE Screenshot Version 9/12 17