Introduction to Java Programming

Similar documents
Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

Programming 1 - Honors

Programming 1. Lecture 1 COP 3014 Fall August 28, 2018

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

CHAPTER 1 Introduction to Computers and Java

An Introduction to Software Engineering. David Greenstein Monta Vista High School

From High Level to Machine Code. Compilation Overview. Computer Programs

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Chapter 1: Introduction to Computers and Programming

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java

The Computer System. Hardware = Physical Computer. Software = Computer Programs. People = End Users & Programmers. people

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

Java language. Part 1. Java fundamentals. Yevhen Berkunskyi, NUoS

Computers in Engineering COMP 208. Computer Structure. Computer Architecture. Computer Structure Michael A. Hawker

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

Chapter 1 Introduction to Computers, Programs, and Java

9/11/08 (c) 2008 Matthew J. Rutherford Class (c) 2008 Matthew J. Rutherford Class

Lecture 1: Introduction to Java

Computer Fundamentals

CSE 421 Course Overview and Introduction to Java

Computer Programming-1 CSC 111. Chapter 1 : Introduction

BITG 1113: Introduction To Computers And Programming Language LECTURE 1 LECTURE 1 1

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Chapter 1 Introduction to Computers, Programs, and Java

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java

C++ Spring Break Packet 11 The Java Programming Language

Introduction to Computers and Java

Introduction to Java and OOP. Hendrik Speleers

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Programming Languages. CS 180 Sunil Prabhakar Department of Computer Science Purdue University

Objectives. Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer?

CHAPTER 1. Introduction to JAVA Programming

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

Introduction to Computers and Java

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

Problem Solving and Program Design - Chapter 1. Cory L. Strope

Lecture 09. Ada to Software Engineering. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what

Chapter 1 Introduction to Computers, Programs, and Java

Notes of the course - Advanced Programming. Barbara Russo

Java Puzzle Ball Nick Ristuccia

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

Chapter 1. Introduction to Computers and Java Objects. Background information. » important regardless of programming language. Introduction to Java

An Introduc+on to Computers and Java CSC 121 Spring 2017 Howard Rosenthal

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Chapter 1 Introduction to Computers and Programming

Programming Languages FILS Andrei Vasilateanu

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 1

2 Introduction to Java. Introduction to Programming 1 1

Certified Core Java Developer VS-1036

Chapter 1: Why Program? Computers and Programming. Why Program?

CHAPTER 1: A GENERAL INTRODUCTION TO PROGRAMMING 1

Learning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Advanced Object-Oriented Programming Introduction to OOP and Java

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

MEAP Edition Manning Early Access Program Get Programming with Java Version 1

Chapter 1: Introduction to Computers, Programs, and Java

Lecture 1: Overview of Java

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

Getting Started with Java. Atul Prakash

1) What is the first step of the system development life cycle (SDLC)? A) Design B) Analysis C) Problem and Opportunity Identification D) Development

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

Lesson 01 Introduction

COMP Computer Basics. Yi Hong May 13, 2015

Chapter 1. Introduction

CHAPTER INTRODUCTION. Final Draft Oct. 15, Slides by Donald W. Smith TechNeTrain.com. Copyright 2013 by John Wiley & Sons. All rights reserved.

Chapter Goals. Contents. 1.1 Computer Programs

Lecture (01) Getting started. Dr. Ahmed ElShafee

An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal

Programming with Java

Introduction to Java Programming CPIT 202. WEWwwbvxnvbxmnhsgfkdjfcn

25. DECUS Symposium THE Application Development Environment for OpenVMS

Computer Principles and Components 1

CSC 121 Computers and Scientific Thinking

JAVA An overview for C++ programmers

JVM interprets the Java bytecode, controls how it interacts with the operating system and manages memory.

II. Compiling and launching from Command-Line, IDE A simple JAVA program

Introduction to Computers and Java

What is Java Platform?

Week 0: Intro to Computers and Programming. 1.1 Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components

C++ Programming Language Lecture 1 Introduction

Computer Architecture

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

Index. Course Outline. Grading Policy. Lab Time Distribution. Important Instructions

Introduction. CS 2210 Compiler Design Wonsun Ahn

LECTURE 2. Compilers and Interpreters

Java and Software Design

C H A P T E R 1. Introduction to Computers and Programming

History Introduction to Java Characteristics of Java Data types

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York

Transcription:

Introduction to Java Programming Lecture 1 CGS 3416 Spring 2017 1/9/2017

Main Components of a computer CPU - Central Processing Unit: The brain of the computer ISA - Instruction Set Architecture: the specific set of low-level instructions available to a CPU. Differs for various CPU types (Intel Pentium, Mac G4, etc) ALU - Arithmetic Logic Unit responsible for performing arithmetic calculations, as well as logical operations (comparisons for equality, inequality, for instance). Main Memory (RAM - Random Access Memory) Storage close to CPU Faster to access than hard disk Stores executing programs and data being currently worked on Secondary Memory hard disk, floppy disk, CD, DVD, etc.

Main Components of a computer Input devices mouse, keyboard, scanner, network card, etc. Output devices screen/console, printer, network card, etc. Operating System Examples: Mac OS, Windows XP, Linux Controls computer operations Manages allocation of resources for currently running applications

Memory Concepts Within a computer all data is stored as a sequence of bits, each of which can take on one of two values bit: a binary digit Stores the value 0 or 1 Smallest unit of storage in a computer byte: 8 bits Smallest addressable unit of storage in a computer Storage units (variables) in a program are 1 or more bytes Each byte in memory has an address (a number that identifies the location)

Programming, and Programming Languages Program - a set of instructions for a computer to execute Evolution of Programming languages Machine Language Based on machine s core instruction set Needed by computer, hard for humans to read (1 s and 0 s) Example: 1110110101010110001101010

Programming, and Programming Languages Assembly Language translation of machine instructions to symbols, slightly easier for humans to read Example: ADD $R1, $R2, $R3

Programming, and Programming Languages High-level procedural languages Abstraction of concepts into more human-readable terms Closer to natural language (i.e. what we speak) Easy to write and design, but must be translated for computer Examples include C, Pascal, Fortran Object-oriented languages Abstraction taken farther than procedural languages Objects model real-world objects, not only storing data (attributes), but having inherent behaviors (operations, functions) Easier to design and write good, portable, maintainable code Examples include Smalltalk, C++, Java

Code Translation Bridging the gap between high-level code and machine code Interpreted languages source code is directly run on an interpreter, a program that runs the code statements Compiled Languages A compiler program translates source code (what the programmer writes) to machine language (object code) A linker program puts various object code files together into an executable program (or other target type, like a DLL) C and C++ are compiled languages Java is a mix of both!

Software Development Involves more than just writing code

Software Development Analysis and problem definition Design - includes design of program or system structure, algorithms, user-interfaces, and more Implementation (coding) Testing - can be done during design, during implementation, and after implementation Maintenance - usually the major cost of a software system. Not part of development, but definitely part of the software life cycle

The Java Language Java is a programming language that evolved from C++ Both are object-oriented They both have much of the same syntax Began in the early 90 s, originally used for programming in intelligent consumer-electronic devices (internal chips, etc). Was originally named Oak by its creator, but changed when it was reliazed that there was already a language called Oak When the Web took off in the early 90s, Java gained popularity for use in adding dynamic content to web pages While applets surely helped Java gain quick popularity, they are by no means the most important use of the language

The Java Language Java is now used for a wide variety of purposes. Its large and rich set of pre-built packages makes it a very popular choice of software developers The Java language specification is owned and controlled by Sun Microsystems (An Oracle Company) API (Application Programmer Interface) documentation for standard libraries available on the Oracle website. Standard Development Kit, along with other development tools can be downloaded from http://www.oracle.com/technetwork/java/javase/downloads/index.html Latest version is Java SE 8 Java Standard Edition 8.0

Compiling and Running a Java program Java code compiled to an intermediate level bytecode bytecode runs on an interpreter the Java Virtual Machine Each platform needs its own JVM, but the same bytecode (generally speaking) runs on any JVM on any platform (i.e. the compiled version is portable) Typically Slower runtime than languages like C++, since running on an interpreter (and due to other factors)

Basic Creation and Execution of a Java program 1 Create source code with a text editor, store to disk Source code is just a plain text file. In Java, we give the filename an extension of.java to identify it as a source code file 2 Compilation The compiler does syntax checking, translation to bytecode in files with the.class extension bytecode is a translation of the source code to an intermediate level of code 3 Execution of Java program The loader is part of the Java Virtual Machine It loads the bytecode into memory and executes the instructions via an interpreter for the given platform (Windows, Mac, Linux, etc)

Integrated Development Environments An Integrated Development Environment (IDE) is a software package that includes all necessary tools for creating a program. Typcially includes: Text editor Compiler Loader Debugger Ability to launch and run applications from within IDE environment Other useful tools Java IDEs frequently use the Java Standard Development Kit (SDK) tools underneath, and provide a graphical interface through menus to access the underlying tools. Examples of Java IDEs IntelliJ NetBeans Eclipse

Some Important Java Tools javac - java compiler java - java interpreter jar - the java archive utility javadoc - utility for auto-generating Java documentation API pages JSP - Java Server Pages JRE - Java Runtime Environment J2SDK - Java 2 Standard Development Kit (sometimes JDK, Java Development Kit, for short) includes JRE

Relationship between Java, C++,C

Some benefits of Java (over C++) Vast collection of packages available in the Standard Development Kit (SDK) Easy-to-use API descriptions in HTML format on the Sun web site Standard format for building API descriptions for classes Easier to build programs with graphic interfaces (GUI) latest packages for GUI (Swing classes) not platform specific compiled bytecode runs on multiple platforms In C++, one would commonly have to use the GUI libraries for each different platform Some syntax has been made simplified (no header file, no destructors) Java Runtime Environment (JRE) does some things for you Automatic garbage collection (for dynamically allocated objects) more dynamic run-time checking automatic dynamic binding and polymorphic behavior

Some benefits of C++ (over Java) Programmer has more control and power in C++ In C++, programmer responsible for the details Control over addresses with pointers More control over efficient execution time and resource allocation/deallocation C++ programs will typically run faster, because compiled to machine s native instruction set dynamic allocation doesn t have to be used for all objects programmer has more power to optimize what they want C++ still has some extra and versatile features (that Java doesn t), like operator overloading and multiple inheritance, global variables.

Programming is about Problem Solving Algorithm - a finite sequence of steps to perform a specific task To solve a problem, you have to come up with the necessary step-by-step process before you can code it This is often the trickiest part of programming Some useful tools and techniques for formulating an algorithm Top-down Refinement: Decomposing a task into smaller and simpler steps, then breaking down each step into smaller steps, etc Pseudocode: Writing algorithms informally in a mixture of natural language and general types of code statements Flowcharting: If you can visualize it, it s often easier to follow and understand!

Top-down Refinement Printing a calendar for any given month.

Example of a Pseudocode

Example of a Flow Chart Write a program to compute factorial of a number in Java

Programming is about Problem Solving Testing - algorithms must also be tested! Does it do what is required? Does it handle all possible situations? Syntax vs. Semantics Syntax the grammar of a language. A syntax error: I is a programmer. Semantics the meaning of language constructs Correct syntax, but a semantic error: The car ate the lemur.