Programming with Java - Lake

Download Report

Transcript Programming with Java - Lake

COP 2800
Lake Sumter State College
Mark Wilson, Instructor
Introductions
 Who
are you?
 What is your current educational goal?
 What do you know about computers and
programming?
 Why are you here (what do you want to get out
of this course)?
 Mark Wilson
([email protected])
 Software Engineer and IT Manager Since 1980
 BA, Psychology from Stetson, 1977
 MS, Computer Information Systems from FIT,
2011
Syllabus
 Head
First Java
• By Kathy Sierra, Bert Bates
• Publisher: O'Reilly Media
• Released: February 2005
• ISBN: 978-0596009205
 Oracle
Java SE Documentation
• http://www.oracle.com/technetwork/java/javase/do
cumentation/api-jsp136079.html?ssSourceSiteId=ocomen
 You
must have access to a computer to
successfully complete this course
 Required
• Windows 7 SP1 or Windows 8.1
• Oracle Java SE JDK 7u45 or later
• Eclipse IDE for Java Developers – Kepler SR 1 or
later
 Optional
(time permitting)
• Google Android SDK with ADT bundle or
• Google Android Studio





Learn fundamentals of programming using Java
Use the constructs of the Java programming language
as building blocks to develop correct, coherent
programs.
Analyze problems, develop object-oriented designs
that solve those problems, and transform those designs
to Java programs.
Understand the fundamentals of object-oriented
programming using the Java programming language.
Program using the fundamental software development
process, including design, coding, documentation,
testing, and debugging.

Programming assignments 50%
• Must compile and run without error.
• Must meet the requirements.
• Must include adequate documentation. Spelling and
grammar count.
• Must follow published coding standards
• Must demonstrate good programming practices.
• Must be turned in electronically no later than midnight of
the due date.




Mid-term exam 15%
Term project 20%
Final exam (cumulative) 15%
 Roll
each class session via sign-in list
 You should make every effort to attend each
class meeting since class discussion will
include material not found in the textbook.
 Withdrawal deadline: Friday, March 21, 2014
History
 Computers
were programmed using 1’s and 0’s
 Each computer had it’s own “machine
language”
 All programs, including operating systems had
to be completely rewritten for each new
computer
 Debugging approached impossible
 Engineers
started seeing patterns
 Effective debugging required human readable
instructions
 Assemblers converted human readable code to
machine language
 Assembly language tended to remain the same
for a given model line
 The
next level of abstraction
 Programmers needed to be able to port code
to many other computers
 Early compilers created assembly language
 Current compilers generate machine language
 FORTRAN – FORmula TRANslating System
 COBOL – COmmon Business-Oriented
Language
 Fortran
and Cobol are difficult languages
 Kemeny and Kurtz (Dartmouth) created BASIC
(Beginner's All-purpose Symbolic Instruction
Code) in 1964 to teach programming concepts
 Implemented as an interpreter in the 70’s
 CBASIC compiled to intermediate code
 Visual Basic is BASIC in name only
 Method
to
• Produce provably correct code
• Improve clarity (readability)
• Reduce development time
 Defined
a small set of well formed constructs
and rules for their use
 Bohm, Jacopini, Dijkstra, Hoare, et. al.
 Came to the fore in 1970’s
 ALGOL, Pascal, PL/1, JOVIAL, C
A
method to:
• Increase understanding.
• Reduce maintenance.
• Support evolution.
 Concepts
as objects
 Objects have attributes and behaviors
 Extends structured programming concepts
 Components based development
 Smalltalk, Ada, C++, C#, Java
 Originally
developed by Sun Microsystems
 Became an Oracle product when Oracle bought
Sun
 Abstracted from the hardware
• Java Virtual Machine
 Integral
Object Oriented Programming
• Derived from C and C++
 Portable
code
• Interpreter
• Machine independent “bytecode”
 Web
development (deprecated)
 Server room applications
 Legacy applications
 Android applications
Java and the Virtual Machine
Development Environment
 Java
Platform, Standard Edition
• JDK – Java for developers
• Server JRE – Server version of Java Runtime
Environment
• JRE – Java Runtime Environment for end-users
 Free
download from Oracle
• http://www.oracle.com/technetwork/java/javase/do
wnloads/jdk7-downloads-1880260.html
• Install using defaults
Integrated Development Environment
 Open Source Software
 Eclipse IDE for Java Developers

•
•
•
•
•
•
•
Code Recommenders Developer Tools
Eclipse Git Team Provider
Eclipse Java Development Tools
Maven Integration for Eclipse
Mylyn Task List
WindowBuilder Core
Eclipse XML Editors and Tools
Download and extract
 Must be able to find Java (Java in the path)

Hello World
 Formally
introduced by Kernighan and Richie
 Introduces basics for
• Minimum required source code
• Fundamental syntax
• Build process from source to executable
/*
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
/*
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
Block comments begin
with /* and end with */.
Nothing in between
executes.
/*
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
Everything in Java is a
class including the
application which must
be public.
/*
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
Classes (and other
blocks of code) are
enclosed in “curly
braces”.
/*
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
Classes contain attributes and
methods or behaviors. This is a
method. Every application class
must have a main method and it
must be public.
/*
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
A method within a class
within another class.
/*
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
Let’s see how it works…