INT2104
This presentation is the property of its rightful owner.
Sponsored Links
1 / 102

INT2104 การพัฒนาโปรแกรมเชิงวัตถุ (Object Oriented Programming Development) PowerPoint PPT Presentation


  • 111 Views
  • Uploaded on
  • Presentation posted in: General

INT2104 การพัฒนาโปรแกรมเชิงวัตถุ (Object Oriented Programming Development). www.thawatchai.net/int2104. ธวัฒน์ชัย ศิลังค์ประชา. แนวการสอน.

Download Presentation

INT2104 การพัฒนาโปรแกรมเชิงวัตถุ (Object Oriented Programming Development)

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Int2104 object oriented programming development

INT2104

(Object Oriented ProgrammingDevelopment)

www.thawatchai.net/int2104


Int2104 object oriented programming development

  • ( Introduction to Object-oriented) (object)(class)(Method)


Int2104 object oriented programming development

  • ( Control Structures) (String) (Array)

  • (Polymorphism) (MySQL)


Int2104 object oriented programming development

  • ( Introduction to Object-oriented ) (object) (class) (Method)


Int2104 object oriented programming development

  • (Object Programming with Java)

  • (ControlStructures)


Int2104 object oriented programming development

  • (String) (Array)

  • (Polymorphism) package(MySQL)


Int2104 object oriented programming development

  • Objects First with Java David Barnes & Michael Kolling 2009

    JAVA 2

    / : ,2550

  • 2.Computing Concepts with Java Essentials 3rd,Cay Horstmann @John Wiley& Sons,Inc ISBN 0-471-24371-x


Int2104 object oriented programming development

()

  • 1. JAVA 2

    / : ,2550

    2. JAVA ()

    / :

    3.Java GUI using NetBeans ,2551

    4. . 2551


Int2104 object oriented programming development

  • 1. JAVA 2

  • / : ,2552

  • 2 . JAVA ()

  • / :

  • 4.Java GUI using NetBeans ,2553

  • 5. . 2554

  • 6.http://www.thawatchai.net/int2104.


Int2104 object oriented programming development

5 5 15 = 0

Midterm 30

- 20

5

Final 30

100


Int2104 object oriented programming development

1

Java

  • , "write once, run anywhere"

  • Java

  • Java World Wide Web


Object oriented technology concepts

Object Oriented Technology Concepts


Object

Object

  • , , , ,


Object1

Object

  • , ,

  • ,


Int2104 object oriented programming development

Object

  • (Attribute)


Int2104 object oriented programming development

Object


Int2104 object oriented programming development

  • ,

  • ()


Int2104 object oriented programming development

  • (Object-Oriented Programming Languages) Java, C++, SmallTalk


Object class

Object & Class

Object

Object-Program

Object:Real-world


Anatomy of an object 1

Anatomy of an Object(1)

  • An object is an abstraction and has an identity

  • An object has a name (which may or may not be unique)

  • An object is anything exhibits structure and behavior

    - Structure

    Attribute that define the objects properties

    Each attribute takes on a single value for a given object

    - Behavior

    Operations performed on or by an object

    Each operation is implemented via a method

    Object can be related or linked to other objects


Anatomy of an object 2

Anatomy of an Object(2)


Object concept

Object Concept

  • Things

    Tangible Things =>Physical Things

    Intangible Things

    (Tole) ( )

    (Incident) Event

    (Interaction) ( 2 Object(-))


Int2104 object oriented programming development

1.()

Object

Tangible Things

,


Int2104 object oriented programming development

  • Intangible Things

  • (Tole) ( )

  • (Incident) Event

  • (Interaction) ( 2 Object(-))

    2.()

    Object


    Object concepts

    Object Concepts

    • Object = a thing thats a member of a class

      • Examples

      • Dwell here a while CLASS vs. OBJECT

    • Objects contain attributes + behaviors

    • Organization

      • Generalization/specialization hierarchies

      • Whole/part hierarchies


    Object class cont

    Object & Class (Cont.)

    Person

    (Person)

    John Chan

    Person

    Mary Lee

    Person

    Nelson Sze

    Class

    Objects


    Object class cont1

    Object & Class (Cont.)

    • Attribute:

      • An observable property of objects in a class

      • Each object in the class has a value for each attribute

      • The value may or may not be unique for an individual object


    Object class cont2

    Object & Class (Cont.)

    Person

    (Person)

    John Chan

    30

    Person

    Mary Lee

    24

    Person

    Nelson Sze

    60

    Name: String

    Age: int

    Class with attributes

    Objects


    Object class cont3

    Object & Class (Cont.)

    • Operation

      • A function or transformation that may be applied to or by an object in a class; e.g. Debit, Credit

      • All objects in a class share the same operations

      • Each operation has the current object as an implicit argument


    Object class cont4

    Object & Class (Cont.)

    • Method - The implementation of an operation in a class

    • Query - An operation which merely computes a value without modifying any object


    Object class cont5

    Object & Class (Cont.)

    Person

    Name

    Age

    Attributes

    Change Job

    Change Address

    Get Address

    Get Job

    Operations


    Class and object

    Class and Object

    Employee

    Employee

    Employee

    name:String

    name=Smith

    name=Sharp

    age=24

    age=52

    age:Integer

    Class Employee

    Objects instantiated from

    the class Employee


    Representing objects

    Professor Clark

    Representing Objects

    • An object is represented as rectangles with underlined names

    : Professor

    a + b = 10

    a + b = 10

    ProfessorClark

    Class Name Only

    ProfessorClark :

    Professor

    Object Name Only

    Class and Object Name

    (stay tuned for classes)


    What is a class

    What is a Class?

    • A class is a description of a group of objects with common properties (attributes), behavior (operations), relationships, and semantics

      • An object is an instance of a class

    • A class is an abstraction in that it:

      • Emphasizes relevant characteristics

      • Suppresses other characteristics

    OO Principle: Abstraction


    Sample class

    Sample Class

    Class

    Course

    Properties

    Name

    Location

    Days offered

    Credit hours

    Start time

    End time

    Behavior

    Add a student

    Delete a student

    Get course roster

    Determine if it is full

    a + b = 10


    Representing classes

    Representing Classes

    • A class is represented using a compartmented rectangle

    a + b = 10

    Professor

    Professor Clark


    Representing classes in the uml

    Representing Classes in the UML

    • A class is represented using a rectangle with compartments.

    Professor J Clark


    The relationship between classes and objects

    Professor Smith

    Professor Mellon

    Professor Jones

    The Relationship Between Classes and Objects

    • A class is an abstract definition of an object

      • It defines the structure and behavior of each object in the class

      • It serves as a template for creating objects

    • Objects are grouped into classes

    Objects

    Class

    Professor


    Basic principles of object technology

    Object Technology

    Abstraction

    Encapsulation

    Modularity

    Hierarchy

    Basic Principles of Object Technology


    About the java technology

    About the Java Technology .?


    Write once run anywhere

    Write once, run anywhere

    " "

    ..

    Consistently :

    Anywhere on any platform :

    Reliability :

    Security :

    Low Risk:

    C++, JAVA, Small Talk, Object Pascal,VBasic ??? We choose "JAVA".


    Java technology is both a programming language and a platform

    Java technology is both a programming language and a platform.

    About the Java Technology .?

    Java Platforms

    A platform is the hardware or software environment in which a program runs.


    A virtual machine

    A Virtual Machine

    • Compiler Interpreter

    Compiler : Compile Compile ByteCode

    Interpreter : ByteCode Load

    ByteCode


    Byte code and java virtual machine

    Binary

    File

    Source

    Code

    Binary

    File

    Pentium

    Compiler(Pentium)

    Binary

    File

    PowerPC

    Compiler(PowerPC)

    SPARC

    Compiler(SPARC)

    Byte Code and Java Virtual Machine

    • Existing Development Environment

    %cc Hello.c o Hello

    % Hello

    Binary Code

    Run


    Bytecodes and the java virtual machine

    Java

    Interpreter

    Java

    Code

    Java Compiler

    (Pentium)

    Pentium

    Java

    ByteCode

    (Independent on

    Platform)

    Java

    Interpreter

    Java Compiler

    (PowerPC)

    PowerPC

    Java

    Interpreter

    SPARC

    Java Compiler

    (SPARC)

    Bytecodes and the Java Virtual Machine

    • Java Development Environment

    %javac Hello.java

    Hello.class created

    % java Hello

    JVM

    Byte Code

    Run


    Java is cross platform

    Java is Cross-Platform?


    Java is cross platform1

    • Java

  • Source Code

  • Java Bytecode

    JIT Compiler

    or Interpreter

    Compiler

    (javac)

    Execution

    Java Bytecode

    Java is Cross-Platform?

    • Truth: Java programs can compile to machine-independent bytecode

    • Truth: All major operating systems have Java runtime environments

      • Most bundle it (Solaris, MacOS, Windows 2k, OS/2)

    Compile Time

    Run Time


    Java platforms

    Java Platforms

    • OS Platform Compile (Write One - Run Anywhere)

    • Web Page

    • Java Virtual Machine


    Int2104 object oriented programming development

    (Java Technology?)

    1. Java Virtual Machine (JVM)

    2. Java Runtime Environment (JRE)

    3. Java 2 Software Developer Kit (J2SDK)


    1 java virtual machine jvm

    1. Java Virtual Machine (JVM)

    (interpreter) (interpreter) JVM


    2 java runtime environment jre

    2.Java Runtime Environment (JRE)

    • Class loader

    • Bytecode Verifier

    • Runtime Interpreter

    • 3


    3 java 2 software developer kit j2sdk

    3. Java 2 Software Developer Kit (J2SDK)

    • Editor

      • (javac.exe)

      • (java.exe)


    2 platform of java 2

    2 (Platform of Java 2)

    Java 2 Platform, Enterprise Edition (J2EE)

    Java 2 Platform, Standard Edition (J2SE)

    Java 2 Platform, Micro Edition (J2ME)


    Java 2 platform standard edition j2se

    Java 2 Platform, Standard Edition (J2SE)

    • Java Application ()

    • Java Applet ( IE)


    Java application

    Java Application ()

    Class

    {

    }

    Byte code

    Byte code

    Byte code

    Byte code

    Java.exe

    Javac.exe

    compile

    Byte code file

    (.class)

    Source code

    (.java)

    Windows

    Unix

    Linux

    JVM

    JVM

    JVM


    Java applete

    Java Applete( )

    Java app

    applets

    Browser

    JVM

    JVM

    application

    Operating System

    Hardware


    Java 2 platform enterprise edition j2ee

    Java 2 Platform, Enterprise Edition (J2EE)

    • Application Server Web Server

    • Servlets, JSP XML


    Java 2 platform micro edition j2me

    Java 2 Platform, Micro Edition (J2ME)

    • Java 2 Platform, Micro Edition (J2ME)

    • (PDA : Personal

    • Digital Asistance)


    Standard java

    Standard Java

    • Sun JDK http://java.sun.com/

      • Standard 1.0 : JDK 1.0 [Old]

      • Standard 1.1 : JDK 1.1 , 1.1.6, 1.1.8 [Still using]

      • Standard 2 : JDK 1.2 , 1.2.2 , 1.3,1.4,1.5 [Current]

    • Microsoft JDK 4.0

    • IBM JDK 1.1.8

    • JDK Compiler, JVM, Class library, Documents,Demos and Tools


    Int2104 object oriented programming development

    • Java Application / Java Applet

    • Syntax

    • Standard Class Library

    • OOP

    • Application

    • Java Class/Components

    • Object Orient Design/UML

    • Design Pattern/Framwork

    • Java : Java2D, Java3D, JDBC, J2EE ....

    To be Java Master. You must coding, coding and coding


    Java development kit

    Java Development Kit

    • Jbuilder By Borland

    • Microsoft Visual J++

    • Semantec Cafe

    • Jfactory by Rouge Wave

    • IBM Visual Age for Java

    • NetBean IDE 6.1


    Int2104 object oriented programming development

    • Real J (Free 487 Kb) Java IDE FREE freejava java sun () RealJ JCreator RealJ Font Homepage : http://www.realJ.com/

    • BlueJ 2.1.3

    • Jeliot 3.0


    Int2104 object oriented programming development


    Int2104 object oriented programming development

    • HelloWorld


    Int2104 object oriented programming development


    Int2104 object oriented programming development

    • .. 1990

    • (Pattrick Naughton)

    • (James Gosling)

      • (personal computer) (consumer electronics)


    Int2104 object oriented programming development

    • (Bill Joy)

    • HotJava

    • Netscape Navigator

    • 23 .. 1996 JDK1.0


    Int2104 object oriented programming development


    Int2104 object oriented programming development


    Int2104 object oriented programming development


    Int2104 object oriented programming development

    • (garbage collection)

      • 794 interfaces

      • 2485 classes


    Int2104 object oriented programming development


    Platform

    (platform)

    • Hardware

    • Software


    Int2104 object oriented programming development

    • Java 2 Platform, Standard Edition (J2SE)

      • (Java application)

      • (Java applet)

    • Java 2 Platform, Enterprise Edition(J2EE)

      • (multitiered)

    • Java 2 Platform, Micro Edition (J2ME)

      • (personal digital assistant) (TV set-top box


    Int2104 object oriented programming development


    Int2104 object oriented programming development

    (JDK)

    • (Java Development Kit - JDK)

      • (javac.exe)

      • (Java Runtime Environment - JRE) (java.exe)

    • Download http://java.sun.com


    Int2104 object oriented programming development

    • Notepad

      • Windows

    • J-Lab

      • http://www.cp.eng.chula.ac.th/~somchai/JLab/

    • Netbeans

      • http://www.netbeans.org/

    • Eclipse

      • http://www.eclipse.org/


    Notepad

    Notepad


    J lab

    J-Lab


    Netbeans

    Netbeans


    Eclipse

    Eclipse


    Helloworld

    HelloWorld


    Helloworld1

    HelloWorld

    • Hello, World!


    Int2104 object oriented programming development

    cmd

    2

    1

    3


    Int2104 object oriented programming development


    Helloworld2

    HelloWorld

    public classHelloWorld

    {

    }


    Helloworld3

    HelloWorld

    public class HelloWorld

    {

    public static void main(String[] args)

    {

    }

    }


    Helloworld4

    HelloWorld

    public class HelloWorld

    {

    public static void main(String[] args)

    {

    System.out.println("Hello, World!");

    }

    }


    Helloworld5

    HelloWorld


    Helloworld6

    HelloWorld

    import java.awt.*;

    import javax.swing.*;

    public class HelloGraphicsWorld {

    public static void main(String[] args) {

    JFrame frame = new JFrame() {

    public void paint(Graphics g) {

    g.drawString("Hello, World!", 110, 150);

    g.drawOval(100, 130, 90, 30);

    }

    };

    frame.setSize(300, 300);

    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    frame.setVisible(true);

    }

    }


    Int2104 object oriented programming development

    • //print the word hello

    • /*

      This program

      will print

      the word hello

      */


    Int2104 object oriented programming development

    • javadoc

      /**

      */


    Int2104 object oriented programming development


    Int2104 object oriented programming development


    Int2104 object oriented programming development

    • java

    • javac

    • class

    • class JRE

    • java .class main()

    • System.out.println("")


    Int2104 object oriented programming development

    • Ex1. HelloWorld


    Int2104 object oriented programming development

    Ex1.

    public class Ex1

    {

    public static void main(String[] args)

    {

    System.out.println("Hello, World!");

    }

    }


    Int2104 object oriented programming development

    1

    • Ex2. Hello World


    Int2104 object oriented programming development

    Ex2.

    public class Ex2 {

    public static void main(String[] args) {

    System.out.println("Hello");

    System.out.println("World");

    }

    }


    Int2104 object oriented programming development

    1

    • Ex3. Hello,World

      public class Ex3

      {

      public void main(string[] args)

      {

      system.out.print(Hello);

      system.out.print(,World);

      }

      }


    Int2104 object oriented programming development

    Ex3.

    public class Ex3

    {

    public static void main(String[] args)

    {

    System.out.print("Hello");

    System.out.print(", World!");

    }

    }


    Int2104 object oriented programming development


  • Login