S517 Web Programming Assistant Professor Xiaozhong Liu

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

START DEFINITIONS values (3) N1 = (8, 1,-9) i N1 average N3,2 sum N2 = 0 temp N1 Do not guess or assume any values! Follow the values of the variables.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu.
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
An intro to programming The basic nitty-gritty that’ll make you scratch your head and say, “This is programming?”
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
CS107 Introduction to Computer Science Java Basics.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
 Define a problem  Prepare sequence of instructions for the computer to execute  Verify that the program works as expected.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
CS107 Introduction to Computer Science Java Basics.
Programming language A programming language is an artificial language designed to communicate instructions to a machine,languageinstructionsmachine particularly.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
CSCE 2013L: Lab 1 Overview  Java Basics The JVM Anatomy of a Java Program  Object-Oriented Programming Overview  Example: Payroll.java JDK Tools and.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
JAVA BASICS: Variables and References SYNTAX, ERRORS, AND DEBUGGING.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
CSE 131 Computer Science 1 Module 1: (basics of Java)
Basics of Java IMPORTANT: Read Chap 1-6 of How to think like a… Lecture 3.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
What does a computer program look like: a general overview.
A First Look at Java Chapter 2 1/29 & 2/2 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
Peyman Dodangeh Sharif University of Technology Spring 2014.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Computers, Variables and Types Engineering 1D04, Teaching Session 2.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
CS101: Introduction to Computer Science Slides adapted from Sedgewick and Wayne Copyright © Your First Java.
Overview of Java CSCI 392 Day One. Running C code vs Java code C Source Code C Compiler Object File (machine code) Library Files Linker Executable File.
S517 Web Programming Assistant Professor Xiaozhong Liu
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Programming for Interactivity Professor Bill Tomlinson Tuesday & Wednesday 6:00-7:50pm Fall 2005.
Decisions: Conditional Statements (informally called If Statements) IST 256 Application Programming for Information Systems.
CS 106 Introduction to Computer Science I 01 / 24 / 2007 Instructor: Michael Eckmann.
“Unboxing” means taking an Integer object and assigning its value to a primitive int. This is done using the.intValue( ) method. Example; Integer z = new.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Web Programming: If Statement and Servlet
GC101 Introduction to computer and program
Java Course Review.
Web App vs Mobile App.
Something about Java Introduction to Problem Solving and Programming 1.
Advanced Programming in Java
Chapter 2.
(Computer fundamental Lab)
Welcome to AP Computer Science A!
Welcome to AP Computer Science A!
Computer Programming-1 CSC 111
Intro to Programming (in JavaScript)
Presentation transcript:

S517 Web Programming Assistant Professor Xiaozhong Liu

Stay with S517 if… You are interested in programming, but don’t have a lot experience… You have basic HTML knowledge, but don’t have web programming experience… You are interested in Object-Oriented Programming (OOP) and JAVA… You may want drop S517 if… You have a lot experience in JAVA, C++, C, C#, VB.net… (you can learn java and C# web programming by yourself) You have NO interest to find a tech-related job!

What is programming?

JAVA Java is a general-purpose, concurrent, class-based, object-oriented computer programming language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to bytecode (class file) that can run on any Java virtual machine (JVM) regardless of computer architecture. Java is, as of 2012, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million users. [Wikipedia]

Information problem… Input Output

Information problem… Input ProgrammerSource File Compiler Library Java fileClass fileJar file Virtual Machine interpreter

Dynamic Page!!!

Web

Java Servlet API – HTTP protocol request respond dynamic

request respond

request respond Retrieval algorithm PageRank algorithm Ranking algorithm Result Presentation Personalization ……

Command line Or GUI Compute result Command line Or GUI Compute result Java Numeric Text File Internet … Numeric Text File Internet …

What is programming? Real WorldProgramming A student Public Class Student I am a student Student a_student = new Student( ) My name is Xiaozhong String name; name = “Xiaozhong” I was born in 1979 Int birth_year; birth_year = 1979 How old? Int age; age = 2013 – birth_year Use computer + programming to solve real-world problem…

A java example Real world problem: how to describe a student? 1. Define student public class student { String name; int age; } 2. Describe a student static void main public static void main(String[] args) { student stud_A = new student( ); stud_A.name = “Xiaozhong Liu” stud_A.age = 32; }

A java example Real world problem: add two numbers static void main public static void main(String[] args) { //input int number_1 = 20; int number_2 = 30; int sum; //process sum = number_1 + number_2; //output System.out.println(sum); }

Some Java Basics – Class name and file name should be the same ABC.java -> public class ABC { } – Source extension.java Compiled file extension.class – The compile process creates a.class file from the.java file Example: Project folder\src\MyProgram.java -> Project folder\build\MyProgram.class – Java is case sensitive

Output Information problem… Input Variable double price, pricewithtax; price = price = price* pricewithtax = price

VariableString String name = “Obama”; String name = “Obama”; int int age = 30; int age = 30; double double price = 15.25; double price = 15.25; boolean boolean dataplan = true; (or false) boolean dataplan = true; (or false) Variable type Variable name (no space, start With alphabet, case sensitive) Variable value

Memory Model Values in the process are stored in memory. – View memory as a sequence of slots that can hold values of different types Variables name the slots, sometimes called locations of memory Assignment can put values in variables

Memory int number_1 = 20; int number_2 = 30; int sum; sum = number_1 + number_2; System.out.println(sum); G …..

Memory int number_1 = 20; int number_2 = 30; int sum; sum = number_1 + number_2; System.out.println(sum); G ….. number_1 20

Memory int number_1 = 20; int number_2 = 30; int sum; sum = number_1 + number_2; System.out.println(sum); G ….. number_1 20 number_2 30

Memory int number_1 = 20; int number_2 = 30; int sum; sum = number_1 + number_2; System.out.println(sum); G ….. number_1 20 number_2 30 sum

Memory int number_1 = 20; int number_2 = 30; int sum; sum = number_1 + number_2; System.out.println(sum); G ….. number_1 20 number_2 30 sum 50 JAVA MOV AX, 20 ADD AX, 30 ……

Memory int number_1 = 20; int number_2 = 30; int sum; sum = number_1 + number_2; System.out.println(sum); G ….. number_2 30 sum??? java.lang.OutOfMemoryError

Standard arithmetic Java supports basic arithmetic operators: +, -, *, /, and %. Add two numbers? int number1, number2, result; numbers1 = 18; number2 = 9; result =number1 + number2; System.out.println(result);

double x, y; x = 7.486; y = x+15*x-7/x*x; (?????????) System,out.println(y);

Exercise: To convert from meters to feet, multiply the number of meters by meter = ???? Feet 5.68 feet = ???? meter

Exercise: Implement the following expression:

int number1 = 5; String number2 = “10”; int result; result = number1 + number2; What is the result??? Variable type conversion

double number; String str = “10.735”; number = Double.parseDouble(str) StringStringintint str = Integer.toString(num) num = Integer.parseInt(str); StringStringdoubledouble str = Double.toString(num) num = Double.parseDouble(str); Two questions: 1.What is “Double” and “Integer”??? 2. Why we need type conversion???

int number1, number2, sum; number1 = Integer.parseInt (jTextField1.getText()); number2 = Integer.parseInt (jTextField2.getText()); sum = number1 + number2; jLabel3.setText(Integer.toString(sum)); jTextField jTextField1.getText( ); jLabel jLabel3.setText (?????);

1.What is variable? 2.What is expression? 3.What is Standard arithmetic? 4.What is type conversion? 5.What is Web? What is Servlet? Homework: Install Eclipse + Tomcat in your PC or Mac

Final Project: Option 1: Find your data, create a web service… with Java Servlet + MySQL Database + JDBC Option 2: Build your “mini-Google” with Java Servlet + Lucene + Information Retrieval algorithms (Large Textual Dataset)