Repeated Arguments. 26 April 2013 OSU CSE 1
|
|
- Milton Parker
- 6 years ago
- Views:
Transcription
1 Repeated Arguments 26 April 2013 OSU CSE 1
2 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 and easy to record in a tracing table, using ) is the simple assignment of one reference variable to another There are other sources of aliasing as well April 2013 OSU CSE 2
3 Aliasing from Parameter Passing Because a formal parameter of a reference type is initialized by copying the corresponding argument s reference value (which is tantamount to assignment of the argument to the formal parameter), parameter passing is another source of aliasing 26 April 2013 OSU CSE 3
4 Example Consider this method: /** * Adds 1 to the first number and 2 to the * second. *... x, y * x = #x + 1 and y = #y + 2 */ private static void foo(naturalnumber x, NaturalNumber y) {...} 26 April 2013 OSU CSE 4
5 Example Consider this method: /** * Adds 1 to the first number and 2 to the * second. *... x, y * x = #x + 1 and y = #y + 2 */ private static void foo(naturalnumber x, NaturalNumber y) {...} How would you implement this contract specification? 26 April 2013 OSU CSE 5
6 Example: A Call Consider this call of the method: NaturalNumber a = new NaturalNumber2(10); NaturalNumber b = new NaturalNumber2(319); foo(a, b); How does this get executed, and what values result for a and b? 26 April 2013 OSU CSE 6
7 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } NaturalNumber a = new NaturalNumber2(10); NaturalNumber b = new NaturalNumber2(319); foo(a, b); 26 April 2013 OSU CSE 7
8 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } NaturalNumber a = new NaturalNumber2(10); NaturalNumber b = new NaturalNumber2(319); foo(a, b); 26 April 2013 OSU CSE 8
9 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } NaturalNumber a = new NaturalNumber2(10); NaturalNumber b = new NaturalNumber2(319); foo(a, b); 26 April 2013 OSU CSE 9
10 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } NaturalNumber a = new NaturalNumber2(10); NaturalNumber b = new NaturalNumber2(319); foo(a, b); 26 April 2013 OSU CSE 10
11 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } NaturalNumber a = new NaturalNumber2(10); NaturalNumber b = new NaturalNumber2(319); foo(a, b); 26 April 2013 OSU CSE 11
12 Note: Harmless Aliasing Aliases are created, but since the method body for foo only has access to the variables x and y (i.e., the variables used as arguments in the client code, a and b, are not in scope while the body of foo is executing), these aliases cause no trouble for reasoning 26 April 2013 OSU CSE 12
13 Example: A Different Call Now consider this call of the method: NaturalNumber a = new NaturalNumber2(10); foo(a, a); How does this happen, and what value results for a? 26 April 2013 OSU CSE 13
14 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } 10 NaturalNumber a = new NaturalNumber2(10); foo(a, a); 26 April 2013 OSU CSE 14
15 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } 10 NaturalNumber a = new NaturalNumber2(10); foo(a, a); 26 April 2013 OSU CSE 15
16 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } 10 NaturalNumber a = new NaturalNumber2(10); foo(a, a); 26 April 2013 OSU CSE 16
17 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } 13 NaturalNumber a = new NaturalNumber2(10); foo(a, a); 26 April 2013 OSU CSE 17
18 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } 13 Can we really be sure the NaturalNumber a = new NaturalNumber2(10); resulting value is 13? foo(a, a); Perhaps surprisingly, no! 26 April 2013 OSU CSE 18
19 How Calls Work In Java public static void foo( NaturalNumber x, NaturalNumber y) {... } 13 NaturalNumber a = new NaturalNumber2(10); foo(a, a); 26 April 2013 OSU CSE 19
20 Note: Harmful Aliasing Here, aliases are created between two variables that are in scope while the method body for foo is executing (i.e., the variables x and y), and these aliases do cause trouble for reasoning Who is at fault for this anomalous outcome? The implementer of foo? The client of foo? 26 April 2013 OSU CSE 20
21 What Outcome Was Expected? Code State a = 10 foo(a, a); 26 April 2013 OSU CSE 21
22 What Outcome Was Expected? Consult the contract for foo, substituting Code a for both parameters x and y; it ensures: a = 11 and a = 12 a = 10 State foo(a, a); 26 April 2013 OSU CSE 22
23 What Outcome Was Expected? Code Can we really have this outcome? a = 10 State foo(a, a); a = 11 a = April 2013 OSU CSE 23
24 Repeated Arguments In this case, it would be impossible for any implementation of foo to produce the outcome supposedly ensured according to its contract! The trouble arising from repeated arguments (i.e., a call like foo(a, a)) is not just in Java; it is a problem in any language with mutable types 26 April 2013 OSU CSE 24
25 The Receiver Is An Argument Note that the reference value of the receiver of a call (to an instance method) is copied to the formal parameter known as this Hence, there is a repeated argument if the receiver is also passed as another argument to such a call Example: n.add(n); 26 April 2013 OSU CSE 25
26 The Receiver Is An Argument Does this call double n, as Note that the reference you might value expect of the from receiver of a call (to an instance using informal method) reasoning is copied to the formal parameter and known wishful naming as this to predict the outcome? Hence, there is a repeated argument if the receiver is also passed as another argument to such a call Example: n.add(n); 26 April 2013 OSU CSE 26
27 The Receiver Is An Argument Note that the reference Why, given value the contract of the for receiver of a call (to an instance add, can method) this call simply is copied to the formal parameter not known be a good as idea? this Hence, there is a repeated argument if the receiver is also passed as another argument to such a call Example: n.add(n); 26 April 2013 OSU CSE 27
28 Best Practice for Repeated Arguments Never pass any variable of a mutable reference type as an argument twice or more to a single method call Remember that the receiver is an argument Checkstyle and FindBugs do not warn you about this! 26 April 2013 OSU CSE 28
Java Interfaces. 6 April 2016 OSU CSE 1
Java Interfaces 6 April 2016 OSU CSE 1 Conceptual Framework A firm conceptual foundation for understanding and designing modern software recognizes: Modern software consists of potentially large numbers
More informationArray. 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 informationSet4. 8 February 2019 OSU CSE 1
Set4 8 February 2019 OSU CSE 1 Documenting Set4 (and Map4) By now you understand hashing and its benefits. But the algorithms we are using are not trivial, and make a lot of assumptions about the representation.
More informationKernel 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 informationCSE 341, Autumn 2015, Ruby Introduction Summary
CSE 341, Autumn 2015, Ruby Introduction Summary Disclaimer: This lecture summary is not necessarily a complete substitute for atting class, reading the associated code, etc. It is designed to be a useful
More informationJava 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 informationUniversity of Texas at Arlington, TX, USA
Dept. of Computer Science and Engineering University of Texas at Arlington, TX, USA The set of program statements over which a variable exists (i.e. can be referred to) It is about understanding, for any
More informationAggregation. Introduction to Computer Science I. Overview (1): Overview (2): CSE 1020 Summer Bill Kapralos. Bill Kapralos.
Aggregation Thursday, July 6 2006 CSE 1020, Summer 2006, Overview (1): Before We Begin Some administrative details Some questions to consider Aggregation Overview / Introduction The aggregate s constructor
More informationCOMP 110/L Lecture 13. Kyle Dewey
COMP 110/L Lecture 13 Kyle Dewey Outline char, charat() Command-line arguments and arrays Array access Array length Array update Integer.parseInt char, charat() char Represents a single character char
More informationObjects and Iterators
Objects and Iterators Can We Have Data Structures With Generic Types? What s in a Bag? All our implementations of collections so far allowed for one data type for the entire collection To accommodate a
More informationClass object initialization block destructor Class object
In this segment, I will review the Java statements and primitives that relate explicitly to Object Oriented Programming. I need to re-enforce Java s commitment to OOP. Unlike C++, there is no way to build
More informationCS112 Lecture: Working with Numbers
CS112 Lecture: Working with Numbers Last revised January 30, 2008 Objectives: 1. To introduce arithmetic operators and expressions 2. To expand on accessor methods 3. To expand on variables, declarations
More informationKernel 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 informationCompiler Design Spring 2017
Compiler Design Spring 2017 7.5 Method invocation Dr. Zoltán Majó Compiler Group Java HotSpot Virtual Machine Oracle Corporation 1 Admin issues There will be a recitation session today In CAB G 11 @ 15:15
More informationTwo-Level Designs. Chapter 881. Introduction. Experimental Design. Experimental Design Definitions. Alias. Blocking
Chapter 881 Introduction This program generates a 2 k factorial design for up to seven factors. It allows the design to be blocked and replicated. The design rows may be output in standard or random order.
More informationFunctional Programming in Java. CSE 219 Department of Computer Science, Stony Brook University
Functional Programming in Java CSE 219, Stony Brook University What is functional programming? There is no single precise definition of functional programming (FP) We should think of it as a programming
More informationAnd Even More and More C++ Fundamentals of Computer Science
And Even More and More C++ Fundamentals of Computer Science Outline C++ Classes Special Members Friendship Classes are an expanded version of data structures (structs) Like structs, the hold data members
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2016 Lecture 3a Andrew Tolmach Portland State University 1994-2016 Formal Semantics Goal: rigorous and unambiguous definition in terms of a wellunderstood formalism (e.g.
More informationFinal Exam. Programming Assignment 3. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings
University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Interfaces vs. Inheritance Abstract Classes Inner Classes Readings This Week: No new readings. Consolidate! (Reminder: Readings
More information1B1b Classes in Java Part I
1B1b Classes in Java Part I Agenda Defining simple classes. Instance variables and methods. Objects. Object references. 1 2 Reading You should be reading: Part I chapters 6,9,10 And browsing: Part IV chapter
More informationDISTRIBUTIVE LATTICES
DISTRIBUTIVE LATTICES FACT 1: For any lattice : 1 and 2 and 3 and 4 hold in : The distributive inequalities: 1. for every a,b,c A: (a b) (a c) a (b c) 2. for every a,b,c A: a (b c) (a b) (a c)
More informationCSE 374 Programming Concepts & Tools
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2017 Lecture 8 C: Miscellanea Control, Declarations, Preprocessor, printf/scanf 1 The story so far The low-level execution model of a process (one
More informationFor this chapter, switch languages in DrRacket to Advanced Student Language.
Chapter 30 Mutation For this chapter, switch languages in DrRacket to Advanced Student Language. 30.1 Remembering changes Suppose you wanted to keep track of a grocery shopping list. You could easily define
More informationFinal Exam. Programming Assignment 3. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings
University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Interfaces vs. Inheritance Abstract Classes Inner Classes Readings This Week: No new readings. Consolidate! (Reminder: Readings
More informationSemantic Analysis and Type Checking
Semantic Analysis and Type Checking The compilation process is driven by the syntactic structure of the program as discovered by the parser Semantic routines: interpret meaning of the program based on
More informationConstructors for classes
Constructors for Comp Sci 1570 Introduction to C++ Outline 1 2 3 4 5 6 7 C++ supports several basic ways to initialize i n t nvalue ; // d e c l a r e but not d e f i n e nvalue = 5 ; // a s s i g n i
More informationBefore We Begin. Class Implementation II. Introduction to Computer Science II. Overview (1): Administrative Details (1):
Overview (1): Before We Begin Some administrative details Some questions to consider A Closer Look at References Class Implementation II Thursday, May 11 2006 The Person class (from textbook) Class objects
More information5) Attacker causes damage Different to gaining control. For example, the attacker might quit after gaining control.
Feb 23, 2009 CSE, 409/509 Mitigation of Bugs, Life of an exploit 1) Bug inserted into code 2) Bug passes testing 3) Attacker triggers bug 4) The Attacker gains control of the program 5) Attacker causes
More informationProgramming Languages
CSE 130 : Spring 2011 Programming Languages Lecture 13: What s in a Name? Ranjit Jhala UC San Diego Next: What s in a name? More precisely: How should programmer think of data What does a variable x really
More informationNext: What s in a name? Programming Languages. Data model in functional PL. What s in a name? CSE 130 : Fall Lecture 13: What s in a Name?
Next: What s in a name? CSE 13 : Fall 211 Programming Languages Lecture 13: What s in a Name? More precisely: How should programmer think of data What does a variable x really mean? Ranjit Jhala UC San
More informationDECLARAING AND INITIALIZING POINTERS
DECLARAING AND INITIALIZING POINTERS Passing arguments Call by Address Introduction to Pointers Within the computer s memory, every stored data item occupies one or more contiguous memory cells (i.e.,
More informationCSE 11 Midterm Fall 2012
Signature cs11f Name Student ID CSE 11 Midterm Fall 2012 Page 1 (20 points) Page 2 (17 points) Page 3 (31 points) Page 4 (15 points) Page 5 (8 points) Page 6 (20 points) Total (111 points = 105 base points
More informationChapter 5 Names, Bindings, Type Checking, and Scopes
Chapter 5 Names, Bindings, Type Checking, and Scopes Names Variables The Concept of Binding Scope and Lifetime Type Checking Referencing Environments Named Constants Names Used for variables, subprograms
More informationProcedure and Object- Oriented Abstraction
Procedure and Object- Oriented Abstraction Scope and storage management cs5363 1 Procedure abstractions Procedures are fundamental programming abstractions They are used to support dynamically nested blocks
More informationCSE341: Programming Languages Lecture 11 Type Inference. Dan Grossman Spring 2016
CSE341: Programming Languages Lecture 11 Type Inference Dan Grossman Spring 2016 Type-checking (Static) type-checking can reject a program before it runs to prevent the possibility of some errors A feature
More informationCS1150 Principles of Computer Science Methods
CS1150 Principles of Computer Science Methods Yanyan Zhuang Department of Computer Science http://www.cs.uccs.edu/~yzhuang CS1150 UC. Colorado Springs Opening Problem Find the sum of integers from 1 to
More informationCS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output
CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables
More informationCSE 143. Lecture 9: introduction to recursion reading: 12.1
CSE 143 Lecture 9: introduction to recursion reading: 12.1 Recursion recursion: The definition of an operation in terms of itself. Solving a problem using recursion depends on solving smaller occurrences
More informationVerification and Validation. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 22 Slide 1
Verification and Validation 1 Objectives To introduce software verification and validation and to discuss the distinction between them To describe the program inspection process and its role in V & V To
More informationCSE341: Programming Languages Lecture 9 Function-Closure Idioms. Dan Grossman Fall 2011
CSE341: Programming Languages Lecture 9 Function-Closure Idioms Dan Grossman Fall 2011 More idioms We know the rule for lexical scope and function closures Now what is it good for A partial but wide-ranging
More informationwrite the functions inside as well as outside the class. So in C++, they are called member functions and not methods.
1. Q. Why pointers are eliminated from java? 1)Pointers lead to confusion for a programmer. 2)Pointers may crash a program easily, for example, when we add two pointers, the program crashers immediately.
More informationCS 105 Perl: Perl subroutines and Disciplined Perl
CS 105 Perl: Perl subroutines and Disciplined Perl Nathan Clement! February 3, 2014 Agenda We will cover Perl scoping, subroutines (user- defined functions) and then we continue on to Perl s features for
More informationThe compilation process is driven by the syntactic structure of the program as discovered by the parser
Semantic Analysis The compilation process is driven by the syntactic structure of the program as discovered by the parser Semantic routines: interpret meaning of the program based on its syntactic structure
More informationArray Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7)
Array Basics: Outline Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and Constants
More informationWhat the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope. C Flow Control.
C Flow Control David Chisnall February 1, 2011 Outline What the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope Disclaimer! These slides contain a lot of
More informationCSE 374 Programming Concepts & Tools. Brandon Myers Winter 2015 Lecture 4 Shell Variables, More Shell Scripts (Thanks to Hal Perkins)
CSE 374 Programming Concepts & Tools Brandon Myers Winter 2015 Lecture 4 Shell Variables, More Shell Scripts (Thanks to Hal Perkins) test / if Recall from last lecture: test (not built-in) takes arguments
More informationCSE341: Programming Languages Lecture 9 Function-Closure Idioms. Dan Grossman Winter 2013
CSE341: Programming Languages Lecture 9 Function-Closure Idioms Dan Grossman Winter 2013 More idioms We know the rule for lexical scope and function closures Now what is it good for A partial but wide-ranging
More informationPatterns in Java Unfinished Symmetry
Patterns in Java Unfinished Symmetry Kevlin Henney kevlin@curbralan.com Koyaanisqatsi 1 Symmetry is about balance. The expectation that when a particular feature is present, its logical counterpart will
More informationIntroducing Wybe a language for everyone
Introducing Wybe a language for everyone Peter Schachte joint work with Matthew Giuca The University of Melbourne Department of Computing and Information Systems 4 December 2013 Peter Schachte (Melbourne)
More informationCSE 374: Programming Concepts and Tools. Eric Mullen Spring 2017 Lecture 4: More Shell Scripts
CSE 374: Programming Concepts and Tools Eric Mullen Spring 2017 Lecture 4: More Shell Scripts Homework 1 Already out, due Thursday night at midnight Asks you to run some shell commands Remember to use
More informationCIS 341 Final Examination 4 May 2017
CIS 341 Final Examination 4 May 2017 1 /14 2 /15 3 /12 4 /14 5 /34 6 /21 7 /10 Total /120 Do not begin the exam until you are told to do so. You have 120 minutes to complete the exam. There are 14 pages
More informationBouml Tutorial. The tutorial must be read in order because I will not repeat each time the general commands to call a menu etc...
of 30 11/04/2008 19:18 Bouml Tutorial This tutorial is written to help you to use BOUML for the first time, only few features of BOUML are exposed here, but a fu description of BOUML is given in the reference
More informationCS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University
9/5/6 CS Introduction to Computing II Wayne Snyder Department Boston University Today: Arrays (D and D) Methods Program structure Fields vs local variables Next time: Program structure continued: Classes
More informationC++ Lecture 5 Arrays. CSci 588: Data Structures, Algorithms and Software Design.
C++ Lecture 5 Arrays CSci 588: Data Structures, Algorithms and Software Design http://www.cplusplus.com/doc/tutorial/arrays/ All material not from online sources copyright Travis Desell, 2013 Overview
More informationCMSC 330: Organization of Programming Languages. Lets, Tuples, Records
CMSC 330: Organization of Programming Languages Lets, Tuples, Records CMSC330 Spring 2018 1 Let Expressions Enable binding variables in other expressions These are different from the let definitions we
More informationFrom Java to C++ From Java to C++ CSE250 Lecture Notes Weeks 1 2, part of 3. Kenneth W. Regan University at Buffalo (SUNY) September 10, 2009
From Java to C++ CSE250 Lecture Notes Weeks 1 2, part of 3 Kenneth W. Regan University at Buffalo (SUNY) September 10, 2009 C++ Values, References, and Pointers 1 C++ Values, References, and Pointers 2
More informationLe L c e t c ur u e e 5 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Exception Handling
Course Name: Advanced Java Lecture 5 Topics to be covered Exception Handling Exception HandlingHandlingIntroduction An exception is an abnormal condition that arises in a code sequence at run time A Java
More information6. Java Errors and Exceptions. Errors, runtime-exceptions, checked-exceptions, exception handling, special case: resources
129 6. Java Errors and Exceptions Errors, runtime-exceptions, checked-exceptions, exception handling, special case: resources Errors and Exceptions in Java 130 Errors and exceptions interrupt the normal
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2017 Lecture 3a Andrew Tolmach Portland State University 1994-2017 Binding, Scope, Storage Part of being a high-level language is letting the programmer name things: variables
More informationMotivation was to facilitate development of systems software, especially OS development.
A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.
More informationVerfying the SSH TLP with ProVerif
A Demo Alfredo Pironti Riccardo Sisto Politecnico di Torino, Italy {alfredo.pironti,riccardo.sisto}@polito.it CryptoForma Bristol, 7-8 April, 2010 Outline Introduction 1 Introduction 2 3 4 Introduction
More information6. Java Errors and Exceptions
Errors and Exceptions in Java 6. Java Errors and Exceptions Errors and exceptions interrupt the normal execution of the program abruptly and represent an unplanned event. Exceptions are bad, or not? Errors,
More informationChapter 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 informationobjects
/*@ immutable @*/ objects Erik Poll SoS group (aka the LOOP group) Radboud University Nijmegen KeY workshop June 2005 yet another JML keyword... Java provides final ie. immutable - fields What about immutable
More informationLecture 5: Methods CS2301
Lecture 5: Methods NADA ALZAHRANI CS2301 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. 2 Solution public static int sum(int i1, int i2) { int
More informationCS558 Programming Languages
CS558 Programming Languages Winter 2017 Lecture 4a Andrew Tolmach Portland State University 1994-2017 Semantics and Erroneous Programs Important part of language specification is distinguishing valid from
More informationWednesday, October 15, 14. Functions
Functions Terms void foo() { int a, b;... bar(a, b); void bar(int x, int y) {... foo is the caller bar is the callee a, b are the actual parameters to bar x, y are the formal parameters of bar Shorthand:
More informationCompiler Errors. Flash CS4 Professional ActionScript 3.0 Language Reference. 1 of 18 9/6/2010 9:40 PM
1 of 18 9/6/2010 9:40 PM Flash CS4 Professional ActionScript 3.0 Language Reference Language Reference only Compiler Errors Home All Packages All Classes Language Elements Index Appendixes Conventions
More informationEECS168 Exam 3 Review
EECS168 Exam 3 Review Exam 3 Time: 2pm-2:50pm Monday Nov 5 Closed book, closed notes. Calculators or other electronic devices are not permitted or required. If you are unable to attend an exam for any
More informationProgramming Languages & Paradigms PROP HT Course Council. Subprograms. Meeting on friday! Subprograms, abstractions, encapsulation, ADT
Programming Languages & Paradigms PROP HT 2011 Lecture 4 Subprograms, abstractions, encapsulation, ADT Beatrice Åkerblom beatrice@dsv.su.se Course Council Meeting on friday! Talk to them and tell them
More informationObjectives. Order (sort) the elements of an array Search an array for a particular item Define, use multidimensional array
Arrays Chapter 7 Objectives Nature and purpose of an array Using arrays in Java programs Methods with array parameter Methods that return an array Array as an instance variable Use an array not filled
More informationSeparate 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 informationFunctional Languages. CSE 307 Principles of Programming Languages Stony Brook University
Functional Languages CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Historical Origins 2 The imperative and functional models grew out of work
More informationJava Input/Output. 11 April 2013 OSU CSE 1
Java Input/Output 11 April 2013 OSU CSE 1 Overview The Java I/O (Input/Output) package java.io contains a group of interfaces and classes similar to the OSU CSE components SimpleReader and SimpleWriter
More informationIron Workers District Council of Western New York and Vicinity Benefit Funds. iremit Online Remittance Instructions
Iron Workers District Council of Western New York and Vicinity Benefit Funds iremit Online Remittance Instructions Updated: April 4, 2012 Iron Workers District Council of Western New York and Vicinity
More informationMaltepe University Computer Engineering Department. BİL 133 Algoritma ve Programlama. Chapter 8: Arrays and pointers
Maltepe University Computer Engineering Department BİL 133 Algoritma ve Programlama Chapter 8: Arrays and pointers Basics int * ptr1, * ptr2; int a[10]; ptr1 = &a[2]; ptr2 = a; // equivalent to ptr2 =
More informationMotivation was to facilitate development of systems software, especially OS development.
A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.
More informationInstantiation of Template class
Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double
More informationIntroduction to Object-Oriented Programming
Introduction to Object-Oriented Programming Recursion Christopher Simpkins chris.simpkins@gatech.edu CS 1331 (Georgia Tech) Recursion 1 / 11 Recursion A recursive processes or data structure is defined
More informationCS1150 Principles of Computer Science Methods
CS1150 Principles of Computer Science Methods Yanyan Zhuang Department of Computer Science http://www.cs.uccs.edu/~yzhuang CS1150 UC. Colorado Springs Opening Problem Find the sum of integers from 1 to
More informationBrocade Network OS DATA CENTER. Target Path Selection Guide August 7, 2017
August 7, 2017 DATA CENTER Brocade Network OS Target Path Selection Guide Brocade Network OS Target Path releases are recommended code levels for Brocade VDX Ethernet Data Center switch platforms. Use
More information[ANALYSIS ASSIGNMENT 10]
2009 Pidgin Carlos Simões Higino Silva João Carlos Almeida Miguel Graça Oliveira [ANALYSIS ASSIGNMENT 10] INTRODUCTION The purpose of this project is to evaluate a testing tool chosen by the team and provide
More informationCS 314 Principles of Programming Languages
CS 314 Principles of Programming Languages Lecture 15: Review and Functional Programming Zheng (Eddy) Zhang Rutgers University March 19, 2018 Class Information Midterm exam forum open in Sakai. HW4 and
More informationPass by Value. Pass by Value. Our programs are littered with function calls like f (x, 5).
Our programs are littered with function calls like f (x, 5). This is a way of passing information from the call site (where the code f(x,5) appears) to the function itself. The parameter passing mode tells
More informationIteration Preview of Coming Attractions The Need to Get Your Act Together A Process for Developing While Statements
Iteration Preview of Coming Attractions In this unit be sure to look for a five-step process for developing while statements tracing while statements The Need to Get Your Act Together As you probably know
More informationSystem Software Assignment 1 Runtime Support for Procedures
System Software Assignment 1 Runtime Support for Procedures Exercise 1: Nested procedures Some programming languages like Oberon and Pascal support nested procedures. 1. Find a run-time structure for such
More informationCOMP 2355 Introduction to Systems Programming
COMP 2355 Introduction to Systems Programming Christian Grothoff christian@grothoff.org http://grothoff.org/christian/ 1 Today Class syntax, Constructors, Destructors Static methods Inheritance, Abstract
More informationCSE 11 Midterm Fall 2008
Signature cs11f Name Student ID CSE 11 Midterm Fall 2008 Page 1 (10 points) Page 2 (22 points) Page 3 (23 points) Page 4 (17 points) Page 5 (12 points) Total (84 points = 80 base points + 4 points EC [5%])
More informationPrimitive vs Reference
Primitive vs Reference Primitive types store values Reference types store addresses This is the fundamental difference between the 2 Why is that important? Because a reference type stores an address, you
More informationErrors and Exceptions
Exceptions Errors and Exceptions An error is a bug in your program dividing by zero going outside the bounds of an array trying to use a null reference An exception isn t necessarily your fault trying
More informationFortgeschrittene objektorientierte Programmierung (Advanced Object-Oriented Programming)
2014-03-07 Preface Fortgeschrittene objektorientierte Programmierung (Advanced Object-Oriented Programming) Coordinates: Lecturer: Web: Studies: Requirements: No. 185.211, VU, 3 ECTS Franz Puntigam http://www.complang.tuwien.ac.at/franz/foop.html
More informationArrays. 1 Index mapping
Arrays 1 Index mapping You are expected already to have a good understanding of arrays. We examine some array techniques in more detail, beginning with index mapping. Index mapping is a technique for compact
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 22 March 14, 2018 Static Methods, Java Arrays Chapters 20 & 21 Announcements HW6: Java Programming (Pennstagram) Due: Tuesday the 20 th at 11:59pm
More information6.001 Notes: Section 4.1
6.001 Notes: Section 4.1 Slide 4.1.1 In this lecture, we are going to take a careful look at the kinds of procedures we can build. We will first go back to look very carefully at the substitution model,
More informationIntroduction 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 information9. Java Errors and Exceptions
Errors and Exceptions in Java 9. Java Errors and Exceptions Errors and exceptions interrupt the normal execution of the program abruptly and represent an unplanned event. Exceptions are bad, or not? Errors,
More informationProtection Levels and Constructors The 'const' Keyword
Protection Levels and Constructors The 'const' Keyword Review: const Keyword Generally, the keyword const is applied to an identifier (variable) by a programmer to express an intent that the identifier
More informationVerification and Validation. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 22 Slide 1
Verification and Validation Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 22 Slide 1 Verification vs validation Verification: "Are we building the product right?. The software should
More informationFinal CSE 131B Spring 2004
Login name Signature Name Student ID Final CSE 131B Spring 2004 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 (25 points) (24 points) (32 points) (24 points) (28 points) (26 points) (22 points)
More informationOverriding המחלקה למדעי המחשב עזאם מרעי אוניברסיטת בן-גוריון
Overriding עזאם מרעי המחלקה למדעי המחשב אוניברסיטת בן-גוריון 2 Roadmap A method in a child class overrides a method in the parent class if it has the same name and type signature: Parent void method(int,float)
More information