1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.

Slides:



Advertisements
Similar presentations
A Programmer's Introduction to Java - from a S/370 user (c) IDMS/SQL News
Advertisements

Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
Introduction to Java Kiyeol Ryu Java Programming Language.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
1 Introduction to Applets Overview l What is an Applet? l Steps for creating an applet l What is HTML? l Basic HTML tags l Drawing Simple Graphical shapes.
1 Applets Chapter 1 To understand:  why applets are used to extend the capabilities of Web pages  how an applet is executed and know about the restrictions.
Chapter 14 Applets. 2 Knowledge Goals Understand the differing roles of applications and applets Understand how a browser operates Understand the role.
Applets, Graphical User Interfaces, and Threads / Chapter 9 1 Applets, Graphical User Interfaces, and Threads.
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
WWW and Internet The Internet Creation of the Web Languages for document description Active web pages.
Developing User Interfaces (DUI) Chris North cs3724: HCI.
Getting Started What is Java? A programming language –Fully buzzword-compliant: A simple, object oriented, distributed, interpreted, robust, secure,
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Introduction to Java Programming CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.
Introduction to Java Programming with JBuilder 4
Introduction to Java Programming CS 21a: Introduction to Computing I First Semester,
CSE 452: Programming Languages Java and its Evolution.
Java Workshop for Teachers May 6, 2005 A Brief Look at the Java Programming Language.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Java Lecture 16: Dolores Zage. WWW n Was a method for distributing passive information n added forms and image maps n interaction was only a new way to.
JAVA APPLETS By: Ms. Humaira Siddiqui. Java and the Internet Java is considered to be a language well suited to be used in the internet. In contrast with.
Applets Chapter 17.  Java’s big splash onto the scene came in the mid 90’s. The people at Sun Microsystems had managed to work java programs into Web.
Introduction to Java Programming. History F James Gosling and Sun Microsystems F Oak F Java, May 20, 1995, Sun World F HotJava –The first Java-enabled.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
Introduction to Java and Object-Oriented Programming AJSS Computer Camp Department of Information Systems and Computer Science Ateneo de Manila University.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Java Applets. 2 Introduction to Java Applet Programs  Applications are stand alone programs executed with Java interpreter executed with Java interpreter.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
POS 406 Java Technology And Beginning Java Code
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Clement Allen, PhD Florida A&M University SUMMER 2006.
The Joy of Programming (also known as) Introduction to Object-Oriented Programming.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
Discovering Computers 2009 Chapter 13 Programming Languages and Program Development.
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
CSC 205 – Java Programming II Applet. Types of Java Programs Applets Applications Console applications Graphics applications Applications are stand-alone.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
Java and its Evolution. Contents Java Introduction Java Features How Java Differs from other OO languages Java and the World Wide Web Java Environment.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
Software Development Programming & Languages. Programming: A Five-Step Procedure Define the problem Design a solution Code the program Test the program.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
Lecture 1. Introduction to Programming and Java MIT- AITI 2003.
Chapter 1: An Overview of Computers and Programming Languages
Java -- A very Hot Object- Oriented Language Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of.
Your name CSCI/CMPE 3326 Object-Oriented Programming in Java Dongchul Kim Department of Computer Science University of Texas – Pan American 1.Applet.
Introduction to Programming. The Programming Process Create/Edit Program Compile Program Execute Program Compile Errors?Run-Time Errors? Source Program.
Creating a Java Application and Applet
CSI 3125, Preliminaries, page 1 Applet. CSI 3125, Preliminaries, page 2 Applet An applet is a Java program that runs in a Web browser. An applet can be.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 15: Java Basics Fundamentals of Web Programming.
Introduction to Java Programming, 4E Y. Daniel Liang.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Introduction to.
Advanced Programming Fall 2017.
Java Applets.
Introduction CSC 111.
A Programming Language for
Java Evolution Java History. Java Features.
Introducing Java.
Debugging Exercise 00 Try compiling the code samples.
Presentation transcript:

1 Programming Fundamentals AITI-GP

2 Introduction to Programming

3 The Programming Process Create/Edit Program Compile Program Execute Program Compile Errors?Run-Time Errors? Source Program Object Program

4 The Software Life Cycle Problem Solving Phase Analyze Problem Develop Solution (Algorithm construction) Verify Implementation Phase (Programming) Implement Algorithm Test Maintenance Phase

5 Problem Solving and Programming Problem Algorithm Program

6 Constructing Algorithms Pseudo-code English-like Concise Not constrained by language rules Flowchart Diagram Visual objects (rectangles, arrows, etc) to describe control flow

7 Algorithm Example (Pseudocode) Computing a total step 1. initialize total to zero step 2. while there is a number to read, repeat steps 2a and 2b: step 2a. read in the number step 2b. add number to total step 3. print out total

8 Introduction to Java

9 Computing in the 1990s The Internet and the WWW Graphical User Interfaces (GUIs) Object-oriented Programming (OOP)

10 The Internet A global network of computers The World Wide Web (WWW) users retrieve documents remote programs may be invoked Need language platforms that are: network-aware portable secure

11 Graphical User Interfaces Users interact with an application through visual objects: Windows, Buttons, Text fields, etc. Mouse and pointer facilitate certain actions: click, drag, drop, etc. “Visual Programming” focus is on handling UI objects and events

12 Object-Oriented Programming Program (revised definition): collection of interacting objects Object: a thing that has identity, state, and behavior instance of a class OOP: focus is on developing classes that specify state (variables) and behavior (functions)

13 Enter Java 1991 Sun Microsystems develops a language (based on C) for consumer electronic devices 1993 WWW explodes in popularity increased need for “dynamic” Web pages 1995 Sun formally announces Java for web use

14 What is Java? Java is a general purpose programming language that is: object-oriented interpreted, architecture-neutral, portable distributed (network-aware), secure simple, robust multi-threaded high-performance (?)

15 Two Types of Java Programs Applications general-purpose programs standalone executed through the operating system Applets programs meant for the WWW embedded in a Web page normally executed through a browser

16 Simple Java Application File: Hello.java // Hello World application public class Hello { public static void main(String args[]) { System.out.println(“Hello world”); }

17 Compilation and Execution Compile using javac (compiler) C> javac Hello.java Hello.class file is produced Execute using java (interpreter) C>java Hello requires a Hello.class file

18 Simple Java Applet File: HelloAgain.java import java.awt.*; import java.applet.Applet; public class HelloAgain extends Applet { public void paint(Graphics g) { g.drawString(“Hello”,50,50); }

19 Executing Applets After compiling the java program: Embed an “applet tag” in an.html document that references the.class file Open the.html document using a browser or the appletviewer

20 Sample.html Document File: HA.html My First Applet

21 What is HTML? Hypertext Markup Language Underlying language of Web pages A means of providing formatting instructions for presenting content Text-based.html documents: collection of content and controls (tags)

22 Java Program Structure Java Program (optional) import declarations class declaration Class class name should match its file name may extend an existing class (such as Applet) contains method/function declarations

23 Lab Exercises Create, compile, and execute the sample Java application and applet

24 Event-Driven Programming Programming User Interface events e.g., what happens when you click on a button Example: TFCopy1 Applet two text fields and a button clicking on the button causes the contents of a text field to be transferred to the other

25 Object Interaction in Java

26 Programming Paradigms Procedural Programming (C) focus is on writing procedures/functions program execution viewed as functions calling other functions Object-oriented Programming (Java) focus is on writing classes for objects program execution viewed as objects interacting with each other

27 OOP and Object Interaction Objects pass messages to each other An object responds to a message by executing an associated method defined in its class Causes a “chain reaction” The user could be viewed as an object Depicted in an Object Interaction Diagram

28 Hello.java Application System.out object println()

29 HelloAgain Applet: Creation USERBROWSER HelloAgain Applet g: Graphics object 1: Open HA.html 2: new 3: paint() 4: drawString() Note: new means the object of class HelloAgain is created

30 HelloAgain Applet: Another Scenario USERBROWSER HelloAgain Applet g: Graphics object 1: Move the browser window 2: paint() 3: drawString()