1 / 73

CTIS251-Week 1 Engineering Software and Java Dr. Ozlem Albayrak

CTIS251-Week 1 Engineering Software and Java Dr. Ozlem Albayrak. Menu. Introduction to the CTIS251 elements What is Engineering? Can we engineer software? Introduction to the java language programming concepts Primitive Data Types and Operations. Introduction to CTIS251.

stacy
Télécharger la présentation

CTIS251-Week 1 Engineering Software and Java Dr. Ozlem Albayrak

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CTIS251-Week 1 Engineering Software and Java Dr. Ozlem Albayrak

  2. Menu • Introduction to the CTIS251 elements • What is Engineering? • Can we engineer software? • Introduction to the java language programming concepts • Primitive Data Types and Operations

  3. Introduction to CTIS251 Course Elements: - Instructor - Students - Course Material

  4. Instructor • Dr. Ozlem Albayrak • Computer Eng. Bilkent, 1992 • M.B.A., Bilkent, 1994 • M.S., UMCP, 1998 • Phd., Ankara, 2002 Room# 212 Phone: 290 5039 E-mail: ozlemal@bilkent.edu.tr

  5. The Students • Attendance - Bonuses • Get to Know • Why are you here? • Expectations • Interests

  6. Office Hour? Tuesday 14:40 – 15:30 Thursday 8:40 – 10:30 via e-mail or phone for appointment

  7. Course Material Not limited to: • Syllabus • The main text book • References • All related high quality sources

  8. Syllabus • Distributed syllabus will be reviewed • Subjects • Grading (bonus questions) • Labs

  9. Syllabus (1)

  10. Syllabus (2)

  11. What is Engineering?

  12. Webster’s Definitions en·gi·neer·ing ( n j -nîr ng) n. The application of scientific and mathematical principles to practical ends such as the design, manufacture, and operation of efficient and economical structures, machines, processes, and systems. Problem solvers

  13. How is engineering software different from engineering bridges?

  14. Continuous Calculus Testing/analysis is easy: if the bridge holds for 1M kg, it also probably holds 0.99Mkg Discrete Logic, Discrete Mathematics Testing/analysis is difficult Bridges Software

  15. Made of physical stuff Some costs are obvious Changes after construction are hard Made of virtual stuff All costs are non-obvious Changes should be easy (but they’re not) Bridges Software for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { nextStates [i][j] = getCellAt (i, j).getNextState (); } }

  16. Obvious when it fails Bridge makers get sued Architects need licenses Falls down quietly (usually) Software vendors blame user, charge for upgrades Anyone can make software, no one gets sued Bridges Software

  17. Requirements are (usually) obvious and easy to describe A good design is apparent to everyone immediately Requirements are mysterious and hard to describe A good design is only apparent to “experts” but has impact later on GridDisplay Bridges Software CellAutomata Cell is a subtype of (extends) Grid ConwayLifeCell CellState

  18. JAVA

  19. Google search about Java.... • Returns approximately yaklaşık 307.000.000 result!

  20. Java Sources on the net • http://en.wikipedia.org/wiki/Java_%28programming_language%29 • http://java.net/ • http://java.sun.com/docs/books/tutorial/ • http://www.javaturkiye.com/ • Books: http://www.oreilly.com/pub/topic/java

  21. What is Java? • Island in Indonesia known for coffee and volcanoes • A Programming Language (Java) • A Portable Low-Level Language (JVML) • A Platform (JavaVM) • A (semi-)successful marketing strategy • JavaScript is not related to Java or Java • All of the above

  22. Compiling C++ Programs #include <stdio>main( int argc, char *argv[]) { // do something}

  23. Hello.java class Hello { public static void main(String[] args) { System.out.println( “Hello World” );} Hello.class …Method Hello() 0 aload_0 1 invokespecial #1 <Method java.lang.Object()> 4 returnMethod void main(java.lang.String[]) 0 getstatic #2 <Field java.io.PrintStream out> 3 ldc #3 <String "Hello World!"> 5 invokevirtual #4 <Method void println(String)> 8 return The Java Virtual Machine javac

  24. Hello.class Hello.class Hello.class The Java Virtual Machine class Hello { public static void main() { // do something} Win JVM Mac JVM Linux JVM

  25. Java : Programming Language “A simple, object-oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multithreaded, and dynamic language.” [Sun95] By the end of the course, you should have a good idea if this is a true statement.

  26. Platform Independence • C++ compiles to native code for a specific architecture (Linux, Windows…) • Java compiles to Java bytecode • Same bytecode runs on virtual machine for any platform • Only VM is platform specific • Good for downloadable code • Applets etc

  27. Java • Syntax • Similar to C++ • Designed to be easy for C and C++ programmers to learn • Semantics (what programs mean) • Similar to Scheme • Designed to make it easier to reason about properties of programs

  28. Programming Systems C++ Program Scheme Program C++ Compiler Scheme Interpreter Object Files Machine

  29. Portability If you can implement a Java VM on your machine, then you can run all Java programs Security A VM can limit what programs can do to the real machine Simplicity VM instructions can be simpler than machine instructions Java VM Java Program Why use a virtual machine? Java Compiler Class Files Java Virtual Machine Machine

  30. Programming in Java • Program is divided into classes • A class: • Defines a new datatype • Defines methods and state associated with that datatype • We call a value of a class datatype an object • Objects package state and code

  31. Introduction toJava Programming with JBuilder, 3E Y. Daniel Liang

  32. Sequence of the Topics

  33. Course Objectives • Upon completing the course, you will understand • Create, compile, and run Java programs • Primitive data types • Java control flow • Methods • Arrays (for teaching Java in two semesters, this could be the end) • Object-oriented programming • Core Java frameworks (Swing, exception, I/O, collections, multithreading, multimedia, )

  34. Course Objectives, cont. • You will be able to • Develop programs using various tools • Write simple programs using primitive data types, control statements, methods, and arrays • Understand object-oriented concepts and principles: abstraction, encapsulation, inheritance, and polymorphism • Develop a GUI interface and Java applets • Deal with exceptions in the program • Store and retrieve data using Java I/O • Use data structures from the Java Collections framework • Establish a firm foundation on Java concepts

  35. Chapter Dependency Chart

  36. Book Chapters • Part I: Fundamentals of Programming • Chapter 1 Introduction to Java and JBuilder • Chapter 2 Primitive Data Types and Operations • Chapter 3 Control Statements • Chapter 4 Methods • Chapter 5 Arrays

  37. Book Chapters, cont. • Part II: Object-Oriented Programming • Chapter 6 Objects and Classes • Chapter 7 Strings • Chapter 8 Inheritance and Polymorphism • Chapter 9 Abstract Classes and Interfaces • Chapter 10 Object-Oriented Analysis and Design

  38. Book Chapters, cont. • Part III: GUI Programming • Chapter 11 Getting Started with GUI Programming • Chapter 12 Event-Driven Programming • Chapter 13 Creating User Interfaces • Chapter 14 Applets

  39. Book Chapters, cont. • Part IV: Developing Comprehensive Projects • Chapter 15 Exceptions and Assertions • Chapter 16 Input and Output • Chapter 17 Java Data Structures • Chapter 18 Multithreading • Chapter 19 Multimedia

  40. Bonus Chapters on the CD-ROM • Part V: Bonus Chapters • Chapter 20 Internationalization • Chapter 21 Networking • Chapter 22 Database Programming • Chapter 18 Servlets • Chapter 19 JavaServer Pages

  41. Chapter 1 Introduction to Java and JBuilder • What Is Java? • Getting Started With Java Programming • Create, Compile and Running a Java Application

  42. What Is Java? • History • Characteristics of Java

  43. History • James Gosling and Sun Microsystems • Oak • Java, May 20, 1995, Sun World • HotJava • The first Java-enabled Web browser • JDK Evolutions • J2SE, J2ME, and J2EE (not mentioned in the book, but could discuss here optionally)

  44. Characteristics of Java • Java is simple • Java is object-oriented • Java is distributed • Java is interpreted • Java is robust • Java is secure • Java is architecture-neutral • Java is portable • Java’s performance • Java is multithreaded • Java is dynamic

  45. JDK Versions • JDK 1.02 (1995) • JDK 1.1 (1996) • Java 2 SDK v 1.2 (a.k.a JDK 1.2, 1998) • Java 2 SDK v 1.3 (a.k.a JDK 1.3, 2000) • Java 2 SDK v 1.4 (a.k.a JDK 1.4, 2002) • ... • ...

  46. JDK Editions • Java Standard Edition (J2SE) • J2SE can be used to develop client-side standalone applications or applets. • Java Enterprise Edition (J2EE) • J2EE can be used to develop server-side applications such as Java servlets and Java ServerPages. • Java Micro Edition (J2ME). • J2ME can be used to develop applications for mobile devices such as cell phones. This book uses J2SE to introduce Java programming.

  47. Java IDE Tools • Forte by Sun MicroSystems • Borland JBuilder • Microsoft Visual J++ • WebGain Café • IBM Visual Age for Java • IBM WSAD

  48. Getting Started with Java Programming • A Simple Java Application • Compiling Programs • Executing Applications

  49. A Simple Application Example 1.1 //This application program prints Welcome //to Java! package chapter1; public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } IMPORTANT NOTE: To run the program from the Run button, (1) set c:\jbuilder9\jdk1.4\bin on your path, and (2) copy both the slide directory and the example directory from the IR-CD to a directory (e.g., c:\LiangIR-CD) . Source Run

  50. Anatomy of a Java Program • Comments • Package • Reserved words • Modifiers • Statements • Blocks • Classes • Methods • The main method

More Related