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
Math 107 Introduction To Scientific Programming Acknowledgements … Portions of these notes reproduce charts, slides, and tables from: Java Software Solutions, 4th Edition (2005), by Lewis & Loftus Java: An Introduction To Computer Science & Programming, 3rd Edition (2004), by W. Savitch Some screen shots are: © Microsoft Corporation Other Acknowledgements: Solaris, Java, Java Beans, and JS2E SDK are © Sun Corporation Windows and Window XP are © Microsoft Corporation JCreator Pro and JCreator LE are © Xinox Corporation S.Horton/107/Ch. 1 Slide 2 Welcome To… Garbage in, Garbage out. - A common programmer’s lament. S.Horton/107/Ch. 1 Slide 3 Course Philosophy I have three major instructional goals for this class that can be summed up in: “Scientific Software Development in Java” S.Horton/107/Ch. 1 Slide 4 Course Philosophy - II I. Scientific II. Use computers to solve quantitative/scientific problems in math, science, economics, … Software Development Learn the process used to develop successful software programs; Learn algorithms and special data/control structures to solve problems; III. Java S.Horton/107/Ch. 1 Learn a programming language called Java that can instruct a computer how to operate and handle data. Slide 5 Math 107 & 107L Logistics Syllabus Walkthrough Instructor/Contact Info Course Material: Book/CD (Get Some Floppies) Lab Hours: M-F 8:00 am – 6:30 pm (Check posting) Computer Access – “Lab Packet” JCreator download: http://www.jcreator.com/ Sun Java Web site: http://java.sun.com S.Horton/107/Ch. 1 Slide 6 How To Succeed In This Class Read material BEFORE class Quickly setup/learn JCreator IDE Programming Projects Be prepared to iterate (cycle through multiple times) Be prepared to spend more time on software development outside of the lab Optional – Setup JCreator outside of lab for extra convenience S.Horton/107/Ch. 1 Slide 7 Course Introduction I. Before software, there is hardware! II. Introduction to Java III. Software design methodology IV. Getting started S.Horton/107/Ch. 1 Slide 8 I. A Crash Course in “PC Computer Hardware” You need to understand the hardware platform before you develop software for it! Many types of hardware platforms PCs / Mainframes/ Laptops Cell Phones / PDAs / Pocket PCs Embedded Systems: Medical Devices, Machines, … Different Computing Models S.Horton/107/Ch. 1 Client/Server, Enterprise/Server Distributed (VPN) Network Appliance/”Thin” Client Mobile/Wireless Slide 9 Simplified Schematic of PC Architecture CPU RAM or DRAM Software programs routinely have to manage some or all of these resources efficiently Internet Mouse “Hard drive” S.Horton/107/Ch. 1 Keyboard Slide 10 Micrograph of CPU Core CPU Memory or “Cache” ALU S.Horton/107/Ch. 1 Registers Control Unit Slide 11 Simplified PC Program Execution Model 1) OS loads executable code into Main Memory 2) Control unit fetches first line of executable code 3) Fetch-Decode-Execute cycle is initiated S.Horton/107/Ch. 1 Slide 12 II. Introduction to JAVA History First conceived at Sun in 1991 to program toasters! Inventor James Gosling apparently decided the name while out at a (what else) coffee shop. Oak – To Java – To Java Eveywhere. Recently, a big fight over Microsoft’s nonauthorized modifications for Windows (J++). S.Horton/107/Ch. 1 Slide 13 Introduction to Java Main Attributes General purpose programming language with all of the modern elements of OOP (encapsulation/ inheritance/ polymorphism…) Syntax similar to C/C++ Portability - “Write once, run many…” Also runs in web browsers (Applets) which means most types of computers Not controlled by Microsoft (controlled by Sun) S.Horton/107/Ch. 1 Slide 14 The Java Software Development Model – “Write Once, Run Many” Input JCreator Portable “Applets” J2SE (MS Windows) The biggest difference between this and some other development models is that the compilation process has been split into two parts S.Horton/107/Ch. 1 Java Virtual Machine (JVM) Slide 15 What Java Is Not – Assembler Language S.Horton/107/Ch. 1 Slide 16 The Popularity of Java The World Wide Web! S.Horton/107/Ch. 1 Slide 17 UCSD Supercomputer Center Internet Visualization Project S.Horton/107/Ch. 1 Slide 18 III. Software Design Methodology Single Person Design Cycle Debug Code Bullet-Proofing Painful & Time Consuming! Design Run Test S.Horton/107/Ch. 1 Deploy Slide 19 Major Goals in Software Design 1. Operational (Customer) • • Does it work? Does it meet the design specification? 2. Performance (Customer) • • Is it efficient (Speed/Memory/Disk Space)? Can it handle errors? 3. Maintainable (Programmer) • • S.Horton/107/Ch. 1 Is it understandable? Is it modifiable? Slide 20 IV. Getting Started! 1. Start the JCreator IDE 2. Input source code 3. Compile & Run S.Horton/107/Ch. 1 Slide 21 JCreator Integrated Development Environment (IDE) S.Horton/107/Ch. 1 Slide 22 The Traditional And Famous Hello World Program! /* * * * * * * * */ MyFirstJavaProgram is the Java version of the famous and traditional Hello World program which writes Hello world to the console window. Author: S. Horton Date: 8/01/03 public class MyFirstJavaProgram { public static void main(String[] args) { System.out.println("Hello world!"); } } S.Horton/107/Ch. 1 Slide 23 Select New-File, Input A Name & Path, Type Code Into Editor S.Horton/107/Ch. 1 Slide 24 Click Compile, Check For Errors, Click Run S.Horton/107/Ch. 1 Slide 25 If You Succeed … S.Horton/107/Ch. 1 Slide 26