Java Interfaces. 6 April 2016 OSU CSE 1

Size: px
Start display at page:

Download "Java Interfaces. 6 April 2016 OSU CSE 1"

Transcription

1 Java Interfaces 6 April 2016 OSU CSE 1

2 Conceptual Framework A firm conceptual foundation for understanding and designing modern software recognizes: Modern software consists of potentially large numbers of components that are composed into larger components/systems In Java, one ordinarily thinks of a class as a component, with its client-visible specification in the interface(s) it implements 6 April 2016 OSU CSE 2

3 Conceptual Framework An interface contains a A description firm conceptual of what foundation for understanding software does. and designing modern software recognizes: Modern software consists of potentially large numbers of components that are composed into larger components/systems In Java, one ordinarily thinks of a class as a component, with its client-visible specification in the interface(s) it implements 6 April 2016 OSU CSE 3

4 Conceptual Framework An interface contains a A class contains a description of how the software does it. A description firm conceptual of what foundation for understanding software does. and designing modern software recognizes: Modern software consists of potentially large numbers of components that are composed into larger components/systems In Java, one ordinarily thinks of a class as a component, with its client-visible specification in the interface(s) it implements 6 April 2016 OSU CSE 4

5 Anatomy of an Interface /** * An informal Javadoc comment. * [additional Javadoc comments as needed; in our * case: the mathematical model, contract(s) for * constructor(s), optional contract for iterator] */ public interface I { // contract(s) for method(s) } 6 April 2016 OSU CSE 5

6 Anatomy of an Interface /** * An informal Javadoc comment. An interface may extend one or more other interfaces. * [additional Javadoc comments as needed; in our * case: the mathematical model, contract(s) for * constructor(s), optional contract for iterator] */ public interface I extends I1, I2 { // contract(s) for method(s) } 6 April 2016 OSU CSE 6

7 /** Anatomy of an Interface * An informal Javadoc comment. An interface may be generic, as seen here; formal parameter T may have any name, but T is * [additional Javadoc comments as needed; in our * case: the mathematical model, contract(s) for typical (for type ). * constructor(s), optional contract for iterator] */ public interface I<T> extends I1<T>, I2 { // contract(s) for method(s) } 6 April 2016 OSU CSE 7

8 Technicalities Interfaces may be used to define: instance methods static final variables ( constants ) Not constructors Not static methods Not instance variables 6 April 2016 OSU CSE 8

9 Technicalities Interfaces may be used to define: instance methods static final variables ( constants ) Not constructors Not static methods Not instance variables All instance methods in an interface are automatically public abstract. 6 April 2016 OSU CSE 9

10 Technicalities Interfaces may be used to define: instance methods static final variables ( constants ) Not constructors Not static methods Not instance variables Variables are automatically public static final; it is unusual for an interface to define variables. 6 April 2016 OSU CSE 10

11 Technicalities Interfaces may be used to define: instance methods static final variables ( constants ) Not constructors Not static methods Not instance variables A constructor always has the name of a class, and is not an instance method. 6 April 2016 OSU CSE 11

12 Technicalities Interfaces may be used to define: instance methods static final variables ( constants ) Not constructors Not static methods Not instance variables As of Java 8, interfaces allow static methods with their implementations. But providing code in interfaces goes against our use of interfaces for client views (this biases designs to instance methods). 6 April 2016 OSU CSE 12

13 Technicalities Interfaces may be used to define: instance methods static final variables ( constants ) Not constructors Not static methods Not instance variables This is a good thing: instance variables are not client-view information! 6 April 2016 OSU CSE 13

14 Example: Queue Component Family Standard Iterable extends extends QueueKernel Queue extends 6 April 2016 OSU CSE 14

15 Example: Queue Component Family Standard Iterable extends Which methods are in Standard, and why? extends QueueKernel extends Queue 6 April 2016 OSU CSE 15

16 Example: Queue Component We call the Family core Standard interface in this design style the kernel Iterable interface. extends extends QueueKernel Queue extends 6 April 2016 OSU CSE 16

17 Example: Queue Component We call the Family most Standard powerful interface in this design style the enhanced Iterable interface. extends extends QueueKernel Queue extends 6 April 2016 OSU CSE 17

18 Let s Examine... Standard QueueKernel Queue Ask about details, e.g.: Design choices (math model, constructor, kernel methods, other methods) Javadoc (compare code in the Java interface with the generated documentation) 6 April 2016 OSU CSE 18

19 Interface Design The kernel interface defines: The mathematical model for the type Contract(s) for the constructor(s) Contract(s) for kernel methods Contract(s) for methods inherited from Java library interfaces that do not have their own contract specifications (if applicable; e.g., an iterator or a comparator) The enhanced interface defines contracts for all other methods for the type 6 April 2016 OSU CSE 19

20 Kernel Design Guidelines Kernel methods generally should be: A minimal set of methods that is functionally complete, i.e., powerful enough to: Give a variable of the type any allowable value Determine the value of a variable of the type Powerful enough to allow a client to: Implement equals and tostring Check every kernel method s precondition 6 April 2016 OSU CSE 20

21 Kernel Design Guidelines Kernel methods generally should be: A minimal set of methods that is functionally complete, i.e., powerful enough to: Minimal means if any proposed Give a variable of kernel the type method any allowable were left out, value you Determine the value could of a not variable satisfy of one the type of the completeness tests though Implement equals sometimes and tostring an extra kernel method is so parsimonious it is Check every kernel included method s in the precondition kernel anyway! Powerful enough to allow a client to: 6 April 2016 OSU CSE 21

22 Notice: Circularity public interface QueueKernel<T> extends Standard<Queue<T>>, Iterable<T> {... } public interface Queue<T> extends QueueKernel<T> {... } 6 April 2016 OSU CSE 22

23 Notice: Circularity public interface QueueKernel<T> } extends Standard<Queue<T>>, Iterable<T> {... public interface Queue<T> } extends QueueKernel<T> {... Using Queue<T> is necessary because it is the return type of newinstance and the interface type we always use to declare Queue variables. 6 April 2016 OSU CSE 23

24 What Mentions What? Standard Iterable mentions mentions QueueKernel mentions mentions Queue 6 April 2016 OSU CSE 24

25 Interface = Type Java permits the circularity here because: A Java interface defines a type, i.e., the type name (which we consider to denote a set of mathematical model values that certain variables might have) along with the set of its instance methods An interface type may be used in Java even if there is no implementation of it in scope 6 April 2016 OSU CSE 25

26 Interfaces: Only At Compile-Time Interfaces are a compile-time construct Used by the Java compiler for type-checking with declared types: to make sure variables are used only where they make sense Recall the rules for declared types and object (dynamic) types Once a Java program compiles, only object types are kept at run-time Declared types literally disappear in the JVM 6 April 2016 OSU CSE 26

27 The declared type of a variable may be an interface type The object type can never be an interface type, because you may not instantiate a variable using new followed by Interfaces: Only At Compile-Time an Interfaces interface type are a compile-time construct If the declared type is an interface type, then the object type (a class) must implement the declared type (an interface) Used by the Java compiler for type-checking with declared types: to make sure variables are used only where they make sense Recall the rules for declared types and object (dynamic) types Once a Java program compiles, only object types are kept at run-time Declared types literally disappear in the JVM 6 April 2016 OSU CSE 27

28 Javadoc Tags Recall that the short one-sentence informal overview, and the following standard Javadoc tags, are 6 April 2016 OSU CSE 28

29 Javadoc Tags Recall that the short one-sentence informal overview, and the following standard Javadoc tags, are Checkstyle warns you if they are missing when they should be there. 6 April 2016 OSU CSE 29

30 Custom Javadoc Tags Javadoc supports custom tags that can be introduced to document various aspects not considered when Javadoc was introduced Example: contracts 6 April 2016 OSU CSE 30

31 OSU CSE Custom Contract Tags Custom Tags Custom Tags @iterator 6 April 2016 OSU CSE 31

32 OSU CSE Custom Contract Tags Custom Tags for Constructors Custom Tags @requires 6 April 2016 OSU CSE 32

33 Packages Each OSU CSE component family is bundled into its own package, i.e., a grouping of interfaces and classes that the designer thinks belong together for logical reasons Example: the Queue-family components are all in the package components.queue 6 April 2016 OSU CSE 33

34 Packages Are Useful A package provides: Logical structuring: packages are hierarchical, i.e., you may have packages within packages A namespace: units in different packages may have the same name without conflict See also import statements Another level of access control between public and private 6 April 2016 OSU CSE 34

35 Packages Are Useful A package provides: Logical structuring: But any packages apparent control are hierarchical, is easily i.e., you may circumvented have packages and illusory, within packages so we do A namespace: units not in recommend different using packages it. may have the same name without conflict See also import statements Another level of access control between public and private 6 April 2016 OSU CSE 35

36 Package Declaration package components.queue; import components.standard.standard; public interface Queue<T>... A Java file must be in a file system directory matching the package name Eclipse handles this correspondence for you At most one package declaration per file If there is no package declaration, interface/class is in unnamed default package 6 April 2016 OSU CSE 36

37 Package Declaration package components.queue; import components.standard.standard; public interface Queue<T>... A Java file must be in a file system directory matching the package name This line declares that the interface (or class) in the current file belongs to the package components.queue. Eclipse handles this correspondence for you At most one package declaration in a file If there is no package declaration, interface/class is in unnamed default package 6 April 2016 OSU CSE 37

38 Package Declaration package components.queue; import components.standard.standard; public interface Queue<T>... A Java file must be in a file system directory matching the package name This line brings the interface Standard into scope, from the package components.standard. Eclipse handles this correspondence for you At most one package declaration in a file If there is no package declaration, interface/class is in unnamed default package 6 April 2016 OSU CSE 38

39 Resources Big Java Late Objects, Section 9.6: Interface Types javadoc The Java API Documentation Generator 6 April 2016 OSU CSE 39

Kernel Implementations III. 6 May 2013 OSU CSE 1

Kernel Implementations III. 6 May 2013 OSU CSE 1 Kernel Implementations III 6 May 2013 OSU CSE 1 Implementing a Kernel Class From the examples so far, you should see there are two major questions to address: Q1: What data representation (a.k.a. data

More information

Kernel Implementations I. 27 June 2013 OSU CSE 1

Kernel Implementations I. 27 June 2013 OSU CSE 1 Kernel Implementations I 27 June 2013 OSU CSE 1 So, What s Inside the Computer? Consider any popular video game, e.g., Nintendo Wii bowling Are there bowling balls and bowling pins inside the game console

More information

Repeated Arguments. 26 April 2013 OSU CSE 1

Repeated Arguments. 26 April 2013 OSU CSE 1 Repeated Arguments 26 April 2013 OSU CSE 1 Sources of Aliasing Aliased references for mutable types can cause trouble, so it is important to know how aliases might arise One way (which is easy to recognize

More information

Java Collections Framework. 24 April 2013 OSU CSE 1

Java Collections Framework. 24 April 2013 OSU CSE 1 Java Collections Framework 24 April 2013 OSU CSE 1 Overview The Java Collections Framework (JCF) is a group of interfaces and classes similar to the OSU CSE components The similarities will become clearly

More information

Array. 9 January 2015 OSU CSE 1

Array. 9 January 2015 OSU CSE 1 Array 9 January 2015 OSU CSE 1 Array The Array component family allows you to manipulate arrays in a way that overcomes surprising limitations of built-in Java arrays, but retains the time/space performance

More information

Chapter 4 Java Language Fundamentals

Chapter 4 Java Language Fundamentals Chapter 4 Java Language Fundamentals Develop code that declares classes, interfaces, and enums, and includes the appropriate use of package and import statements Explain the effect of modifiers Given an

More information

CS112 Lecture: Defining Instantiable Classes

CS112 Lecture: Defining Instantiable Classes CS112 Lecture: Defining Instantiable Classes Last revised 2/3/05 Objectives: 1. To describe the process of defining an instantiable class 2. To discuss public and private visibility modifiers. Materials:

More information

Write for your audience

Write for your audience Comments Write for your audience Program documentation is for programmers, not end users There are two groups of programmers, and they need different kinds of documentation Some programmers need to use

More information

Javadoc. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 7

Javadoc. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 7 Javadoc Computer Science and Engineering College of Engineering The Ohio State University Lecture 7 Motivation Over the lifetime of a project, it is easy for documentation and implementation to diverge

More information

Packages. Examples of package names: points java.lang com.sun.security drawing.figures

Packages. Examples of package names: points java.lang com.sun.security drawing.figures Packages To make classes easier to find and to use, to avoid naming conflicts, and to control access, programmers bundle groups of related classes and interfaces into packages. A package is a program module

More information

More About Heaps. 14 June 2017 OSU CSE 1

More About Heaps. 14 June 2017 OSU CSE 1 More About Heaps 14 June 2017 OSU CSE 1 Complete Binary Tree As Array To use an Array to represent a complete binary tree, you need more information: An int index of the root of the tree of interest There

More information

Address book. Presenting the Java assignment about an Address Book v

Address book. Presenting the Java assignment about an Address Book v Address book Presenting the Java assignment about an Address Book v.2-2018 Description Make an address book Text interface (command line) Stores contacts between runs Topics and skills covered error handling

More information

CMSC131. Library Classes

CMSC131. Library Classes CMSC131 Designing Classes Library Classes Due to Java being 100% object-oriented, all code must live inside a class but there is some functionality/information that might be best kept in a more central

More information

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount

More information

Chapter 15: Object Oriented Programming

Chapter 15: Object Oriented Programming Chapter 15: Object Oriented Programming Think Java: How to Think Like a Computer Scientist 5.1.2 by Allen B. Downey How do Software Developers use OOP? Defining classes to create objects UML diagrams to

More information

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within

More information

Symbol Tables Symbol Table: In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is

More information

Chapter 4: Writing Classes

Chapter 4: Writing Classes Chapter 4: Writing Classes Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Writing Classes We've been using predefined classes. Now we will learn to write our own

More information

Lecture 02, Fall 2018 Friday September 7

Lecture 02, Fall 2018 Friday September 7 Anatomy of a class Oliver W. Layton CS231: Data Structures and Algorithms Lecture 02, Fall 2018 Friday September 7 Follow-up Python is also cross-platform. What s the advantage of Java? It s true: Python

More information

CPS122 Lecture: Defining a Class

CPS122 Lecture: Defining a Class Objectives: CPS122 Lecture: Defining a Class last revised January 14, 2016 1. To introduce structure of a Java class 2. To introduce the different kinds of Java variables (instance, class, parameter, local)

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,

More information

CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards

CompuScholar, Inc. Alignment to Nevada Computer Science Course Standards CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards Nevada Course Details: Course Name: Computer Science Primary Cluster: Information and Media Technologies Standards Course Code(s):

More information

Inheritance. Benefits of Java s Inheritance. 1. Reusability of code 2. Code Sharing 3. Consistency in using an interface. Classes

Inheritance. Benefits of Java s Inheritance. 1. Reusability of code 2. Code Sharing 3. Consistency in using an interface. Classes Inheritance Inheritance is the mechanism of deriving new class from old one, old class is knows as superclass and new class is known as subclass. The subclass inherits all of its instances variables and

More information

Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Thursday, April 25, 13

Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Thursday, April 25, 13 Queue Implemented with 1 2 numitems = enqueue (); 1 Queue Implemented with 2 numitems = 2 enqueue (); enqueue (); 2 Queue Implemented with 2 numitems = 2 enqueue (); enqueue (); enqueue (5); enqueue (6);

More information

QueueBlock, ReversalADT, LinkedList,CustomerAccount, not MaintainCustomerData

QueueBlock, ReversalADT, LinkedList,CustomerAccount, not MaintainCustomerData Naming Conventions Rules Classes Use nouns Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML) Begin with upper case

More information

Classes, interfaces, & documentation. Review of basic building blocks

Classes, interfaces, & documentation. Review of basic building blocks Classes, interfaces, & documentation Review of basic building blocks Objects Data structures literally, storage containers for data constitute object knowledge or state Operations an object can perform

More information

Problem 1: Building and testing your own linked indexed list

Problem 1: Building and testing your own linked indexed list CSCI 200 Lab 8 Implementing a Linked Indexed List In this lab, you will be constructing a linked indexed list. You ll then use your list to build and test a new linked queue implementation. Objectives:

More information

CS260 Intro to Java & Android 02.Java Technology

CS260 Intro to Java & Android 02.Java Technology CS260 Intro to Java & Android 02.Java Technology CS260 - Intro to Java & Android 1 Getting Started: http://docs.oracle.com/javase/tutorial/getstarted/index.html Java Technology is: (a) a programming language

More information

Review sheet for Final Exam (List of objectives for this course)

Review sheet for Final Exam (List of objectives for this course) Review sheet for Final Exam (List of objectives for this course) Please be sure to see other review sheets for this semester Please be sure to review tests from this semester Week 1 Introduction Chapter

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

Java Programming Tutorial 1

Java Programming Tutorial 1 Java Programming Tutorial 1 Every programming language has two defining characteristics: Syntax Semantics Programming Writing code with good style also provides the following benefits: It improves the

More information

JAVA: A Primer. By: Amrita Rajagopal

JAVA: A Primer. By: Amrita Rajagopal JAVA: A Primer By: Amrita Rajagopal 1 Some facts about JAVA JAVA is an Object Oriented Programming language (OOP) Everything in Java is an object application-- a Java program that executes independently

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Version of January 21, 2013 Abstract Review of object-oriented programming concepts: Implementing

More information

Java Loose Ends. 11 December 2017 OSU CSE 1

Java Loose Ends. 11 December 2017 OSU CSE 1 Java Loose Ends 11 December 2017 OSU CSE 1 What Else? A few Java issues introduced earlier deserve a more in-depth treatment: Try-Catch and Exceptions Members (static vs. instance) Nested interfaces and

More information

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl...

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl... Page 1 of 13 Units: - All - Teacher: ProgIIIJavaI, CORE Course: ProgIIIJavaI Year: 2012-13 Intro to Java How is data stored by a computer system? What does a compiler do? What are the advantages of using

More information

Anatomy of a Class Encapsulation Anatomy of a Method

Anatomy of a Class Encapsulation Anatomy of a Method Writing Classes Writing Classes We've been using predefined classes. Now we will learn to write our own classes to define objects Chapter 4 focuses on: class definitions instance data encapsulation and

More information

Defining Classes and Methods

Defining Classes and Methods Defining Classes and Methods Chapter 5 Modified by James O Reilly Class and Method Definitions OOP- Object Oriented Programming Big Ideas: Group data and related functions (methods) into Objects (Encapsulation)

More information

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline ::

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline :: Module Title Duration : Intro to JAVA SE7 and Programming using JAVA SE7 : 9 days Course Description The Java SE 7 Fundamentals course was designed to enable students with little or no programming experience

More information

CS 215 Software Design Homework 3 Due: February 28, 11:30 PM

CS 215 Software Design Homework 3 Due: February 28, 11:30 PM CS 215 Software Design Homework 3 Due: February 28, 11:30 PM Objectives Specifying and checking class invariants Writing an abstract class Writing an immutable class Background Polynomials are a common

More information

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED

UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED EXERCISE 11.1 1. static public final int DEFAULT_NUM_SCORES = 3; 2. Java allocates a separate set of memory cells in each instance

More information

COMP 250 Winter 2011 Reading: Java background January 5, 2011

COMP 250 Winter 2011 Reading: Java background January 5, 2011 Almost all of you have taken COMP 202 or equivalent, so I am assuming that you are familiar with the basic techniques and definitions of Java covered in that course. Those of you who have not taken a COMP

More information

CSSE2002/7023 The University of Queensland

CSSE2002/7023 The University of Queensland CSSE2002 / CSSE7023 Semester 1, 2016 Assignment 1 Goal: The goal of this assignment is to gain practical experience with data abstraction, unit testing and using the Java class libraries (the Java 8 SE

More information

JavaScript: the language of browser interactions. Claudia Hauff TI1506: Web and Database Technology

JavaScript: the language of browser interactions. Claudia Hauff TI1506: Web and Database Technology JavaScript: the language of browser interactions Claudia Hauff TI1506: Web and Database Technology ti1506-ewi@tudelft.nl Densest Web lecture of this course. Coding takes time. Be friendly with Codecademy

More information

6.170 Laboratory in Software Engineering Java Style Guide. Overview. Descriptive names. Consistent indentation and spacing. Page 1 of 5.

6.170 Laboratory in Software Engineering Java Style Guide. Overview. Descriptive names. Consistent indentation and spacing. Page 1 of 5. Page 1 of 5 6.170 Laboratory in Software Engineering Java Style Guide Contents: Overview Descriptive names Consistent indentation and spacing Informative comments Commenting code TODO comments 6.170 Javadocs

More information

CS Exam 1 Review Suggestions

CS Exam 1 Review Suggestions CS 235 - Fall 2015 - Exam 1 Review Suggestions p. 1 last modified: 2015-09-30 CS 235 - Exam 1 Review Suggestions You are responsible for material covered in class sessions, lab exercises, and homeworks;

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

Curriculum Map Grade(s): Subject: AP Computer Science

Curriculum Map Grade(s): Subject: AP Computer Science Curriculum Map Grade(s): 11-12 Subject: AP Computer Science (Semester 1 - Weeks 1-18) Unit / Weeks Content Skills Assessments Standards Lesson 1 - Background Chapter 1 of Textbook (Weeks 1-3) - 1.1 History

More information

Java: Classes. An instance of a class is an object based on the class. Creation of an instance from a class is called instantiation.

Java: Classes. An instance of a class is an object based on the class. Creation of an instance from a class is called instantiation. Java: Classes Introduction A class defines the abstract characteristics of a thing (object), including its attributes and what it can do. Every Java program is composed of at least one class. From a programming

More information

Java Programming. Manuel Oriol, March 22nd, 2007

Java Programming. Manuel Oriol, March 22nd, 2007 Java Programming Manuel Oriol, March 22nd, 2007 Goal Teach Java to proficient programmers 2 Roadmap Java Basics Eclipse Java GUI Threads and synchronization Class loading and reflection Java Virtual Machines

More information

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures Chapter 5: Procedural abstraction Proper procedures and function procedures Abstraction in programming enables distinction: What a program unit does How a program unit works This enables separation of

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

CS1004: Intro to CS in Java, Spring 2005

CS1004: Intro to CS in Java, Spring 2005 CS1004: Intro to CS in Java, Spring 2005 Lecture #23: OO Design, cont d. Janak J Parekh janak@cs.columbia.edu Administrivia HW#5 due Tuesday And if you re cheating on (or letting others see your) HW#5

More information

COMP 1210 Documentation Guidelines Page 1 of 7. Class documentation (Chapter 1):

COMP 1210 Documentation Guidelines Page 1 of 7. Class documentation (Chapter 1): COMP 1210 Documentation Guidelines Page 1 of 7 Class documentation (Chapter 1): Every class in your program should have a Javadoc tag that specifies the programs purpose, the project number, the author,

More information

User Interface Programming OOP/Java Primer. Step 3 - documentation

User Interface Programming OOP/Java Primer. Step 3 - documentation User Interface Programming OOP/Java Primer Step 3 - documentation Department of Information Technology Uppsala University What is the documentation? Documentation about program in the program Clearly written

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107 A abbreviations 17 abstract class 105 abstract data types 105 abstract method 105 abstract types 105 abstraction 92, 105 access level 37 package 114 private 115 protected 115 public 115 accessors 24, 105

More information

IBS Software Services Technical Interview Questions. Q1. What is the difference between declaration and definition?

IBS Software Services Technical Interview Questions. Q1. What is the difference between declaration and definition? IBS Software Services Technical Interview Questions Q1. What is the difference between declaration and definition? The declaration tells the compiler that at some later point we plan to present the definition

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

Fundamental Concepts and Definitions

Fundamental Concepts and Definitions Fundamental Concepts and Definitions Identifier / Symbol / Name These terms are synonymous: they refer to the name given to a programming component. Classes, variables, functions, and methods are the most

More information

Why Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012

Why Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012 Why Design by Contract What s the difference with Testing? CS 619 Introduction to OO Design and Development Design by Contract Fall 2012 Testing tries to diagnose (and cure) defects after the facts. Design

More information

CmSc 150 Fundamentals of Computing I. Lesson 28: Introduction to Classes and Objects in Java. 1. Classes and Objects

CmSc 150 Fundamentals of Computing I. Lesson 28: Introduction to Classes and Objects in Java. 1. Classes and Objects CmSc 150 Fundamentals of Computing I Lesson 28: Introduction to Classes and Objects in Java 1. Classes and Objects True object-oriented programming is based on defining classes that represent objects with

More information

10 Java Collections; Equality, JUnit

10 Java Collections; Equality, JUnit 10 Java Collections; Equality, JUnit Activities 1. Familiarize yourself with some of the Java Collections Framework. 2. Learn the basics of overriding the hashcode and equals methods. 3. Learn the basics

More information

Exceptions and Libraries

Exceptions and Libraries Exceptions and Libraries RS 9.3, 6.4 Some slides created by Marty Stepp http://www.cs.washington.edu/143/ Edited by Sarah Heckman 1 Exceptions exception: An object representing an error or unusual condition.

More information

public static boolean isoutside(int min, int max, int value)

public static boolean isoutside(int min, int max, int value) See the 2 APIs attached at the end of this worksheet. 1. Methods: Javadoc Complete the Javadoc comments for the following two methods from the API: (a) / @param @param @param @return @pre. / public static

More information

Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time)

Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time) CSE 11 Winter 2017 Program Assignment #2 (100 points) START EARLY! Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time) PROGRAM #2: DoubleArray11 READ THE ENTIRE ASSIGNMENT BEFORE STARTING In lecture,

More information

Week. Lecture Topic day (including assignment/test) 1 st 1 st Introduction to Module 1 st. Practical

Week. Lecture Topic day (including assignment/test) 1 st 1 st Introduction to Module 1 st. Practical Name of faculty: Gaurav Gambhir Discipline: Computer Science Semester: 6 th Subject: CSE 304 N - Essentials of Information Technology Lesson Plan Duration: 15 Weeks (from January, 2018 to April, 2018)

More information

Java Programming Training for Experienced Programmers (5 Days)

Java Programming Training for Experienced Programmers (5 Days) www.peaklearningllc.com Java Programming Training for Experienced Programmers (5 Days) This Java training course is intended for students with experience in a procedural or objectoriented language. It

More information

Software Development Fundamentals (SDF)

Software Development Fundamentals (SDF) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Software Development Fundamentals (SDF) Fluency in the process of software development is a prerequisite to the study of most

More information

Basic Principles of OO. Example: Ice/Water Dispenser. Systems Thinking. Interfaces: Describing Behavior. People's Roles wrt Systems

Basic Principles of OO. Example: Ice/Water Dispenser. Systems Thinking. Interfaces: Describing Behavior. People's Roles wrt Systems Basics of OO Programming with Java/C# Basic Principles of OO Abstraction Encapsulation Modularity Breaking up something into smaller, more manageable pieces Hierarchy Refining through levels of abstraction

More information

Review. these are the instance variables. these are parameters to the methods

Review. these are the instance variables. these are parameters to the methods Review Design a class to simulate a bank account Implement the class Write a demo program that creates bank accounts Write junit tests for the bank account class Review What data items are associated with

More information

Object Orientation Fourth Story. Bok, Jong Soon

Object Orientation Fourth Story. Bok, Jong Soon Object Orientation Fourth Story Bok, Jong Soon javaexpert@nate.com www.javaexpert.co.kr abstract Methods Java allows you to specify that a superclass declares a method that does not supply an implementation.

More information

CVS. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 21

CVS. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 21 CVS Computer Science and Engineering College of Engineering The Ohio State University Lecture 21 CVS: Concurrent Version System Classic tool for tracking changes to a project and allowing team access Can

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY

EINDHOVEN UNIVERSITY OF TECHNOLOGY EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)

More information

CS 151. Exceptions & Javadoc. slides available on course website. Sunday, September 9, 12

CS 151. Exceptions & Javadoc. slides available on course website. Sunday, September 9, 12 CS 151 Exceptions & Javadoc slides available on course website 1 Announcements Prelab 1 is due now. Please place it in the appropriate (Mon vs. Tues) box. Please attend lab this week. There may be a lecture

More information

Collections Chapter 12. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Collections Chapter 12. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Collections Chapter 12 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 2 Scope Introduction to Collections: Collection terminology The Java Collections API Abstract nature of collections

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 5 Anatomy of a Class Outline Problem: How do I build and use a class? Need to understand constructors A few more tools to add to our toolbox Formatting

More information

API Knowledge Coding Guide Version 7.2

API Knowledge Coding Guide Version 7.2 API Knowledge Coding Guide Version 7.2 You will be presented with documentation blocks extracted from API reference documentation (Javadocs and the like). For each block, you will be also presented with

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 15 Class Relationships Outline Problem: How can I create and store complex objects? Review of static methods Consider static variables What about objects

More information

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 2 Things to Review Review the Class Slides: Key Things to Take Away Do you understand

More information

Programming Exercise 14: Inheritance and Polymorphism

Programming Exercise 14: Inheritance and Polymorphism Programming Exercise 14: Inheritance and Polymorphism Purpose: Gain experience in extending a base class and overriding some of its methods. Background readings from textbook: Liang, Sections 11.1-11.5.

More information

Separate Compilation Model

Separate Compilation Model Separate Compilation Model Recall: For a function call to compile, either the function s definition or declaration must appear previously in the same file. Goal: Compile only modules affected by recent

More information

Semantics of programming languages

Semantics of programming languages Semantics of programming languages Informatics 2A: Lecture 27 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 21 November, 2011 1 / 19 1 2 3 4 2 / 19 Semantics for programming

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018 Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 2: Objects http://courses.cs.cornell.edu/cs2110/2018su Lecture 1 Recap 2 Primitive Types in Java Functions/Procedures

More information

Object Oriented Programming

Object Oriented Programming Object Oriented Programming Objectives To review the concepts and terminology of object-oriented programming To discuss some features of objectoriented design 1-2 Review: Objects In Java and other Object-Oriented

More information

Cpt S 122 Data Structures. Introduction to C++ Part II

Cpt S 122 Data Structures. Introduction to C++ Part II Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function

More information

AP COMPUTER SCIENCE A: SYLLABUS

AP COMPUTER SCIENCE A: SYLLABUS Curricular Requirements CR1 The course teaches students to design and implement computer-based solutions to problems. Page(s) 2,3-4,5,6-7,8-9 CR2a The course teaches students to use and implement commonly

More information

SDMX self-learning package XML based technologies used in SDMX-IT TEST

SDMX self-learning package XML based technologies used in SDMX-IT TEST SDMX self-learning package XML based technologies used in SDMX-IT TEST Produced by Eurostat, Directorate B: Statistical Methodologies and Tools Unit B-5: Statistical Information Technologies Last update

More information

Enhanced Class Design -- Introduction

Enhanced Class Design -- Introduction Enhanced Class Design -- Introduction We now examine several features of class design and organization that can improve reusability and system elegance Chapter 9 focuses on: abstract classes formal Java

More information

Outline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003

Outline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003 Outline Object Oriented Programming Autumn 2003 2 Course goals Software design vs hacking Abstractions vs language (syntax) Java used to illustrate concepts NOT a course about Java Prerequisites knowledge

More information

Objective-C: An Introduction (pt 1) Tennessee Valley Apple Developers Saturday CodeJam July 24, 2010 August 7, 2010

Objective-C: An Introduction (pt 1) Tennessee Valley Apple Developers Saturday CodeJam July 24, 2010 August 7, 2010 Objective-C: An Introduction (pt 1) Tennessee Valley Apple Developers Saturday CodeJam July 24, 2010 August 7, 2010 What is Objective-C? Objective-C is an object-oriented programming language that adds

More information

Utilities (Part 3) Implementing static features

Utilities (Part 3) Implementing static features Utilities (Part 3) Implementing static features 1 Goals for Today learn about preconditions versus validation introduction to documentation introduction to testing 2 Yahtzee class so far recall our implementation

More information

Documentation (and midterm review)

Documentation (and midterm review) Documentation (and midterm review) Comp-303 : Programming Techniques Lecture 13 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 13 Comp 303 : Programming Techniques

More information

What is it? CMSC 433 Programming Language Technologies and Paradigms Spring Approach 1. Disadvantage of Approach 1

What is it? CMSC 433 Programming Language Technologies and Paradigms Spring Approach 1. Disadvantage of Approach 1 CMSC 433 Programming Language Technologies and Paradigms Spring 2007 Singleton Pattern Mar. 13, 2007 What is it? If you need to make sure that there can be one and only one instance of a class. For example,

More information

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the

More information

The development of a CreditCard class

The development of a CreditCard class The development of a CreditCard class (an introduction to object-oriented design in C++) January 20, 2006 Rather than explain the many aspects involved in a fully-fledged, yet complex example, we will

More information

CSE331 Winter 2014, Midterm Examination February 12, 2014

CSE331 Winter 2014, Midterm Examination February 12, 2014 CSE331 Winter 2014, Midterm Examination February 12, 2014 Please do not turn the page until 10:30. Rules: The exam is closed-book, closed-note, etc. Please stop promptly at 11:20. There are 100 points

More information