Lecture 1 - Introduction (Class Notes)

Similar documents
CS 177 Recitation. Week 1 Intro to Java

Chapter 1 Introduction to Computers, Programs, and Java

Outline. CIS 110: Introduction to Computer Programming. What is Computer Science? What is computer programming? What is computer science?

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 1

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

COMP 215: INTRO TO PROGRAM DESIGN. Prof. Chris Jermaine Chris Prof. Chris Dr. Chris

Lesson 01 Introduction

C02: Overview of Software Development and Java

How to make a "hello world" program in Java with Eclipse *

Getting Started with Java. Atul Prakash

Lecture 4: Introduction to Java and your Development Environment

13 th Windsor Regional Secondary School Computer Programming Competition

Getting Started. Chapter 1. Java Programming FROM THE BEGINNING. Chapter 1: Getting Started

Lecture 02, Fall 2018 Friday September 7

CHAPTER 1 Introduction to Computers and Java

Chapter Two Bonus Lesson: JavaDoc

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

Getting started with Java

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

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

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

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

CMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016

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

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015

Program Development. Program Development. A Foundation for Programming. Program Development

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

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

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

Lesson 04: Our First Java Program (W01D4

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

Computer Components. Software{ User Programs. Operating System. Hardware

Introduction. Introduction to OOP with Java. Lecture 01: Introduction to OOP with Java - AKF Sep AbuKhleiF -

An overview of Java, Data types and variables

BASICS.

Identifiers. Identifiers are the words a programmer uses in a program Some identifiers are already defined. Some are made up by the programmer:

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

How to approach a computational problem

CHAPTER 1. Introduction to JAVA Programming

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

CompSci 125 Lecture 02

Fundamentals of Programming INTRODUCTION

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.

AP Computer Science Summer Assignment (updated 5/29/2018) DUE : Sept. 4, 2018

Module 1: Introduction to Computers, Programs, and Java

Chapter 2: Programming Concepts

Java Swing Introduction

(0) introduction to the course. how to learn a programming language. (0) course structure

Chapter 1 Introduction to Computers, Programs, and Java

Lab #1: A Quick Introduction to the Eclipse IDE

Lecture 1: Introduction to Java

Kickstart Intro to Java Part I

Lecture 1: Introduction to Java

Chapter 1 Introduction to Computers, Programs, and Java

Introduction to Java Programming

CS 201 Software Development Methods Spring Tutorial #1. Eclipse

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

Week 2: Data and Output

Introduction to Java

Java Bytecode (binary file)

1.1 Your First Program

CPS122 Lecture: From Python to Java

A Foundation for Programming

Introduction. Lecture 1 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz

Chapter 1 Introduction to Computers, Programs, and Java

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

1.1 Your First Program

Computer Hardware. Java Software Solutions Lewis & Loftus. Key Hardware Components 12/17/2013

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

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

1.1 Your First Program

Programming with Java

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java

! Widely available. ! Widely used. ! Variety of automatic checks for mistakes in programs. ! Embraces full set of modern abstractions. Caveat.

ALICE: An introduction to progamming

Scientific Computing

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

Computer Principles and Components 1

Chapter 1 Getting Started

CSC116: Introduction to Computing - Java

Java Programming. Atul Prakash

At its simplest, a computer is a collection of wires, transistors and electrical components that are connected in a specific way When you send

Introduction to Java

Getting Started (1.8.7) 9/2/2009

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Java and Software Design

Programming. Dr Ben Dudson University of York

Java Programming Fundamentals - Day Instructor: Jason Yoon Website:

CS 231 Data Structures and Algorithms, Fall 2016

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

Fundamentals of Programming. By Budditha Hettige

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

Day 2. COMP 1006/1406A Summer M. Jason Hinek Carleton University

G-WAN. Complete install process for Ubuntu (both for the 32 and the 64 OS versions).

Transcription:

Lecture 1 - Introduction (Class Notes) Outline: How does a computer work? Very brief! What is programming? The evolution of programming languages Generations of programming languages Compiled vs. Interpreted Procedural vs. Object-oriented Your first taste of a Java program Remember/memorize your "boiler plate" Give it a try (compile and run) My words, your words,..., and keywords Types of apps: Console-based vs. Graphical The process of writing a program Understand your problem Come out with a way to solve it: algorithm Edit, compile, and run If error, debug and try again IDE (Integrated Development Environment) Eclipse Netbeans Any thing else? How does a computer work? The knowledge lies on your fingertips - Try a google search on this subject on this question should yield a bunch of hits Major computer hardware components - A computer system has many components. Key components to facilitate computation are:

1. Central Processor Unit (CPU), usually a microprocessor nowadays 2. Memory chips 3. Input / output, such as keyboards, mice, printers, display units, etc. 4. Bus or bridges How do you put these components together? Computer architectures. - The role of each components: 1. CPU -- executes programs (to be precise, execute a sequence of program instructions) CPU is designed to understand a set of fixed instructions, call instruction set Which major brands of CPUs do you know? Different types of CPUs have different instruction sets. Can you give some examples? Have you ever thought about how a computer becomes so smart while at the same time its CPU really only understands a limited set of instructions? 2. Memory chips -- store input data, intermediate data, and final results for a program execution

3. Input / Output -- Keyboard and mice - provides input data for programs / tasks -- Display and printer - provides the results -- Ports, ports, how many ports can you imagine? What are their functions? 4. Bridges and buses -- Do we really talk about the bridges and buses as we see every day? No No No. -- Do you mean there are bridges and buses inside a computer? Yes Yes Yes. -- You cannot see them but they function the same way as physical bridges and buses -- They transport data or digital electronic signals instead of human traffic Major computer software components -- System software (operating systems, file systems, user interfaces, etc.) -- Application software (editors, office productivity suites, databases, browsers, etc.) What is programming? - Can someone tell me what you think programming is about? A wikipedia link: http://en.wikipedia.org/wiki/computer_programming Problem Solution A sequence of program statements (instructions) Take a solution of a quadratic equation as an example. How you program it into a working program is a good example of programming First you are going to decide which programming language to use. There are many programming languages out there. Choose which one?

It really depends on many factors. We give an overview on the evolution of the programming languages. The evolution of programming languages -- Generations of programming languages 1) Machine code -- all numbers (instructions and data) a) No translation is needed -- directly understandable by machines b) But do you dare to program this way? 2) Assembly languages -- symbolic name from instructions a) An assembler is needed to translate symbolic instructions into machine code b) Pseudo instructions added -- these do not translate into machine code c) Different family of CPUs may use different assembly languages 3) High-level languages -- every expressive a) A compiler or interpreter is needed to do the translation b) Examples: BASIC, Fortran, Pascal, C, C++, Ada, Java, Python, 4) Fourth-generation programming languages (4GL) -- designed to reduce programming effort -- Compiled vs. Interpreted 1. Is a compiler needed? 2. Is a interpreter needed? 3. What are the pros and cons? -- Procedural vs. Object-oriented (OO) 1. From procedural to object-oriented: a significant shift a. Procedural: very good for scientific computing b. OO is better to model the worldly reality (for business applications and

system controls) 2. What is the difference? Your thinking/designing pattern is totally different 3. Pros and cons Your first taste of a Java program Read this: http://introcs.cs.princeton.edu/java/11hello/ The above link also shows you how to get your first Java program working. Your first Java program (p. 11). Here is another one: public class HelloWorld { public static void main(string[] args) { System.out.println( Hello, World! ); } } The anatomy of the above Java program: 1. Every Java program starts with a public class -- called Main class a. What is the name of the class? 2. Inside the main class, there must be public static method (or function) by the name of main ; this method provides the entry point of the Java program 3. The System.outis an built-in Java object we talk to to get our print-outs. 4. The result of executing the program is a single-line output: Hello, World! Your boiler-plate code As you can see, quite some decorative stuff existed in the above code. This stuff is the boiler-plate code to get Java compiler happy.

While you may not be that happy, but someone higher than you said this has to be done! What can you do with it? Option 1 - Sigh as long as you like it to be Option 2 - (highly suggested) Get used to it Let s try to memorize it. Then take a piece of paper. Write the code out of your memory. Go... Compile and run See my demo. Try to remember the steps as I demo. - Edit and save source code: the file name has to be HelloWorld.java, matching the name of the class - Compile: use Java compiler (the input is the source code) javac HelloWorld.java What do you get out of this? HelloWorld.class(the binary output containing machine code) - Run: use java interpreter java HelloWorld You instruct java to execute HelloWorldclass (but.classis not needed because it is implied) My words, your words, and keywords

Take another look at our first Java code containing a bunch of words: 1. Typos really? What language are we speaking? Ex: HelloWorld, args, println 2. My words and your words: which are? Ex: HelloWorld, args 3. Specially reserved words for special meanings: keywords Ex: public / private, static, void, class Make sure use them as intended! The process of writing a program 1. Understand your problem: can be easy (purely simple) and hard (complex enough) 2. Figure out a solution (or algorithm): That has to work all the time (corner cases, etc.) Who can do such a perfect job? Otherwise we would not see blue screens, etc. 3. Edit, compile, and run Source code files binary code files Java virtual machine (run) 4. When all is not perfect, errors, test for errors, debug, fix errors, long-term maintenance (isn t it boring to do this? But someone has to do it. You and/or me!) Can all of these be made easier? Sort of What makes us different from animals? We build tools! Integrated Development Environments (IDE) How an IDE helps? Edit/Compile/Run/Debug and beyond Examples of Java IDEs: Dr. Java -- Light-weight, for students Eclipse -- developed by IBM initially

Netbeans -- now under Oracle Your instructor has chosen to use Netbeans. But you are free to try others. However I might not be able to help. (End of lecture 1)