Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 10: Using Object-Oriented Languages

Similar presentations


Presentation on theme: "Lecture 10: Using Object-Oriented Languages"— Presentation transcript:

1 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

2 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

3 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

4 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

5 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

6 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

7 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

8 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

9 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


Download ppt "Lecture 10: Using Object-Oriented Languages"

Similar presentations


Ads by Google