Week 2 Recap CSE 115 – Spring 2007. Object Oriented Program System of objects that communicate with one another to solve some problem.

Slides:



Advertisements
Similar presentations
IT151: Introduction to Programming
Advertisements

Dale Roberts Introduction to Java - First Program Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Chapter 1: Introduction
Java Syntax, Java Conventions, CSE 115 Conventions (Part 1) CSE 115 Spring 2006 January 25 & 27, 2006.
CSE 115 Week 5 February , Monday Announcements Exam 3 today Exam 3 today Lab 3 due this week Lab 3 due this week Exam 4 Monday 2/18 Exam.
Week 4 Recap CSE 115 Spring Formal Parameter Lists Comma-separated list of formal parameters Formal parameters are listed giving the type of the.
©2004 Brooks/Cole Chapter 1: Getting Started Sections Covered: 1.1Introduction to Programming 1.2Constructing a Java Program 1.3The print() and println()
Week 4 Recap CSE 115 Fall 2006 Section C. Decoupling Separation of concerns Defining what an object can do, not how it does it.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Java Syntax, Java Conventions, CSE 115 Conventions (Part 2) CSE 115 Spring 2006 January 30, February 1 & 3, 2006.
Week 5 Recap CSE 115 Spring Composition Informally called “has a” Represented in UML with a diamond- headed arc In code: Declare an instance variable.
CSE 115 Week 3 January 28 – February 1, Monday Announcements Software Installation Fest: 2/5 and 2/6 4pm – 7pm in Baldy 21 Software Installation.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Week 3 Recap CSE 115 – Spring Constructor Special capability of a class that sets up the initial state of the object. Constructor definitions are.
Week 3 Recap CSE 115 – Fall Java Source Code File Made up of: Package declaration Class definition.
Objects CSE 115 Spring 2006 January 25, Object-Oriented Program System of objects that communicate with one another and work together to solve a.
CSE 115 Week 2 January , Wednesday Announcements Pick up Syllabus if you need one Pick up Syllabus if you need one Recitation Change Form.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
Extending the Robot Programming Language In the Robot world 1 mile = 8 blocks Suppose we want a robot to run a marathon (26+ miles)? Does our program have.
Using Data Active Server Pages Objectives In this chapter, you will: Learn about variables and constants Explore application and session variables Learn.
A First Program Using C#
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
LESSON 2 CREATING A JAVA APPLICATION JAVA PROGRAMMING Compiled By: Edwin O. Okech [Tutor, Amoud University]
Basics Programming Concepts. Basics A computer program is a set of instructions to tell a computer what to do Machine language = circuit level language.
Comments are for people Header comments supply basic information about the artifact.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Python Basic Syntax. Basic Syntax - First Program 1 All python files will have extension.py put the following source code in a test.py file. print "Hello,
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
© 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 –
The Java Programming Language
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Introduction to programming in the Java programming language.
Jens Dalsgaard Nielsen Jan Dimon Bendtsen Dept. of Electronic Systems Basic Programming INS-basis GF, PDP and HST.
Java™ How to Program, 10/e © Copyright by Pearson Education, Inc. All Rights Reserved.
1 CSE1340 Class 4. 2 Objectives Write a simple computer program in Java Use Swing components to build the GUI Use proper naming conventions for classes.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
Identifiers Identifiers in Java are composed of a series of letters and digits where the first character must be a letter. –Identifiers should help to.
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
DOCUMENTATION SECTION GLOBAL DECLARATION SECTION
February 2 - 6,  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
Java FilesOops - Mistake Java lingoSyntax
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
MAHENDRAN. Session Objectives Session Objectives  Discuss the Origin of C  Features of C  Characteristics of C  Current Uses of C  “C” Programming.
Chapter 3 Introducing Java. Objectives and Goals 1. Define terminology associated with object- oriented programming. 2. Explain why Java is a widely used.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
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.
Quiz 1 A sample quiz 1 is linked to the grading page on the course web site. Everything up to and including this Friday’s lecture except that conditionals.
STRUCTURED PROGRAMMING Complete C++ Program. Content 2  Main Function  Preprocessor directives  User comments  Escape characters  cout statement.
The eclipse IDE IDE = “Integrated Development Environment”
Working with Java.
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Introduction to.
' C ' PROGRAMMING SRM-MCA.
Chapter 3 Introduction to Classes, Objects Methods and Strings
Chapter 3 Introduction to Classes, Objects Methods and Strings
Chapter 4 void Functions
CIS16 Application Development Programming with Visual Basic
Unit-1 Introduction to Java
Week 3 Object-based Programming: Classes and Objects
Notes from Week 5 CSE 115 Spring 2006 February 13, 15 & 17, 2006.
Object Oriented Programming in java
Java objects: a first view
February 2 - 6, 2009 CSE 113 B.
Presentation transcript:

Week 2 Recap CSE 115 – Spring 2007

Object Oriented Program System of objects that communicate with one another to solve some problem.

Objects Objects are made up of: Properties Features that describe an object Capabilities Actions that an object can perform

Formalizing our Design UML class diagrams What is a class? Classes are the formal specification of what we want our objects to be and what we want them to be able to do.

Class Boxes in UML

Working with Eclipse Eclipse is an IDE that will help make writing our programs easier First we must Edit (write the program) Then Compile (Eclipse helps us with this by doing it as we type) Then Run (We select Run from a menu to run our programs)

Java Files Java source code files end with a.java extension Once the code has been compiled, files with a.class extension are created It is these.class files that are “run” by the Java Virtual Machine.

Java Syntax We need to learn about the syntax (grammar) rules of Java so that our programs will compile. Once our program compiles, we can run it. Question: Just because a program compiles, does that mean it will execute correctly?

Java Syntax (cont) Java is case sensitive (as is Unix)

Java Source Code File Made up of: Package declaration Class definition

Package Declaration package identifier ; package is a keyword in Java – a word that has a special meaning identifier represents a name. Here we are identifying a package by name.

Packages Way to organize our classes so that like classes are grouped together. Putting a class in a package forces you to put those classes in the same directory on the system.

Identifiers Programmers can pick out identifiers if we follow these rules. Identifiers must begin with a letter or underscore Followed by zero or more letters, digits, or underscores No special characters allowed in an identifier Keywords are not allowed to be identifiers

Identifiers (Style) Rules are enforced by compiler. Style enforced by community (i.e. your grade) Style for identifiers for packages is that the first letter of a package name is lower-case, all other letters are lower-case, and we do not see underscores in package names.

Nested Packages You can put a package inside of another package. This is indicated by using the dot (period) in between package names. On the system, nested packages are directories inside other directories. If you are using something outside of your current package, you must give the fully-qualified package name.

Class Definition Made up of: Class Header Class Body Class Body is made up of: Definitions of properties Definitions of capabilities

Class Header public class identifier public is a keyword that is an access control modifier. It tells who has access to something. If public, everyone has access. class is another keyword that indicates we are about to start the definition of a class. The identifier here represents the name of the class.

Names of Classes Must follow rules of identifiers. Style: First letter upper-case, rest lower-case. If more than one word, capitalize each new word. No underscores in class names. Whatever you name the class is whatever you will name the file the class is defined in.

Class Body Starts with a { Ends with a }