Lecture 10: Using Object-Oriented Languages

Slides:



Advertisements
Similar presentations
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 5: Languages Bugs and/or Features.
Advertisements

Chapter 25 More Design Patterns.
Lecture 7: Objects and Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271 
Comparison of OO Programming Languages © Jason Voegele, 2003.
WIKI IN EDUCATION Giti Javidi. W HAT IS WIKI ? A Wiki can be thought of as a combination of a Web site and a Word document. At its simplest, it can be.
CS 106 Introduction to Computer Science I 04 / 13 / 2007 Friday the 13 th Instructor: Michael Eckmann.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 18: Behavioral Subtyping and.
Invitation to Computer Science, Java Version, Second Edition.
1 COMP313A Programming Languages Object Oriented Progamming Languages (3)
INTERNAL ASSESSMENT ADVICE Or…how to get a 7 on your Internal Assessment.
Making Decisions uCode: October Review What are the differences between: o BlueJ o Java Computer objects represent some thing or idea in the real.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 12: Subtyping Rules What’s the.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 3: Levels of Abstraction
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 17: Inheritance & Behavioral.
Cs205: engineering software university of virginia fall 2006 David Evans Substitution Principle.
12/4/20151 Introduction To Computer Science Bina Ramamurthy.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 14: Substitution Principle.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 16: Smalltalking about Objects.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
Georgia Institute of Technology More on Creating Classes part 3 Barb Ericson Georgia Institute of Technology Nov 2005.
Cs2220: Engineering Software Class 13: Behavioral Subtyping Fall 2010 University of Virginia David Evans.
INTERNAL ASSESSMENT ADVICE Or…how to get a 7 on your Internal Assessment.
INF3110 Group 2 EXAM 2013 SOLUTIONS AND HINTS. But first, an example of compile-time and run-time type checking Imagine we have the following code. What.
Class Relationships Lecture Oo08 Polymorphism. References n Booch, et al, The Unified Modeling Language User Guide, Chapt 10 p.125 n Fowler & Scott, UML.
1 CS Programming Languages Class 10 September 26, 2000.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 11: Subtyping and Inheritance.
CSCE 240 – Intro to Software Engineering Lecture 3.
1 Computer Science 1021 Programming in Java Geoff Draper University of Utah.
PRG 420 Entire Course FOR MORE CLASSES VISIT PRG 420 Week 1 Individual Assignment Hello world PRG 420 Week 2 Individual Assignment.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Introduction to PAD2 Dr. Mark C. Lewis
Introduction to CSCI 1311 Dr. Mark C. Lewis
(Thunking about Thunks)
Lecture 4: Metacircles Eval Apply David Evans
OOP - Object Oriented Programming
Lecture 6: Lambda Calculus
Types for Programs and Proofs
CSE 374 Programming Concepts & Tools
Lecture 2: Schreme David Evans
It’s called “wifi”! Source: Somewhere on the Internet!
Class 22: Inheritance CS150: Computer Science University of Virginia
CSC 221: Computer Programming I Fall 2005
Lambda Calculus Revisited
Lecture 2 of Computer Science II
Unit 1 Good friends. Unit 1 Good friends Warming up Learn the new words.
We’ll be spending minutes talking about Quiz 1 that you’ll be taking at the next class session before you take the Gateway Quiz today.
Lecture 8: SmallTalking about Objects
Subtyping Rules David Evans cs205: engineering software BlackBear
Names, Binding, and Scope
Lecture 21: Inheritance CS200: Computer Science University of Virginia
CSCE 315 – Programming Studio, Fall 2017 Tanzir Ahmed
Lecture 14: Blocking and Catching Photons Background
Lecture 21: Crosscutting Aspect-Oriented Programming Background
Lecture 10: The Return of Paco Background just got here last week
Lecture 7: Data Abstraction
Method of Classes Chapter 7, page 155 Lecture /4/6.
Lecture 19: Proof-Carrying Code Background just got here last week
Lecture 10: Fixed Points ad Infinitum M.C. Escher, Moebius Ants
Java Programming Language
Review of Previous Lesson
David Evans Lecture 19: ||ism I don’t think we have found the right programming concepts for parallel computers yet.
Lecture 13: Proof-Carrying Code Background just got here last week
Lecture 12: Minding your Ps & Qs:
Lecture 14: Mocking Mockingbirds
Lecture 15: Crazy Eddie and the Fixed Points Background
Lecture 13: Subtyping Rules Killer Bear Climber
Lecture 9: When is S  T safe? Killer Bear
Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker May 1, 2000
EXPLANATORY SYNTHESIS Bawcom
Presentation transcript:

David Evans http://www.cs.virginia.edu/~evans Lecture 10: Using Object-Oriented Languages You can't think seriously about thinking without thinking about thinking about something. Seymour Papert Today’s corollary: You can’t think seriously about programming, without thinking about programming something. Start working in groups as described in the manifest. Background just got here last week finished degree at MIT week before Philosophy of advising students don’t come to grad school to implement someone else’s idea can get paid more to do that in industry learn to be a researcher important part of that is deciding what problems and ideas are worth spending time on grad students should have their own project looking for students who can come up with their own ideas for research will take good students interested in things I’m interested in – systems, programming languages & compilers, security rest of talk – give you a flavor of the kinds of things I am interested in meant to give you ideas (hopefully even inspiration!) but not meant to suggest what you should work on CS655: Programming Languages University of Virginia Computer Science David Evans http://www.cs.virginia.edu/~evans

University of Virginia CS 655 Menu Today’s Task Position Paper Hints Contravariance, covariance and ski-team room-mates Language team sales pitches 24 February 2019 University of Virginia CS 655

University of Virginia CS 655 Today’s Task Show a high-level module design for your web browser Depending on the language, this might have subclassing, subtyping and uses relationships. Show a concrete code excerpt for redisplaying all the elements Argue that your design (in conjunction with your implementation language) is superior to alternatives Assume all languages have equally good development tools, well-trained programmers, etc. 24 February 2019 University of Virginia CS 655

University of Virginia CS 655 Position Paper Hints Average on Position Paper 2 = 0.89 (12 out of 25 were 1.0 or above) Make sure to answer the assigned question If it isn’t clear, ask If you make general statements, back them up with real examples Don’t turn in a laundry list – select and organize the important things Be resourceful, cite your resources Things in your references list should be cited in your text (e.g., Bounds checking can be added to C [Wahbe93] ...) 24 February 2019 University of Virginia CS 655

University of Virginia CS 655 Contra/Co-Variance Athlete How can Girl override set_roomate? Covariance: set_roommate (Girl) set_roommate (Boy) Contravariance: set_roommate (Athlete) Novariance: set_roommate (Skier) (Eiffel) Skier set_roommate (Skier) (Sather) (C++ - but changing?, Java) Boy Girl Problem: s: skier; g: girl; b: boy; s := g; ... s.set_roommate (b); 24 February 2019 University of Virginia CS 655

What’s wrong with Meyer’s Rule? Disallow polymorphic catcalls: s.f (t) where some subtype of type of s hides f or changes covariantly type of parameters of f. Violates useful notion of subtyping: adding a new subtype breaks existing programs! 24 February 2019 University of Virginia CS 655

University of Virginia CS 655 What does C++ do? Can add covariant methods in subtype, but they overload the original method, instead of overriding it! Example: class skier { virtual void set_roommate (class skier *); } class girl : public skier { void set_roommate (class girl *); // overloads! } // class boy similar skier *s; girl *g; boy *b; s = g; s->set_roommate (b); // No type error – calls skier::set_roommate! g->set_roommate (b); // Some compilers complain (but shouldn’t?) Good explanation is worth 1 position paper point. 24 February 2019 University of Virginia CS 655

University of Virginia CS 655 Some C++ Facts 1996 Draft Standard is 680 pages long 50x more complex than Algol60! Is this progress? Current open issues list of Core Language Issues contains 173 issues Compare to Knuth’s 9 ambiguities in Algol 60 Current open issues list for standard library (Revision 12) is 59 pages Good luck! 24 February 2019 University of Virginia CS 655

Browser Design Pitches Next time: John Viega on Automated Delegation solution to Multiple Inheritance Think of and send me one good question. Accomplish something interesting to talk about in your project meetings. 24 February 2019 University of Virginia CS 655