Computational Expression Computer and Java Basics Janyl Jumadinova - - PowerPoint PPT Presentation

computational expression
SMART_READER_LITE
LIVE PREVIEW

Computational Expression Computer and Java Basics Janyl Jumadinova - - PowerPoint PPT Presentation

Computational Expression Computer and Java Basics Janyl Jumadinova 4 September, 2019 Janyl Jumadinova Computational Expression 4 September, 2019 1 / 22 What is Computer Science? A computation is a sequence of well-defined operations that


slide-1
SLIDE 1

Computational Expression

Computer and Java Basics Janyl Jumadinova 4 September, 2019

Janyl Jumadinova Computational Expression 4 September, 2019 1 / 22

slide-2
SLIDE 2

What is Computer Science?

A computation is a sequence of well-defined operations that lead from an initial starting point to a desired final outcome

Janyl Jumadinova Computational Expression 4 September, 2019 2 / 22

slide-3
SLIDE 3

What is Computer Science?

A computation is a sequence of well-defined operations that lead from an initial starting point to a desired final outcome

Computer science is the study of computation.

Computers are a medium for expression in computer science.

Janyl Jumadinova Computational Expression 4 September, 2019 2 / 22

slide-4
SLIDE 4

What is a computer?

Janyl Jumadinova Computational Expression 4 September, 2019 3 / 22

slide-5
SLIDE 5

Digital Computers

Information is broken into discrete pieces. Each piece is represented as a number, a binary number.

Janyl Jumadinova Computational Expression 4 September, 2019 4 / 22

slide-6
SLIDE 6

Digital Computers

Information is broken into discrete pieces. Each piece is represented as a number, a binary number. Binary Numbers: Base 2 system. A single bit: either 0 or 1

  • can represent two items, e.g. state of the light bulb.

N bits can represent 2N unique items.

Janyl Jumadinova Computational Expression 4 September, 2019 4 / 22

slide-7
SLIDE 7

What is a computer?

Janyl Jumadinova Computational Expression 4 September, 2019 5 / 22

slide-8
SLIDE 8

What is a computer?

Slow deployment times Huge costs Wasted resources Difficult to scale Difficult to migrate

Janyl Jumadinova Computational Expression 4 September, 2019 5 / 22

slide-9
SLIDE 9

IT Landscape is Changing

Janyl Jumadinova Computational Expression 4 September, 2019 6 / 22

slide-10
SLIDE 10

IT Landscape is Changing

Janyl Jumadinova Computational Expression 4 September, 2019 7 / 22

slide-11
SLIDE 11

Container-based Approach

Janyl Jumadinova Computational Expression 4 September, 2019 8 / 22

slide-12
SLIDE 12

Container-based Approach

Containers are an app level construct

Janyl Jumadinova Computational Expression 4 September, 2019 9 / 22

slide-13
SLIDE 13

Docker

Janyl Jumadinova Computational Expression 4 September, 2019 10 / 22

slide-14
SLIDE 14

Docker

Janyl Jumadinova Computational Expression 4 September, 2019 11 / 22

slide-15
SLIDE 15

Now the Bad News

Janyl Jumadinova Computational Expression 4 September, 2019 12 / 22

slide-16
SLIDE 16

Now the Bad News

In this class you will not learn how to make Docker images, containers, etc. - you are only using Docker to run your programs.

Janyl Jumadinova Computational Expression 4 September, 2019 12 / 22

slide-17
SLIDE 17

Now the Bad News

In this class you will not learn how to make Docker images, containers, etc. - you are only using Docker to run your programs. More bad news! Docker does not support Windows Home very well.

Janyl Jumadinova Computational Expression 4 September, 2019 12 / 22

slide-18
SLIDE 18

Now the Bad News

In this class you will not learn how to make Docker images, containers, etc. - you are only using Docker to run your programs. More bad news! Docker does not support Windows Home very well. Plan for Windows Home: install software (below) directly on the machine - not use Docker.

  • Will do this in the lab tomorrow, in addition to learning how to use Git.

Mac, Windows Pro/Enterprise will still use Docker Desktop - no need to install anything else.

Janyl Jumadinova Computational Expression 4 September, 2019 12 / 22

slide-19
SLIDE 19

Now the Bad News

In this class you will not learn how to make Docker images, containers, etc. - you are only using Docker to run your programs. More bad news! Docker does not support Windows Home very well. Plan for Windows Home: install software (below) directly on the machine - not use Docker.

  • Will do this in the lab tomorrow, in addition to learning how to use Git.

Mac, Windows Pro/Enterprise will still use Docker Desktop - no need to install anything else. Now we begin our adventure into programming!

Janyl Jumadinova Computational Expression 4 September, 2019 12 / 22

slide-20
SLIDE 20

What is Computer Programming?

Janyl Jumadinova Computational Expression 4 September, 2019 13 / 22

slide-21
SLIDE 21

What is Computer Programming?

Programming is the act of writing usable and useful software A program is a set of instructions

Janyl Jumadinova Computational Expression 4 September, 2019 13 / 22

slide-22
SLIDE 22

Programming Language

We will use Java programming language in this class Java is a programming language originally developed by Sun Microsystems and released in 1995 as a core component of Sun’s Java platform

Janyl Jumadinova Computational Expression 4 September, 2019 14 / 22

slide-23
SLIDE 23

HISTORY OF JAVA

Started development in 1991 at Sun Originally called Oak Intended for smart consumer-electronic devices Derives much syntax/concepts from C++ BCPL → B → C → C++ → Java Development almost halted, but 1993 saw introduction of web; Java was revamped to be able to easily add dynamic content to web pages Formally announced and released in May 1995 Released under GPL to the public in May 2007

Janyl Jumadinova Computational Expression 4 September, 2019 15 / 22

slide-24
SLIDE 24

Programming in Java

Java is an object-oriented programming language

Janyl Jumadinova Computational Expression 4 September, 2019 16 / 22

slide-25
SLIDE 25

Programming in Java

Java is an object-oriented programming language Objects are fundamental elements that make up a program

Janyl Jumadinova Computational Expression 4 September, 2019 16 / 22

slide-26
SLIDE 26

Programming in Java

Java is an object-oriented programming language Objects are fundamental elements that make up a program Java has a library of software, called Java API, that is available for your use

Janyl Jumadinova Computational Expression 4 September, 2019 16 / 22

slide-27
SLIDE 27

Java program development process

Janyl Jumadinova Computational Expression 4 September, 2019 17 / 22

slide-28
SLIDE 28

Simple first Java Program: “Hello World”

/** This is the first program people write in a new language, the "Hello World!". In Java, this file must be named Welcome.java, with the first part of the name, Welcome, being the same as the name of the class. The filename itself (not the class name) must always end in .java to indicate to the operating system that it’s a java source file. */ public class Welcome { public static void main ( String args[] ) { System.out.println ( "Hello World!" ); } }

For today, try running this on https://www.jdoodle.com/online-java-compiler/

Janyl Jumadinova Computational Expression 4 September, 2019 18 / 22

slide-29
SLIDE 29

Comments

Comments in Java can be one of three styles: Single line: starts at // anywhere on a line, ends at the end of that line Multi-line: starts with character sequence /* anywhere, ends with character sequence */ anywhere after that can span multiple lines javadoc: starts with character sequence /** anywhere, ends with character sequence */ anywhere, after that uses javadoc utility to create HTML documentation from code

Janyl Jumadinova Computational Expression 4 September, 2019 19 / 22

slide-30
SLIDE 30

public class Welcome:

public means that something is available across packages (reserved word) Name of the class has to be the same as the name of the .java file

Janyl Jumadinova Computational Expression 4 September, 2019 20 / 22

slide-31
SLIDE 31

public class Welcome:

public means that something is available across packages (reserved word) Name of the class has to be the same as the name of the .java file

public static void main ( String identifier[] ):

The particular form of main is required by Java. JVM starts executing here! main is a static method, it is part of its class and not part of objects. Strings in Java are sequence of characters

Janyl Jumadinova Computational Expression 4 September, 2019 20 / 22

slide-32
SLIDE 32

public class Welcome:

public means that something is available across packages (reserved word) Name of the class has to be the same as the name of the .java file

public static void main ( String identifier[] ):

The particular form of main is required by Java. JVM starts executing here! main is a static method, it is part of its class and not part of objects. Strings in Java are sequence of characters

Braces { } are used to collect statements into a ”block”

Janyl Jumadinova Computational Expression 4 September, 2019 20 / 22

slide-33
SLIDE 33

public class Welcome:

public means that something is available across packages (reserved word) Name of the class has to be the same as the name of the .java file

public static void main ( String identifier[] ):

The particular form of main is required by Java. JVM starts executing here! main is a static method, it is part of its class and not part of objects. Strings in Java are sequence of characters

Braces { } are used to collect statements into a ”block” Statements in Java end with semicolons.

Janyl Jumadinova Computational Expression 4 September, 2019 20 / 22

slide-34
SLIDE 34

Printing

println: New line after printing print: No new line printf: Can specify format - may learn this later

Janyl Jumadinova Computational Expression 4 September, 2019 21 / 22

slide-35
SLIDE 35

Character Strings

string literal in class String “ABC” “This is interesting” “ ” “91”

Janyl Jumadinova Computational Expression 4 September, 2019 22 / 22

slide-36
SLIDE 36

Character Strings

string literal in class String “ABC” “This is interesting” “ ” “91” Use print or println methods to print a character string to the terminal System.out.println(“CMPSC 111”); the string “CMPSC 111” is a parameter: data sent to a method

Janyl Jumadinova Computational Expression 4 September, 2019 22 / 22