Super and Inner Together at Last!
|
|
- Merryl Gaines
- 6 years ago
- Views:
Transcription
1 Super and Inner Together at Last! David S. Goldberg University of Utah Robert Bruce Findler University of Chicago Matthew Flatt University of Utah 1
2 Java-Style Method Overriding m() {... Class A new C().m() Class B m() {... super... Class C m() {... super... 2
3 Beta-Style Method Augmentation Class A m() {... inner... new C().m() Class B m() {... inner... m() {... Class C 3
4 A Combination m() {... Class A new C().m() Class B m() {... super inner... m() {... Class C 4
5 Creating a GUI Hierarchy Border Image Highlight 5
6 and Border in Java Border Image Highlight class... void { // paint the background:...; class Border... void { // paint background: super.; // draw a border:...; 6
7 in Java Border class... void { // paint background, border: super.; // draw a button label:...; Image Highlight 7
8 Image in Java Border Image Highlight class Image... void { // paints background, border // - and label! super.; // draw image // must cover label:...; 8
9 Fixed Border and in Java Border paintinside() paintinside() class Border... final void { // paint background: super.; // paint a border:...; paintinside(); void paintinside() { Image paintinside() Highlight paintinside() class... void paintinside() { // draw label:...; 9
10 Image and Highlight in Java Image Border paintinside() paintinside() paintinside() Highlight paintinside() class Image... void paintinside() { // draws image // doesn't call super // for label:...; class Highlight... void paintinside() { // replace background with // blue gradient:...; // draws the label: super.paintinside(); 10
11 The Problem with Inventing Names Border Image Highlight 11
12 The Problem with Inventing Names Border paintinside() paintinside() Image paintinside() Highlight paintinside() 12
13 The Problem with Inventing Names Border paintinside() paintinside() Image paintinside() Highlight paintinside() Other workarounds: Decorators/Delegation, Aspects 13
14 Border and in Beta Border Image Highlight class Border... void { // draw a border:...; inner.; class... void { // draw a label:...; 14
15 and Border in Beta Border Image Highlight class... void { // paint the background:...; inner.; class Border... void { // draw a border:...; inner.; 15
16 Fixed and Border in Beta paintbackground() Border class... void paintbackground() { // paint the background:...; void { inner. else paintbackground(); Image Highlight class Border... void { paintbackground(); // draw a border:...; inner.; 16
17 in Beta paintbackground() Border paintlabel() class... void paintlabel() { // draw a button label:...; void { inner. else paintlabel(); Image Highlight 17
18 Image and Highlight in Beta paintbackground() Border Image paintlabel() Highlight class Image... void { // draw image // (don't call paintlabel):...; class Highlight... void { // replace background with // blue gradient:...; paintlabel(); // draws label 18
19 Combining Beta and Java Styles Border Image Highlight 19
20 Combining Beta and Java Styles Border Image Highlight 20
21 Combining Beta and Java Styles Border Image Highlight 21
22 Combining Beta and Java Styles Border Image Highlight 22
23 Combining Beta and Java Styles Border Image Highlight 23
24 Code for Beta/Java Combination Border class... java void { // paint the background:...; Image Highlight 24
25 Code for Beta/Java Combination Border class Border... beta void { // paint background: super.; // draw a border:...; inner.; Image Highlight 25
26 Code for Beta/Java Combination Border class... java void { // draw a button label:...; Image Highlight 26
27 Code for Beta/Java Combination Border class Image... beta void { // draw image, // don't call super // for label:...; inner.; Image Highlight class Highlight... java void { // replace background with // blue gradient:...; // draw label super.; 27
28 Summary: Java to Beta/Java Combination Add java and beta keywords for methods Add inner statement: inner.identifier (Expression,... Expression) else Statement 28
29 Operational Semantics: Calling paint on Border Border 29
30 Calling paint on Border: Method Dispatch new Border().; Border 30
31 Calling paint on Border: Method Dispatch Highest method declared beta or lowest method, if none new Border().; Border 31
32 Calling paint on Border: Method Dispatch Highest method declared beta or lowest method, if none new Border().; Border 32
33 Calling paint on Border: Method Dispatch Border class Border... beta void { super.;... inner. else...; 33
34 Calling paint on Border: super Dispatch Border class Border... beta void { super.;... inner. else...; 34
35 Calling paint on Border: super Dispatch Next method above in hierarchy Border class Border... beta void { super.;... inner. else...; 35
36 Calling paint on Border: super Dispatch Next method above in hierarchy Border class Border... beta void { super.;... inner. else...; 36
37 Calling paint on Border: super Dispatch Next method above in hierarchy Border class... java void { // paint the background:...; 37
38 Calling paint on Border: inner Dispatch Border class Border... beta void { super.;... inner. else...; 38
39 Calling paint on Border: inner Dispatch Next method below declared beta or lowest method, if none Border class Border... beta void { super.;... inner. else...; 39
40 Calling paint on Border: inner Dispatch Next method below declared beta or lowest method, if none Border class Border... beta void { super.;... inner. else...; 40
41 Operational Semantics: Calling paint on Border 41
42 Calling paint on : Method Dispatch new ().; Border 42
43 Calling paint on : Method Dispatch Highest method declared beta or lowest method, if none new ().; Border 43
44 Calling paint on : Method Dispatch Highest method declared beta or lowest method, if none new ().; Border 44
45 Calling paint on : Method Dispatch Border class Border... beta void { super.;... inner. else...; 45
46 Calling paint on : inner Dispatch Border class Border... beta void { super.;... inner. else...; 46
47 Calling paint on : inner Dispatch Next method below declared beta or lowest method, if none Border class Border... beta void { super.;... inner. else...; 47
48 Calling paint on : inner Dispatch Next method below declared beta or lowest method, if none Border class Border... beta void { super.;... inner. else...; 48
49 Calling paint on : inner Dispatch Next method below declared beta or lowest method, if none Border class... java void { // draw a button label:...; 49
50 Operational Semantics: Calling paint on Image Border Image 50
51 Calling paint on Image: Method Dispatch new Image().; Border Image 51
52 Calling paint on Image: Method Dispatch Highest method declared beta or lowest method, if none new Image().; Border Image 52
53 Calling paint on Image: Method Dispatch Highest method declared beta or lowest method, if none new Image().; Border Image 53
54 Calling paint on Image: Method Dispatch Border class Border... beta void { super.;... inner. else...; Image 54
55 Calling paint on Image: inner Dispatch Border class Border... beta void { super.;... inner. else...; Image 55
56 Calling paint on Image: inner Dispatch Next method below declared beta or lowest method, if none Border class Border... beta void { super.;... inner. else...; Image 56
57 Calling paint on Image: inner Dispatch Next method below declared beta or lowest method, if none Border class Border... beta void { super.;... inner. else...; Image 57
58 Calling paint on Image: inner Dispatch Next method below declared beta or lowest method, if none Border class Image... beta void { // draw image, // don't call super // for label:...; inner.; Image 58
59 Compiling Method Dispatch Border Image 59
60 Compiling Method Dispatch Border Image paint paint Border paint Border paint Border 60
61 Compiling super Calls Border class Border... beta void { super.;... inner. else...; Image 61
62 Compiling super Calls Border class Border... beta void { in class... inner. else...; Image 62
63 Compiling inner Calls Border Image 63
64 Compiling inner Calls 0 Border Image 64
65 Compiling inner Calls 0 Border class Border... beta void { super.;... inner. else...; Image 65
66 Compiling inner Calls 0 Border class Border... beta void { super.;... at index 1 Image 66
67 Compiling inner Calls 0 Border class Border... beta void { super.;... at index 1 1 Image 67
68 Compiling inner Calls paint 0 0 Border paint 0 Border 1 null paint 0 Border 1 1 Image paint 0 Border 1 Image 2 null 68
69 Performance Performance unchanged with these modifications All java methods behave exactly like normal Java Additional 250 lines of code to 2800-line object system 69
70 Model and Implementation Model based on CLASSICJAVA [Flatt, Krishnamurthi, Felleisen 98] Soundness proof in paper Implemented in v299 of PLT Scheme 70
71 Use in Practice: on-close and render-value Methods on-close method of editor called when window closed Includes important code to be executed Must be in control render-value method of language converts values to strings Sometimes language wants control certain values always displayed the same Sometimes gives up control to subclasses 71
72 Related Work CLOS [Keene, 1988], gbeta [Ernst, Ph.D. Thesis, 1999] Cook [Ph.D. Thesis, 1989], Clark [GEC Journal of Research, 1994] Bracha and Cook [OOPSLA 1990], Ancona and Zucca [PLILP 1997, MSCS 1998], Duggan [ECOOP 2000], Bettini, et al. [WOOD 2003], GNU EDMA [Oliveira] 72
73 Conclusions Programmers need super and inner in same language Method can maintain control or give control as desired Developed simple system of determining control Easy to implement Border Image Highlight Implementations:
Super and Inner Together at Last!
Super and Inner Together at Last! David S. Goldberg School of Computing University of Utah Salt Lake City, UT 84112 goldberg@cs.utah.edu Robert Bruce Findler Department of Computer Science University of
More informationCall by Declaration. Erik Ernst 1. Dept. of Computer Science, University of Aarhus, Denmark
Call by Declaration Erik Ernst 1 Dept. of Computer Science, University of Aarhus, Denmark eernst@daimi.au.dk Abstract. With traditional inheritance mechanisms, a subclass is able to use inherited features
More informationJava Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application
Last Time v We created our first Java application v What are the components of a basic Java application? v What GUI component did we use in the examples? v How do we write to the standard output? v An
More informationJohn Clements Department of Computer Science Cal Poly State University 1 Grand Street San Luis Obispo, CA (805)
Curriculum Vitae Contact Information Education John Clements Department of Computer Science Cal Poly State University 1 Grand Street San Luis Obispo, CA 93407 (805)756-6528 clements@brinckerhoff.org 2005
More informationSafe Instantiation in Generic Java
Safe Instantiation in Generic Java January 31, 2003 Abstract This paper presents the safe-instantiation principle a new design principle for evaluating extensions of Java with support for generic types.
More informationOverview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008
Overview Lecture 7: Inheritance and GUIs Written by: Daniel Dalevi Inheritance Subclasses and superclasses Java keywords Interfaces and inheritance The JComponent class Casting The cosmic superclass Object
More informationMaking New instances of Classes
Making New instances of Classes NOTE: revised from previous version of Lecture04 New Operator Classes are user defined datatypes in OOP languages How do we make instances of these new datatypes? Using
More informationLogistics. Final Exam on Friday at 3pm in CHEM 102
Java Review Logistics Final Exam on Friday at 3pm in CHEM 102 What is a class? A class is primarily a description of objects, or instances, of that class A class contains one or more constructors to create
More informationProgramming Languages
TECHNISCHE UNIVERSITÄT MÜNCHEN FAKULTÄT FÜR INFORMATIK Programming Languages Mixins Dr. Michael Petter Winter 2014 Mixins 1 / 30 What advanced techiques are there besides multiple implementation inheritance?
More information5.6.1 The Special Variable this
ALTHOUGH THE BASIC IDEAS of object-oriented programming are reasonably simple and clear, they are subtle, and they take time to get used to And unfortunately, beyond the basic ideas there are a lot of
More informationC++ Inheritance and Encapsulation
C++ Inheritance and Encapsulation Private and Protected members Inheritance Type Public Inheritance Private Inheritance Protected Inheritance Special method inheritance 1 Private Members Private members
More informationTyped Scheme From Scripts to Programs. Sam Tobin-Hochstadt Northeastern University
Typed Scheme From Scripts to Programs Sam Tobin-Hochstadt Northeastern University 1 The PL Renaissance 2 The PL Renaissance 3 The PL Renaissance 4 What s good These languages are interactive designed for
More informationObjective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5
Objective Questions BCA Part III page 1 of 5 1. Java is purely object oriented and provides - a. Abstraction, inheritance b. Encapsulation, polymorphism c. Abstraction, polymorphism d. All of the above
More informationA Contracts for First-Class Classes
A Contracts for First-Class Classes T. STEPHEN STRICKLAND, CHRISTOS DIMOULAS, ASUMU TAKIKAWA, and MATTHIAS FELLEISEN, Northeastern University, Boston, MA 02115 First-class classes enable programmers to
More informationType Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004
Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...
More informationPLD Semester Exam Study Guide Dec. 2018
Covers material from Chapters 1-8. Semester Exam will be built from these questions and answers, though they will be re-ordered and re-numbered and possibly worded slightly differently than on this study
More informationDesign Patterns: State, Bridge, Visitor
Design Patterns: State, Bridge, Visitor State We ve been talking about bad uses of case statements in programs. What is one example? Another way in which case statements are sometimes used is to implement
More informationObject Oriented Programming. Spring 2008
Dynamic Binding Implementation Object Oriented Programming 236703 Spring 2008 1 Implementation of Virtual Functions class Ellipse { //... public: E 1 virtual void draw() const; draw E + virtual void hide()
More informationJava Object Oriented Design. CSC207 Fall 2014
Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code
More informationJava for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points.
Java for Non Majors Final Study Guide April 26, 2017 The test consists of 1. Multiple choice questions 2. Given code, find the output 3. Code writing questions 4. Code debugging question 5. Short answer
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationCSE P 501 Exam 8/5/04
Name There are 7 questions worth a total of 65 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. You may refer to the following references: Course
More informationLecture 16: Object Programming Languages
Lecture 16: Object Programming Languages Introduction Corresponds to EOPL 5.1 and 5.2 Goal: to introduce Object Oriented Programming Language (OOPL) concepts using the EOPL extensible language framework
More informationCS 11 java track: lecture 3
CS 11 java track: lecture 3 This week: documentation (javadoc) exception handling more on object-oriented programming (OOP) inheritance and polymorphism abstract classes and interfaces graphical user interfaces
More informationCS/ENGRD 2110 SPRING Lecture 5: Local vars; Inside-out rule; constructors
1 CS/ENGRD 2110 SPRING 2017 Lecture 5: Local vars; Inside-out rule; constructors http://courses.cs.cornell.edu/cs2110 Announcements 2 1. Writing tests to check that the code works when the precondition
More informationOn the Interaction of Method Lookup and Scope with Inheritance and Nesting
On the Interaction of Method Lookup and Scope with Inheritance and Nesting Gilad Bracha Cadence Design Systems gilad@cadence.com Abstract. Languages that support both inheritance and nesting of declarations
More informationProcesses without Partitions
Processes without Partitions Matthew Flatt University of Utah Adam Wick University of Utah Robert Bruce Findler Northwestern University 1 Programming in Heaven 2 Programming in Heaven 101010 010101 3 Programming
More informationJava Review: Objects
Outline Java review Abstract Data Types (ADTs) Interfaces Class Hierarchy, Abstract Classes, Inheritance Invariants Lists ArrayList LinkedList runtime analysis Iterators Java references 1 Exam Preparation
More informationRules and syntax for inheritance. The boring stuff
Rules and syntax for inheritance The boring stuff The compiler adds a call to super() Unless you explicitly call the constructor of the superclass, using super(), the compiler will add such a call for
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract Classes
More informationName Return type Argument list. Then the new method is said to override the old one. So, what is the objective of subclass?
1. Overriding Methods A subclass can modify behavior inherited from a parent class. A subclass can create a method with different functionality than the parent s method but with the same: Name Return type
More informationA PROGRAM IS A SEQUENCE of instructions that a computer can execute to
A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form
More informationUsing Inheritance to Share Implementations
Using Inheritance to Share Implementations CS 5010 Program Design Paradigms "Bootcamp" Lesson 11.2 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0
More informationCS107 Handout 37 Spring 2007 May 25, 2007 Introduction to Inheritance
CS107 Handout 37 Spring 2007 May 25, 2007 Introduction to Inheritance Handout written by Julie Zelenski, updated by Jerry. Inheritance is a language property most gracefully supported by the object-oriented
More informationState Pattern supporting both composite States and extension/specialization of State Machines
Pattern supporting both composite s and extension/specialization of Machines BIRGER MØLLER-PEDERSEN, RAGNHILD KOBRO RUNDE, University of Oslo, Norway Most modelling languages support full state machine
More informationSoda Machine Laboratory
Soda Machine Laboratory Introduction This laboratory is intended to give you experience working with multiple queue structures in a familiar real-world setting. The given application models a soda machine
More informationContracts for First-Class Classes
Contracts for First-Class Classes Technical Report NU-CCIS-1-4 T. Stephen Stricland Matthias Felleisen PLT @ Northeastern University {sstricl,matthias}@ccs.neu.edu Abstract First-class classes add expressive
More informationLecture 10. Overriding & Casting About
Lecture 10 Overriding & Casting About Announcements for This Lecture Readings Sections 4.2, 4.3 Prelim, March 8 th 7:30-9:30 Material up to next Tuesday Sample prelims from past years on course web page
More informationProgramming Languages
TECHNISCHE UNIVERSITÄT MÜNCHEN FAKULTÄT FÜR INFORMATIK Programming Languages Mixins Dr. Axel Simon and Dr. Michael Petter Winter term 2012 Mixins 1 / 35 What advanced techiques are there besides multiple
More informationCS111: PROGRAMMING LANGUAGE II
1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 8(a): Abstract Classes Lecture Contents 2 Abstract base classes Concrete classes Dr. Amal Khalifa, 2014 Abstract Classes and Methods
More informationJam: A Smooth Extension With Java Mixins
Jam: A Smooth Extension With Java Mixins Davide Ancona, Giovanni Lagorio, Ellena Zucca Presentation created by Left-out Jam abstract syntax Formal definitions of Jam static semantics Formal definitions
More information15CS45 : OBJECT ORIENTED CONCEPTS
15CS45 : OBJECT ORIENTED CONCEPTS QUESTION BANK: What do you know about Java? What are the supported platforms by Java Programming Language? List any five features of Java? Why is Java Architectural Neutral?
More informationClass, Variable, Constructor, Object, Method Questions
Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx
More informationHomework Assignment: Sudoku Board
Homework Assignment: Sudoku Board Back Overview of the project This assignment is part of a larger project to create a Sudoku application. Assignment: Sudoku Board Assignment: Sudoku Model Assignment:
More informationAnnouncements. Written Assignment 2 Due Monday at 5:00PM. Midterm next Wednesday in class, 11:00 1:00. Midterm review session next Monday in class.
Type-Checking II Announcements Written Assignment 2 Due Monday at 5:00PM. Office hours today, Sunday, and Monday. Ask questions on Piazzza! Email the staff list with questions! Midterm next Wednesday in
More informationOBJECT ORIENTED PROGRAMMING USING C++
OBJECT ORIENTED PROGRAMMING USING C++ 1 Overloading, Overriding POLYMORPHISM poly morphos many forms Overloading single method name having several alternative implementations. Overriding child class provides
More informationCISC 1600 Lecture 3.1 Introduction to Processing
CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists
More informationCS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 06 / 11 / 2015 Instructor: Michael Eckmann Today s Topics Comments and/or Questions? Sorting Searching Michael Eckmann - Skidmore College - CS 106 - Summer 2015
More informationLecture 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 informationCS 112 Introduction to Programming. (Spring 2012)
CS 112 Introduction to Programming (Spring 2012) Lecture #32: Inheritance and Class Hierarchy Zhong Shao Department of Computer Science Yale University Office: 314 Watson http://flint.cs.yale.edu/cs112
More informationSuper-Classes and sub-classes
Super-Classes and sub-classes Subclasses. Overriding Methods Subclass Constructors Inheritance Hierarchies Polymorphism Casting 1 Subclasses: Often you want to write a class that is a special case of an
More informationOOP as an Enrichment of FP
OOP as an Enrichment of FP Robert Corky Cartwright Rice University Abstract At Rice University, we have taught functional programming (FP) in Scheme in our first semester programming course for the past
More informationCS558 Programming Languages Winter 2013 Lecture 8
OBJECT-ORIENTED PROGRAMMING CS558 Programming Languages Winter 2013 Lecture 8 Object-oriented programs are structured in terms of objects: collections of variables ( fields ) and functions ( methods ).
More informationCMSC 132: Object-Oriented Programming II
CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation
More informationObject Oriented Programming and Design in Java. Session 21 Instructor: Bert Huang
Object Oriented Programming and Design in Java Session 21 Instructor: Bert Huang Announcements Homework 4 due now Homework 5 out now. Due last day of class: Mon. May 3rd Mon. May 3rd: Final review Mon.
More informationDeclarations and Access Control SCJP tips
Declarations and Access Control www.techfaq360.com SCJP tips Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms both for declaration and for
More information1 Introduction. 2 Overview of the Subclassing Anomaly. International Journal "Information Theories & Applications" Vol.10
394 International Journal "Information Theories & Applications" Vol.10 THE SUBCLASSING ANOMALY IN COMPILER EVOLUTION Atanas Radenski Abstract. Subclassing in collections of related classes may require
More informationJava for Non Majors Spring 2018
Java for Non Majors Spring 2018 Final Study Guide The test consists of 1. Multiple choice questions - 15 x 2 = 30 points 2. Given code, find the output - 3 x 5 = 15 points 3. Short answer questions - 3
More informationCIS 110: Introduction to computer programming
CIS 110: Introduction to computer programming Lecture 25 Inheritance and polymorphism ( 9) 12/3/2011 CIS 110 (11fa) - University of Pennsylvania 1 Outline Inheritance Polymorphism Interfaces 12/3/2011
More informationCS/ENGRD 2110 FALL Lecture 5: Local vars; Inside-out rule; constructors
1 CS/ENGRD 2110 FALL 2016 Lecture 5: Local vars; Inside-out rule; constructors http://courses.cs.cornell.edu/cs2110 References to text and JavaSummary.pptx 2 Local variable: variable declared in a method
More informationNewspeak: Not Just for English Socialists Anymore
Newspeak: Not Just for English Socialists Anymore Gilad Bracha Distinguished Engineer Cadence Design Systems 1 What is Newspeak? - Newspeak... had been devised to meet the ideological needs of Ingsoc,
More informationLecture 07, Fall 2018 Wednesday September 19
Arrays Oliver W. Layton CS231: Data Structures and Algorithms Lecture 07, Fall 2018 Wednesday September 19 Follow-up (1/2) Overriding a "built-in" method (e.g. equals()) with same parameter numbers and
More informationClass 22: Inheritance
Menu Class 22: Inheritance Objects Review Object-Oriented Programming Inheritance CS50: Computer Science University of Virginia Computer Science David Evans http://www.cs.virginia.edu/evans 2 Objects When
More informationPart 2 Add Frame, Arrow, Painted Text.
Part 2 Add Frame, Arrow, Painted Text. You can use the same Picture on PicPick, or add a new one as I showed you in Step 2 - Part 1. As I mentioned before in Step 2 - Part 1, if you don't have PicPick,
More informationWhy Macros? Scheme-Style Macros: Patterns and Lexical Scope. Macros versus Arbitrary Program Generators. Macros versus Arbitrary Program Generators
Why Macros? Scheme-Style Macros: Patterns and Lexical Scope Language designers have to stop somewhere Matthew Flatt University of Utah (544 pages) No language can provide every possible useful construct
More informationLate-bound Pragmatical Class Methods
Late-bound Pragmatical Class Methods AXEL SCHMOLITZKY, MARK EVERED, J. LESLIE KEEDY, GISELA MENGER Department of Computer Structures University of Ulm 89069 Ulm, Germany {axel, markev, keedy, gisela@informatik.uni-ulm.de
More informationCS260 Intro to Java & Android 03.Java Language Basics
03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance
More informationMcJava A Design and Implementation of Java with Mixin-Types
McJava A Design and Implementation of Java with Mixin-Types Tetsuo Kamina and Tetsuo Tamai University of Tokyo 3-8-1, Komaba, Meguro-ku, Tokyo, 153-8902, Japan {kamina,tamai}@graco.c.u-tokyo.ac.jp Abstract.
More informationFeatherweight Scala. Week 14
Featherweight Scala Week 14 1 Today Previously: Featherweight Java Today: Featherweight Scala Live research, unlike what you have seen so far. Focus today on path-dependent types Plan: 1. Rationale 2.
More informationBasics of Inheritance
Basics of Inheritance CS 5010 Program Design Paradigms "Bootcamp" Lesson 11.1 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
More informationObject Oriented Programming: Based on slides from Skrien Chapter 2
Object Oriented Programming: A Review Based on slides from Skrien Chapter 2 Object-Oriented Programming (OOP) Solution expressed as a set of communicating objects An object encapsulates the behavior and
More informationCMSC 132: Object-Oriented Programming II
CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation
More informationChapter 3: Inheritance and Polymorphism
Chapter 3: Inheritance and Polymorphism Overview Inheritance is when a child class, or a subclass, inherits, or gets, all the data (properties) and methods from the parent class, or superclass. Just like
More informationInheritance and Polymorphism
Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationWeiss 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 informationComputing Science 114 Solutions to Midterm Examination Tuesday October 19, In Questions 1 20, Circle EXACTLY ONE choice as the best answer
Computing Science 114 Solutions to Midterm Examination Tuesday October 19, 2004 INSTRUCTOR: I E LEONARD TIME: 50 MINUTES In Questions 1 20, Circle EXACTLY ONE choice as the best answer 1 [2 pts] What company
More informationSafe Dynamic Multiple Inheritance
Safe Dynamic Multiple Inheritance Erik Ernst 1 Dept. of Computer Science, University of Aarhus, Denmark Abstract. Combination of descriptive entities i.e. multiple inheritance and related mechanisms is
More informationPart 7 More fill styles and an effect
Part 7 More fill styles and an effect Introduction To break the uniformity of the grass fill style, this part will continue creating fill styles and adding sheets show how to copy fill styles show how
More informationOverloading and Inheritance
Overloading and Inheritance Davide Ancona ½, Sophia Drossopoulou ¾, Elena Zucca ½ ½ DISI, University of Genova, ¾ Department of Computing, Imperial College E-mail: ÞÙ Ú ÙÒØ ÓÙ Abstract Overloading allows
More information5. In JAVA, is exception handling implicit or explicit or both. Explain with the help of example java programs. [16]
Code No: R05220402 Set No. 1 1. (a) java is freeform language. Comment (b) Describe in detail the steps involved in implementing a stand-alone program. (c) What are command line arguments? How are they
More informationDefinition of DJ (Diminished Java)
Definition of DJ (Diminished Java) version 0.5 Jay Ligatti 1 Introduction DJ is a small programming language similar to Java. DJ has been designed to try to satisfy two opposing goals: 1. DJ is a complete
More informationScheme-Style Macros: Patterns and Lexical Scope
Scheme-Style Macros: Patterns and Lexical Scope Matthew Flatt University of Utah 1 Why Macros? Language designers have to stop somewhere (544 pages) No language can provide every possible useful construct
More informationCasting in C++ (intermediate level)
1 of 5 10/5/2009 1:14 PM Casting in C++ (intermediate level) Casting isn't usually necessary in student-level C++ code, but understanding why it's needed and the restrictions involved can help widen one's
More informationINHERITANCE. Spring 2019
INHERITANCE Spring 2019 INHERITANCE BASICS Inheritance is a technique that allows one class to be derived from another A derived class inherits all of the data and methods from the original class Suppose
More informationCS/ENGRD 2110 SPRING 2018
1 The fattest knight at King Arthur's round table was Sir Cumference. He acquired his size from too much pi. CS/ENGRD 2110 SPRING 2018 Lecture 6: Consequence of type, casting; function equals http://courses.cs.cornell.edu/cs2110
More informationProgramming overview
Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in
More informationMidterm assessment - MAKEUP Fall 2010
M257 MTA Faculty of Computer Studies Information Technology and Computing Date: /1/2011 Duration: 60 minutes 1-Version 1 M 257: Putting Java to Work Midterm assessment - MAKEUP Fall 2010 Student Name:
More informationDesign Pattern: Composite
Design Pattern: Composite Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. Motivation
More informationDesign Patterns and Frameworks 1) Introduction
Design Patterns and Frameworks 1) Introduction Dr. Sebastian Götz Software Technology Group Department of Computer Science Technische Universität Dresden WS 16/17, Oct 11, 2016 Slides from Prof. Dr. U.
More informationOOP as an Enrichment of FP
Position Paper for OOPSLA 2001 Workshop Pedagogies and Tools for Assimilating Object-Oriented Concepts Abstract OOP as an Enrichment of FP Robert "Corky" Cartwright and Dung "Zung" Nguyen Department of
More informationOBJECT ORIENTED PROGRAMMING. Abstract Class And Interface
OBJECT ORIENTED PROGRAMMING Abstract Class And Interface by Dr. Nor Saradatul Akmar Zulkifli Faculty of Computer Systems & Software Engineering saradatulakmar@ump.edu.my OER Object Oriented Programming
More informationToday. CSE341: Programming Languages. Late Binding in Ruby Multiple Inheritance, Interfaces, Mixins. Ruby instance variables and methods
Today CSE341: Programming Languages Late Binding in Ruby Multiple Inheritance, Interfaces, Mixins Alan Borning Spring 2018 Dynamic dispatch aka late binding aka virtual method calls Call to self.m2() in
More informationInheritance and Substitution (Budd chapter 8, 10)
Inheritance and Substitution (Budd chapter 8, 10) 1 2 Plan The meaning of inheritance The syntax used to describe inheritance and overriding The idea of substitution of a child class for a parent The various
More informationOO Technology: Properties and Limitations for Component-Based Design
TDDD05 Component-Based Software OO Technology: Properties and Limitations for Component-Based Design Interfaces Design by by Contract Syntactic Substitutability Inheritance Considered Harmful Fragile Base
More informationTopic 5 Polymorphism. " Inheritance is new code that reuses old code. Polymorphism is old code that reuses new code.
Topic 5 Polymorphism " Inheritance is new code that reuses old code. Polymorphism is old code that reuses new code. 1 Polymorphism Another feature of OOP literally having many forms object variables in
More informationTopic 7: Inheritance. Reading: JBD Sections CMPS 12A Winter 2009 UCSC
Topic 7: Inheritance Reading: JBD Sections 7.1-7.6 1 A Quick Review of Objects and Classes! An object is an abstraction that models some thing or process! Examples of objects:! Students, Teachers, Classes,
More informationInheritance in Ruby. You are familiar with the idea of inheritance and how to use this in programming.
Inheritance in Ruby You are familiar with the idea of inheritance and how to use this in programming. In this introduction, I'll describe inheritance in Ruby from scratch. Much of this material should
More information(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days
Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented
More informationEvery language has its own scoping rules. For example, what is the scope of variable j in this Java program?
Lexical Binding There are two ways a variable can be used in a program: As a declaration As a "reference" or use of the variable Scheme has two kinds of variable "declarations" -- the bindings of a let-expression
More information