Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”

Slides:



Advertisements
Similar presentations
Chapter 1: Computer Systems
Advertisements

COMP425M Introduction to Programming
Chapter 1: Introduction
1 Kursusform  13 uger med: Undervisning i klassen 1,5-2 timer Opgave ”regning” i databar (løsninger på hjemmeside) En midtvejsopgave der afleveres og.
The Java Programming Language
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
CHAPTER 1 INTRODUCTION GOALS  To understand the activity of programming  To learn about the architecture of computers  To learn about machine code and.
Outline Java program structure Basic program elements
01 Introduction1June Introduction CE : Fundamental Programming Techniques.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 1 Introduction. © 2004 Pearson Addison-Wesley. All rights reserved1-2 Outline Computer Processing Hardware Components Networks The Java Programming.
Chapter 1 Introduction.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
Chapter 1 Introduction.
HOW COMPUTERS MANIPULATE DATA Chapter 1 Coming up: Analog vs. Digital.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley John Lewis, Peter DePasquale, and Joseph Chase Chapter 1: Introduction.
© 2006 Pearson Education Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science A 2nd Edition.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Java Language and SW Dev’t
Programming 1 1. Introduction to object oriented programming and problem-solving.
Introduction to Computers and Java Chapter 1.3. A Sip of Java: Outline History of the Java Language Applets A First Java Program Compiling a Java Program.
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Chapter 1 Introduction 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design © 2007 Pearson Addison-Wesley. All rights reserved.
The Java Programming Language
Introduction. Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2.
Java Chapter 1 Problem solving: 1. Understanding the problem. 2. Breaking the problem into manageable pieces. 3. Designing a solution. 4. Considering alternatives.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Fall 2006Slides adapted from Java Concepts companion slides1 Introduction Advanced Programming ICOM 4015 Lecture 1 Reading: Java Concepts Chapter 1.
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Introduction to programming in the Java programming language.
Java The Java programming language was created by Sun Microsystems, Inc. It was introduced in 1995 and it's popularity has grown quickly since A programming.
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
1 Problem Solving b The purpose of writing a program is to solve a problem b The general steps in problem solving are: Understand the problemUnderstand.
TCU CoSc Introduction to Programming (with Java) Java Language Overview.
Intro to Programming  Chapter 1 Part 2  Problem Solving.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Chapter 1 Introduction. 2 Focus of the Course Object-Oriented Software Development problem solving program design, implementation, and testing object-oriented.
Objective You will be able to define the basic concepts of object-oriented programming with emphasis on objects and classes by taking notes, seeing examples,
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computers, Programs,
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Object Oriented Programming Idea Computer program may be seen as comprising a collection of objects Object Fundamental entity in a JAVA program Used to.
Working with Java.
Lecture 1 Introduction Richard Gesick.
Chapter 1 Introduction to Computers, Programs, and Java
Lecture 1B Introduction Richard Gesick
Introduction to.
1.3 Problem Solving The purpose of writing a program is to solve a problem The general steps in problem solving are: Understand the problem Dissect the.
Java programming lecture one
Chapter 1: Computer Systems
Fundamentals of Programming
Java Software Solutions Foundations of Program Design 9th Edition
Focus of the Course Object-Oriented Software Development
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
Computer Programming-1 CSC 111
Instructor: Alexander Stoytchev
Presentation transcript:

Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”

Aalborg Media Lab 21-Jun-15 Lecture Overview Chapter of “Java Software Solutions” Slides and exercises can be found on:

Aalborg Media Lab 21-Jun-15 Java Fundamentals Java is a object oriented language Java is accompanied by the “Java standard library ” Java can be executed using the web Is constantly under development Chapter 1.4

Aalborg Media Lab 21-Jun-15 A simple Java Application //************************************************** //Application printing a single line in console //************************************************** class HelloDan { public static void main(String args[]) //entry point { System.out.println (“What’s the frequency Kenneth?”); }

Aalborg Media Lab 21-Jun-15 Java’s Structure Every Java application consists of class definitions In the Java programming language: –A program is made up of one or more classes –A class contains one or more methods –A method contains program statements A Java application always contains a method called main (entry point)

Aalborg Media Lab 21-Jun-15 Using Objects The System.out object represents a destination to which we can send output In the HelloDan program, we invoked the println method of the System.out object: System.out.println ("What’s the frequency Kenneth?"); object methodinformation provided to the method (parameters)

Aalborg Media Lab 21-Jun-15 Using Comments Comments allow programmers to communicate their thoughts independent of the code Serves as documentation, VERY IMPORTANT !! Comments are “inline documentation” // this is a single line comment /* This is a block comment */

Aalborg Media Lab 21-Jun-15 Identifiers and Reserved Words Language consists of identifiers –Words we make up –Words another programmer did choose (for example when using the Java standard library) –Reserved words Java is case sensitive –Class  start with capital letter –Methods  start with small letter

Aalborg Media Lab 21-Jun-15 Code Style Use descriptive names Make your code readable by using blank spaces and new lines (Listing 1.2 & 1.3)

Aalborg Media Lab 21-Jun-15 About languages All programs must be translated to machine language in order to be executed and each type of CPU has its own specific binary machine language (01101…) There are four programming language levels: –machine language –assembly language –high-level language –fourth-generation language Chapter 1.5

Aalborg Media Lab 21-Jun-15 Compiler & Interpreters 1/2 Compilers are small programs translating a language (source code) into another language (target language) Interpreters interweaves translation and execution (one line at a time)

Aalborg Media Lab 21-Jun-15 Compiler

Aalborg Media Lab 21-Jun-15 Java Using Compiler & Interpreter

Aalborg Media Lab 21-Jun-15 Syntax & Semantic The syntax rules of a language define how we can put together symbols, reserved words, and identifiers to make a valid program The semantics of a program statement define what that statement means (its purpose or role in a program) A program that is syntactically correct is not necessarily logically (semantically) correct A program will always do what we tell it to do, not what we meant to tell it to do

Aalborg Media Lab 21-Jun-15 Errors The compiler will find syntax errors and other basic problems (compile-time errors) –If compile-time errors exist, an executable version of the program is not created A problem can occur during program execution, such as trying to divide by zero, which causes a program to terminate abnormally (run-time errors) A program may run, but produce incorrect results, perhaps using an incorrect formula (logical errors)

Aalborg Media Lab 21-Jun-15 Environment JDK –compile and execute BlueJ (editor) –writing the code

Aalborg Media Lab 21-Jun-15 Compiling and Execution The JDK and a simple Editor (Notepad) are enough for coding, compiling and execution

Aalborg Media Lab 21-Jun-15 BlueJ Environment Java based development environment for Java BlueJ

Aalborg Media Lab 21-Jun-15 Object-Oriented Programming Object is fundamental entity in Java Developing software by defining objects that interact with each other OOP is mapping real life situations into a program –Mapping objects and their behavior Chapter 1.6

Aalborg Media Lab 21-Jun-15 Problem Solving Life cycle of program development –Understand the problem –Design a solution –Considering alternatives / refining –Implementing the solution –Testing / fixing / refining the solution

Aalborg Media Lab 21-Jun-15 Concepts/Terminology of OOP Object (real object of the problem domain) Attribute (characteristics of objects, state) Method (objects behavior) Class (objects are defined trough classes, concept) –Multiple object can be created from a class Encapsulation –Only object itself can change his state (manages itself) Inheritance –Reuse of class concepts for similar classes Polymorphism

Aalborg Media Lab 21-Jun-15 Inheritance Bank Account Account Charge Account Savings Account Checking Account One class can be used to derive another via inheritance Classes can be organized into inheritance hierarchies

Aalborg Media Lab 21-Jun-15 Exercises Use BlueJ for following exercises –JSS 1.1 –JSS 1.3 Try out the Hello application (BlueJ demos) –Add method stop, printing “Bye, world”.