MURA Office hours Thurs at 12-1pm in CIT 546 Contact for more info.
|
|
- Spencer Edwards
- 6 years ago
- Views:
Transcription
1 Course Announcements Lecture capture has begun, available from Lectures page. First two and a half weeks are packed. Testing lab done, HTML started, and Stars due next Friday. Department has a lot of student research opportunities MURA Office hours Thurs at 12-1pm in CIT 546 Contact mura@cs.brown.edu for more info. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
2 Engineering with Interfaces John Jannotti /course/cs0320/www/lectures/ Feb 1, 2018 John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
3 Review(?): Java Interfaces An interface is a collection of related method signatures. Interface methods contain no code. This has changed slightly in Java 8. See default methods. A class implements an interface by Saying so: implements Runnable And: Implementing every method from the interface. An interface is used as a type, just like a class. An object of any class that implements the type can be assigned. Animal cardinal = new Bird(Color.RED, location); You can only call the Animal methods on cardinal, not Bird s. bird.move() perhaps, but not bird.fly(). List<Cat> cats = new ArrayList<>(); cats.ensurecapacity(1000); is a compile error. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
4 Interfaces specify, they do not implement Export functionality without revealing/promising details. List<String> names = Collections.emptyList(); What is the class of names? Constrain objects taken as arguments. Arguments to methods: Collections.shuffle(List) Arguments to generic types, like... John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
5 Interfaces specify, they do not implement Export functionality without revealing/promising details. List<String> names = Collections.emptyList(); What is the class of names? Constrain objects taken as arguments. Arguments to methods: Collections.shuffle(List) Arguments to generic types, like... public class KdTree<T extends Cartesian> John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
6 Interfaces specify, they do not implement Export functionality without revealing/promising details. List<String> names = Collections.emptyList(); What is the class of names? Constrain objects taken as arguments. Arguments to methods: Collections.shuffle(List) Arguments to generic types, like... public class KdTree<T extends Cartesian> Or both in one example. List safe = Collections.unmodifiableList(lst) John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
7 Interfaces specify, they do not implement Export functionality without revealing/promising details. List<String> names = Collections.emptyList(); What is the class of names? Constrain objects taken as arguments. Arguments to methods: Collections.shuffle(List) Arguments to generic types, like... public class KdTree<T extends Cartesian> Or both in one example. List safe = Collections.unmodifiableList(lst) Your first Pattern: Decorator (But a particularly vacuous example) John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
8 Example: Comparable Java supplies a Collections.sort() method. What can you pass it? How would you sort Strings? LatLng? Chairs? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
9 Example: Comparable Java supplies a Collections.sort() method. What can you pass it? How would you sort Strings? LatLng? Chairs? If you look it up, you find: void sort(list<t> list) Where did T come from? What should T mean? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
10 Example: Comparable Java supplies a Collections.sort() method. What can you pass it? How would you sort Strings? LatLng? Chairs? If you look it up, you find: void sort(list<t> list) Where did T come from? What should T mean? sort() shouldn t need to know how every T is ordered. So it requires that its argument implement Comparable. Technically: <T extends Comparable<? super T>> To be Comparable, objects implement one method, compareto(). Collections.sort calls compareto() as needed. Back to LatLng... What might LatLng.compareTo() do? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
11 Example: Comparable Java supplies a Collections.sort() method. What can you pass it? How would you sort Strings? LatLng? Chairs? If you look it up, you find: void sort(list<t> list) Where did T come from? What should T mean? sort() shouldn t need to know how every T is ordered. So it requires that its argument implement Comparable. Technically: <T extends Comparable<? super T>> To be Comparable, objects implement one method, compareto(). Collections.sort calls compareto() as needed. Back to LatLng... What might LatLng.compareTo() do? If there s no LatLng.compareTo(), can I sort them? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
12 Example: Comparable Java supplies a Collections.sort() method. What can you pass it? How would you sort Strings? LatLng? Chairs? If you look it up, you find: void sort(list<t> list) Where did T come from? What should T mean? sort() shouldn t need to know how every T is ordered. So it requires that its argument implement Comparable. Technically: <T extends Comparable<? super T>> To be Comparable, objects implement one method, compareto(). Collections.sort calls compareto() as needed. Back to LatLng... What might LatLng.compareTo() do? If there s no LatLng.compareTo(), can I sort them? The two argument version of sort() takes another interface, Comparator, to add more flexibility. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
13 Comparable.java (Download the JDK source!) 1 p u b l i c i n t e r f a c e Comparable<T> { 2 / 3... o the o b j e c t to be compared. r e t u r n a n e g a t i v e i n t e g e r, zero, or a 6 p o s i t i v e i n t e g e r as t h i s o b j e c t 7 i s l e s s than, e q u a l to, or g r e a t e r 8 than the s p e c i f i e d o b j e c t. 9 N u l l P o i n t e r E x c e p t i o n i f o i s n u l l C l a s s C a s t E x c e p t i o n i f the type o f o 2 cannot b e i n g compared to t h i s. 3 / 4 p u b l i c i n t compareto (T o ) ; 5 } John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
14 Comparator separates a class and a sort order 1 p u b l i c i n t e r f a c e Comparator<T> { 2 i n t compare (T o1, T o2 ) ; 3 } 4 p u b l i c N o r t h F i r s t implements Comparator<LatLong> { 5 i n t compare ( LatLng a, LatLng b ) { 6 r e t u r n Double. compare ( a. g e t L a t i t u d e ( ), 7 b. g e t L a t i t u d e ( ) ) ; 8 } 9 } 0 C o l l e c t i o n s. s o r t ( somepoints, new N o r t h F i r s t ( ) ) ; 1 // somepoints i s now s o r t e d. How? 2 // What happens i f some p o i n t s have the same l a t i t u d e? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
15 A Comparator can profitably use state 1 p u b l i c N e a r e s t implements Comparator<LatLong> { 2 p r i v a t e f i n a l LatLng pt ; 3 p u b l i c N e a r e s t ( LatLng pt ) { 4 t h i s. pt = pt ; 5 } 6 i n t compare ( LatLng a, LatLng b ) { 7 r e t u r n Double. compare ( pt. d i s t a n c e ( a ), 8 pt. d i s t a n c e ( b ) ) ; 9 } 0 } 1 LatLng pvd = new LatLng ( , 71.09); 2 C o l l e c t i o n s. s o r t ( somepoints, new N e a r e s t ( pvd ) ) ; 3 // somepoints a r e now i n o r d e r from P r o v i d e n c e. 4 // With lambda e x p r e s s i o n s, t h i s becomes one l i n e. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
16 Using interfaces 1 i n t e r f a c e V e h i c l e { v o i d move ( ) ; } 2 c l a s s Car implements V e h i c l e { 3 p u b l i c v o i d move ( ) { d r i v e ( ) ; } 4 v o i d d r i v e ( ) { / / } } 5 c l a s s Boat implements V e h i c l e { 6 p u b l i c v o i d move ( ) { f l o a t ( ) ; } 7 v o i d f l o a t ( ) { / / } } 8 V e h i c l e v = new V e h i c l e ( ) ; 9 V e h i c l e c a r = new Car ( ) ; 0 V e h i c l e boat = new Boat ( ) ; 1 c a r. d r i v e ( ) ; 2 boat. move ( ) ; Which lines contain compile-time errors? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
17 Case study: Battleship Tournament Consider a library for running games, or entire tournaments. User implements some strategies, library tries them out. How can the library avoid impacting player design? Good libraries do not impose their world-view on callers. The library provides a Game and Tournament abstraction. How would you implement Game? How does a caller construct one? How about Tournament? How can the library make games on demand? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
18 What are the Classes? What information do we need? To describe the competitors? To enforce rules? To determine a winner (of a game? of a tournament?) How can callers supply that information? Without undue inconvenience. Or constraint on their design. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
19 First, imagine you are the caller. In a library, your first concern should be how your code will be used. How would you like the code to look? What would you pass to a Game object? A Tournament object? 1 p u b l i c c l a s s Main { 2 p u b l i c s t a t i c main ( S t r i n g [ ] a r g s ) { 3 Game g = new Game (... ) ; Tournament t = new Tournament (... ) ; 6 } 7 } What makes sense in the ellipses? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
20 Now, realize you are not the caller. You should not force callers to use your classes. You should not expose your internal classes. Interfaces are much more flexible. Consider exactly what Game needs from Player. Start the game, convey rules. Get Player s ship positions. Ask the Player to take a turn. Report to the Player what happened. Define an interface with exactly those requirements. A caller may implement the interface using their own existing abstractions. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
21 Player.java 1 package edu. brown. cs. s t a f f. b a t t l e s h i p ; 2 3 import j a v a. u t i l. Map ; 4 5 p u b l i c i n t e r f a c e P l a y e r { 6 Map<Ship, Placement> s e t u p ( P o s i t i o n max ) ; 7 P o s i t i o n f i r e ( ) ; 8 v o i d r a d a r ( P o s i t i o n pos, Impact impact ) ; 9 } John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
22 How much design is dictated? Note that there s no concept of Board, or Game State Yes, Game will surely have one internally. But clients do not use Game s representation. Game need not even be a public class. General principle: sharing state is error-prone. Clients are not required to inherit from a class. A Java class extends only one superclass. But it implements as many interfaces as desired. What if a caller also wants to use a UI or persistence library? Why expose Placement, Position, and Impact? These are small concepts. And are mostly information for the caller. All are immutable. You could make them interfaces too, but little gain. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
23 A Player is largely unconstrained Let s look at... DumbPlayer RandomPlayer DecentPlayer MemoPlayer extents WrapPlayer Note that none contain a Board. They have their own notions of important state. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
24 What about Tournaments? Can you run a Tournament with the Player interface? Maybe. Tournament could call setup() for each new game. But there are drawbacks Explaining the Player lifecycle becomes more complex. Not ETU. Reinitializing objects smells bad. Not SFB. Doomed to run the tournament on only one core. Not RFC. Let s have the Tournament start each Game with fresh Players. How can callers provide all those Players? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
25 A bad idea... 1 p u b l i c c l a s s Main { 2 p u b l i c s t a t i c main ( S t r i n g [ ] a r g s ) { 3 Tournament t = new Tournament ( ) ; 4 L i s t <Player > randoms = new A r r a y L i s t <>(); 5 L i s t <Player > d e c e n t s = new A r r a y L i s t <>(); 6 f o r ( i n t i = 0 ; i < 100; i ++) { 7 randoms. add ( new RandomPlayer ( ) ) ; 8 d e c e n t s. add ( new D e c e n t P l a y e r ( ) ) ; 9 } 0 t. a d d P l a y e r ( Randy, randoms ) ; 1 t. a d d P l a y e r ( Joe, d e c e n t s ) ; 2 t. run ( ) ; 3 } 4 } Could we let the Tournament instantiate the Players as needed, instead? John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
26 Factories abstract creation Code in one module needs to create objects best made by another. Tournament needs to create Players to run more Games. The second module can supply a Factory instead of the objects themselves. (Your second Pattern) 1 package edu. brown. cs32. s t a f f. b a t t l e s h i p ; 2 3 p u b l i c i n t e r f a c e P l a y e r F a c t o r y { 4 p u b l i c P l a y e r c r e a t e ( ) ; 5 } John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
27 A better idea. 1 p u b l i c s t a t i c main ( S t r i n g [ ] a r g s ) { 2 Tournament t = new Tournament ( ) ; 3 t. a d d P l a y e r ( Randy, new RandomFactory ( ) ) ; 4 t. a d d P l a y e r ( Dumbo, new DumbFactory ( ) ) ; 5 t. run ( ) ; 6 } As needed, the Tournament invokes create() on the supplied Factory. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
28 Review Design in terms of interfaces Keep the interfaces short and abstract, only what is required. Only expose classes if you must, or they are very simple. Think about different approaches Although there are no completely right or wrong answers, Some are better than others Simpler, easier to use. (ETU, SFB) More flexible in handling evolution. (RFC) If a design is bad in one way, it had better have something else to recommend it. You might sacrifice ETU for a large performance gain, but you had better be sure you need to. Hint: profile. John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
29 Before Java 8, interfaces can be wordy Recall Tournament.addPlayer(PlayerFactory pf). Defined a new interface, PlayerFactory, to let callers do creation as needed. Callers created a PlayerFactory implementation, then constructed it. t.addplayer( Randy, new RandomFactory()) Wordy, and hides the implementation (from the callsite) John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
30 Lambda expressions to the rescue Prefer Tournament.addPlayer(Supplier<Player> sp) 1 Call with t.addplayer("randy", () => new RandomPlayer()) Compiler sees that Tournament.addPlayer expects a Functional or Single Abstract Method interface. So it creates one. Handy interfaces like Supplier avoid declaring a lot of new interfaces. Lambdas avoid the creation of tiny interface implementations. You can also use a method reference to implement a SAM. Then call with t.addplayer("randy", RandomPlayer::new) 1 java.util.function.supplier, which contains only get(). John Jannotti (cs32) Engineering with Interfaces Feb 1, / 1
Announcements. John Jannotti (cs32) Design Patterns Feb 13, / 1
Announcements We ll code review Stars on Thursday. Volunteer your code by emailing me. Lab this week covers Ajax/Javascript. Interactive UIs. No lab (or lab hours) next week. Submit a group project idea
More informationCourse Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface.
Course Announcements Bacon is due next Monday. Today s lecture will help thinking about your DB interface. Next lab is about drawing UIs. John Jannotti (cs32) ORMs Mar 9, 2017 1 / 24 ORMs John Jannotti
More informationCourse Announcements. John Jannotti (cs32) Scope, Collections & Generics Feb 8, / 1
Course Announcements Stars is due tomorrow. Stars grades should be out by next Monday. Javascript lab out today. How you make interactive webby GUIs. Today we re going to cover a bit of a hodge podge.
More informationMaps performance tips On server: Maintain DB connections, prepared statements (per thread/request!)
Announcements Maps performance tips On server: Maintain DB connections, prepared statements (per thread/request!) Use Spark.before, Spark.after to open and close. Use ThreadLocal, or pass the connection
More informationUI Implementation. John Jannotti. Mar 21, /course/cs0320/www/docs/lectures/ John Jannotti (cs32) UI Implementation Mar 21, / 26
UI Implementation John Jannotti /course/cs0320/www/docs/lectures/ Mar 21, 2017 John Jannotti (cs32) UI Implementation Mar 21, 2017 1 / 26 Announcements If you won t see/work with your partner over Spring
More informationCS1083 Week 4 : Polymorphism
CS1083 Week 4 : Polymorphism Interfaces, Comparable, Searching David Bremner 2018-01-22 Interfaces Linear Search Binary Search Interfaces An interface is like a class, with all the implementation left
More informationCS 6110 Lecture 28 Subtype Polymorphism 3 April 2013 Lecturer: Andrew Myers
CS 6110 Lecture 28 Subtype Polymorphism 3 April 2013 Lecturer: Andrew Myers 1 Introduction In this lecture, we make an attempt to extend the typed λ-calculus for it to support more advanced data structures
More informationCS-140 Fall 2018 Test 2 Version Practice Nov. 12, Name:
CS-140 Fall 2018 Test 2 Version Practice Nov. 12, 2018 Name: 1. (10 points) For the following, Check T if the statement is true, or F if the statement is false. (a) T F : If a child overrides its parent
More informationDiscrete Mathematics for CS Fall 2003 Wagner Lecture 3. Strong induction
CS 70 Discrete Mathematics for CS Fall 2003 Wagner Lecture 3 This lecture covers further variants of induction, including strong induction and the closely related wellordering axiom. We then apply these
More informationMore on Methods and Encapsulation
More on Methods and Encapsulation Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 31, 2009 H.-T. Lin (NTU CSIE) More on Methods and Encapsulation OOP(even) 03/31/2009 0 / 38 Local Variables Local
More informationCS Java. Introduction to Java. Andy Mroczkowski Department of Computer Science Drexel University
CS 190 - Java Introduction to Java Andy Mroczkowski uamroczk@cs.drexel.edu Department of Computer Science Drexel University February 18, 2008 / Lecture 5 Outline Course Status Course Information & Schedule
More informationOctober 16, 2018 Notes on Cournot. 1. Teaching Cournot Equilibrium
October 1, 2018 Notes on Cournot 1. Teaching Cournot Equilibrium Typically Cournot equilibrium is taught with identical zero or constant-mc cost functions for the two firms, because that is simpler. I
More informationCS-140 Fall 2018 Test 2 Version Practice Nov. 12, 2018
CS-140 Fall 2018 Test 2 Version Practice Nov. 12, 2018 Name: 1. (10 points) For the following, Check T if the statement is true, or F if the statement is false. (a) T X F : If a child overrides its parent
More informationCS103 Handout 08 Spring 2012 April 20, 2012 Problem Set 3
CS103 Handout 08 Spring 2012 April 20, 2012 Problem Set 3 This third problem set explores graphs, relations, functions, cardinalities, and the pigeonhole principle. This should be a great way to get a
More informationExtensibility Patterns: Extension Access
Design Patterns and Frameworks Dipl.-Medieninf. Christian Piechnick INF 2080 christian.piechnick@tu-dresden.de Exercise Sheet No. 5 Software Technology Group Institute for SMT Department of Computer Science
More informationYes, the Library will be accessible via the new PULSE and the existing desktop version of PULSE.
F R E Q U E N T L Y A S K E D Q U E S T I O N S THE LIBRARY GENERAL W H A T I S T H E L I B R A R Y? The Library is the new, shorter, simpler name for the Business Development (Biz Dev) Library. It s your
More informationComp 11 Lectures. Mike Shah. July 26, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 26, / 40
Comp 11 Lectures Mike Shah Tufts University July 26, 2017 Mike Shah (Tufts University) Comp 11 Lectures July 26, 2017 1 / 40 Please do not distribute or host these slides without prior permission. Mike
More informationTechniques of Java Programming
Legi-Nr.:... Techniques of Java Programming ETH Zurich Date: 9 May 008 Family name, first name:... Student number:... I confirm with my signature, that I was able to take this exam under regular circumstances
More informationTou has been released!
Tou has been released! Shoot- em-up, heavy use of collision detection Much more open-ended than previous projects Easier than previous projects if you work smart Should help those of you combating the
More informationPHP-Einführung - Lesson 4 - Object Oriented Programming. Alexander Lichter June 27, 2017
PHP-Einführung - Lesson 4 - Object Oriented Programming Alexander Lichter June 27, 2017 Content of this lesson 1. Recap 2. Why OOP? 3. Git gud - PHPStorm 4. Include and Require 5. Classes and objects 6.
More informationFACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING OBJECT ORIENTED PROGRAMMING DATE 07/2014 SESSION 8:00-10:00
FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING MODULE CAMPUS CSC2A10 OBJECT ORIENTED PROGRAMMING AUCKLAND PARK CAMPUS (APK) EXAM JULY 2014 DATE 07/2014 SESSION 8:00-10:00 ASSESOR(S)
More informationComputer Science Introductory Course MSc - Introduction to Java
Computer Science Introductory Course MSc - Introduction to Java Lecture 3:,, Pablo Oliveira ENST Outline 1 2 3 Definition An exception is an event that indicates an abnormal condition
More informationClass Note #20. In today s class, the following four concepts were introduced: decision
Class Note #20 Date: 03/29/2006 [Overall Information] In today s class, the following four concepts were introduced: decision version of a problem, formal language, P and NP. We also discussed the relationship
More informationCPSC 121: Models of Computation. Module 9: Proof Techniques (part 2) Mathematical Induction
CPSC 121: Models of Computation Module 9: Proof Techniques (part 2) Mathematical Induction Module 9: Announcements Midterm #2: th Monday November 14, 2016 at 17:00 Modules 5 (from multiple quantifiers
More informationCSC236 Week 3. Larry Zhang
CSC236 Week 3 Larry Zhang 1 Announcements Problem Set 1 due this Friday Make sure to read Submission Instructions on the course web page. Search for Teammates on Piazza Educational memes: http://www.cs.toronto.edu/~ylzhang/csc236/memes.html
More informationModern Functional Programming and Actors With Scala and Akka
Modern Functional Programming and Actors With Scala and Akka Aaron Kosmatin Computer Science Department San Jose State University San Jose, CA 95192 707-508-9143 akosmatin@gmail.com Abstract For many years,
More informationNondeterministic finite automata
Lecture 3 Nondeterministic finite automata This lecture is focused on the nondeterministic finite automata (NFA) model and its relationship to the DFA model. Nondeterminism is an important concept in the
More informationDiscrete Structures Proofwriting Checklist
CS103 Winter 2019 Discrete Structures Proofwriting Checklist Cynthia Lee Keith Schwarz Now that we re transitioning to writing proofs about discrete structures like binary relations, functions, and graphs,
More informationLecture 4: Constructing the Integers, Rationals and Reals
Math/CS 20: Intro. to Math Professor: Padraic Bartlett Lecture 4: Constructing the Integers, Rationals and Reals Week 5 UCSB 204 The Integers Normally, using the natural numbers, you can easily define
More informationDiscrete Mathematics and Probability Theory Fall 2013 Vazirani Note 1
CS 70 Discrete Mathematics and Probability Theory Fall 013 Vazirani Note 1 Induction Induction is a basic, powerful and widely used proof technique. It is one of the most common techniques for analyzing
More informationUncertainty. Michael Peters December 27, 2013
Uncertainty Michael Peters December 27, 20 Lotteries In many problems in economics, people are forced to make decisions without knowing exactly what the consequences will be. For example, when you buy
More informationSolution to Proof Questions from September 1st
Solution to Proof Questions from September 1st Olena Bormashenko September 4, 2011 What is a proof? A proof is an airtight logical argument that proves a certain statement in general. In a sense, it s
More informationMI-RUB Exceptions Lecture 7
MI-RUB Exceptions Lecture 7 Pavel Strnad pavel.strnad@fel.cvut.cz Dept. of Computer Science, FEE CTU Prague, Karlovo nám. 13, 121 35 Praha, Czech Republic MI-RUB, WS 2011/12 Evropský sociální fond Praha
More information1 Trees. Listing 1: Node with two child reference. public class ptwochildnode { protected Object data ; protected ptwochildnode l e f t, r i g h t ;
1 Trees The next major set of data structures belongs to what s called Trees. They are called that, because if you try to visualize the structure, it kind of looks like a tree (root, branches, and leafs).
More informationIntroductory Quantum Chemistry Prof. K. L. Sebastian Department of Inorganic and Physical Chemistry Indian Institute of Science, Bangalore
Introductory Quantum Chemistry Prof. K. L. Sebastian Department of Inorganic and Physical Chemistry Indian Institute of Science, Bangalore Lecture - 4 Postulates Part 1 (Refer Slide Time: 00:59) So, I
More informationDatabase Applications (15-415)
Database Applications (15-415) Relational Calculus Lecture 5, January 27, 2014 Mohammad Hammoud Today Last Session: Relational Algebra Today s Session: Relational algebra The division operator and summary
More informationSharing Objects. Pieter van den Hombergh. Fontys Hogeschool voor Techniek en Logistiek. February 15, 2017
Pieter van den Hombergh Fontys Hogeschool voor Techniek en Logistiek February 15, 2017 and /FHTenL February 15, 2017 is safe Idioms 1/34 and and is safe Idioms /FHTenL February 15, 2017 2/34 visibility
More informationDiscrete Mathematics and Probability Theory Fall 2014 Anant Sahai Midterm 1
EECS 70 Discrete Mathematics and Probability Theory Fall 2014 Anant Sahai Midterm 1 Exam location: 10 Evans, Last name starting with A-B or R-T PRINT your student ID: PRINT AND SIGN your name:, (last)
More informationAndroid Services. Lecture 4. Operating Systems Practical. 26 October 2016
Android Services Lecture 4 Operating Systems Practical 26 October 2016 This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
More informationCS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name:
CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, 2017 Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : If a child overrides
More informationOperations and Supply Chain Management Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras
Operations and Supply Chain Management Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras Lecture - 13 Multiple Item Inventory - Constraint on Money Value, Space,
More informationAnnouncements Wednesday, August 30
Announcements Wednesday, August 30 WeBWorK due on Friday at 11:59pm. The first quiz is on Friday, during recitation. It covers through Monday s material. Quizzes mostly test your understanding of the homework.
More information1 Maintaining a Dictionary
15-451/651: Design & Analysis of Algorithms February 1, 2016 Lecture #7: Hashing last changed: January 29, 2016 Hashing is a great practical tool, with an interesting and subtle theory too. In addition
More informationElementary Sorts 1 / 18
Elementary Sorts 1 / 18 Outline 1 Rules of the Game 2 Selection Sort 3 Insertion Sort 4 Shell Sort 5 Visualizing Sorting Algorithms 6 Comparing Sorting Algorithms 2 / 18 Rules of the Game Sorting is the
More informationKnots, Coloring and Applications
Knots, Coloring and Applications Ben Webster University of Virginia March 10, 2015 Ben Webster (UVA) Knots, Coloring and Applications March 10, 2015 1 / 14 This talk is online at http://people.virginia.edu/~btw4e/knots.pdf
More informationAnnouncements Wednesday, August 30
Announcements Wednesday, August 30 WeBWorK due on Friday at 11:59pm. The first quiz is on Friday, during recitation. It covers through Monday s material. Quizzes mostly test your understanding of the homework.
More informationNonregular Languages
Nonregular Languages Recap from Last Time Theorem: The following are all equivalent: L is a regular language. There is a DFA D such that L( D) = L. There is an NFA N such that L( N) = L. There is a regular
More informationLearning Packet. Lesson 5b Solving Quadratic Equations THIS BOX FOR INSTRUCTOR GRADING USE ONLY
Learning Packet Student Name Due Date Class Time/Day Submission Date THIS BOX FOR INSTRUCTOR GRADING USE ONLY Mini-Lesson is complete and information presented is as found on media links (0 5 pts) Comments:
More informationLAB 3: VELOCITY AND ACCELERATION
Lab 3 - Velocity & Acceleration 25 Name Date Partners LAB 3: VELOCITY AND ACCELERATION A cheetah can accelerate from to 5 miles per hour in 6.4 seconds. A Jaguar can accelerate from to 5 miles per hour
More informationSoftware Testing Lecture 2
Software Testing Lecture 2 Justin Pearson September 25, 2014 1 / 1 Test Driven Development Test driven development (TDD) is a way of programming where all your development is driven by tests. Write tests
More informationDatabase Applications (15-415)
Database Applications (15-415) Relational Calculus Lecture 6, January 26, 2016 Mohammad Hammoud Today Last Session: Relational Algebra Today s Session: Relational calculus Relational tuple calculus Announcements:
More informationYou Might Also Like. Thanks. Connect
Thanks Thank you for downloading my product. I truly appreciate your support and look forward to hearing your feedback. You can connect with me and find many free activities and strategies over at my blog
More informationObject Oriented Software Design (NTU, Class Even, Spring 2009) Final Examination Problem Sheet TIME: 06/16/2009, 14:20 17:20
Final Examination Problem Sheet TIME: 06/16/2009, 14:20 17:20 This is a closed-book exam. Any form of cheating or lying will not be tolerated. Students can get zero scores and/or fail the class and/or
More informationLAB 3 - VELOCITY AND ACCELERATION
Name Date Partners L03-1 LAB 3 - VELOCITY AND ACCELERATION OBJECTIVES A cheetah can accelerate from 0 to 50 miles per hour in 6.4 seconds. Encyclopedia of the Animal World A Jaguar can accelerate from
More informationPython. Tutorial. Jan Pöschko. March 22, Graz University of Technology
Tutorial Graz University of Technology March 22, 2010 Why? is: very readable easy to learn interpreted & interactive like a UNIX shell, only better object-oriented but not religious about it slower than
More informationAnnouncements Monday, September 18
Announcements Monday, September 18 WeBWorK 1.4, 1.5 are due on Wednesday at 11:59pm. The first midterm is on this Friday, September 22. Midterms happen during recitation. The exam covers through 1.5. About
More informationWater Resources Systems Prof. P. P. Mujumdar Department of Civil Engineering Indian Institute of Science, Bangalore
Water Resources Systems Prof. P. P. Mujumdar Department of Civil Engineering Indian Institute of Science, Bangalore Module No. # 05 Lecture No. # 22 Reservoir Capacity using Linear Programming (2) Good
More informationToday s lecture. Scientific method Hypotheses, models, theories... Occam' razor Examples Diet coke and menthos
Announcements The first homework is available on ICON. It is due one minute before midnight on Tuesday, August 30. Labs start this week. All lab sections will be in room 665 VAN. Kaaret has office hours
More informationSpeculative Parallelism in Cilk++
Speculative Parallelism in Cilk++ Ruben Perez & Gregory Malecha MIT May 11, 2010 Ruben Perez & Gregory Malecha (MIT) Speculative Parallelism in Cilk++ May 11, 2010 1 / 33 Parallelizing Embarrassingly Parallel
More informationLecture 27: Theory of Computation. Marvin Zhang 08/08/2016
Lecture 27: Theory of Computation Marvin Zhang 08/08/2016 Announcements Roadmap Introduction Functions Data Mutability Objects This week (Applications), the goals are: To go beyond CS 61A and see examples
More informationEconomics 3012 Strategic Behavior Andy McLennan October 20, 2006
Economics 301 Strategic Behavior Andy McLennan October 0, 006 Lecture 11 Topics Problem Set 9 Extensive Games of Imperfect Information An Example General Description Strategies and Nash Equilibrium Beliefs
More informationOutline. 1 Merging. 2 Merge Sort. 3 Complexity of Sorting. 4 Merge Sort and Other Sorts 2 / 10
Merge Sort 1 / 10 Outline 1 Merging 2 Merge Sort 3 Complexity of Sorting 4 Merge Sort and Other Sorts 2 / 10 Merging Merge sort is based on a simple operation known as merging: combining two ordered arrays
More informationInstance Methods and Inheritance (1/2)
Instance Methods and Inheritance (1/2) 1 class Professor { 2 p u b l i c void say_hello ( ) { 3 System. out. p r i n t l n ( " Hello! " ) ; 4 } 5 } 6 class CSIEProfessor extends Professor { 7 p u b l i
More informationCS173 Lecture B, November 3, 2015
CS173 Lecture B, November 3, 2015 Tandy Warnow November 3, 2015 CS 173, Lecture B November 3, 2015 Tandy Warnow Announcements Examlet 7 is a take-home exam, and is due November 10, 11:05 AM, in class.
More informationThe Chameleons of Camelot
The Chameleons of Camelot João F. Ferreira joao@joaoff.com Last changed: July 27, 2009 Brief description and goals This scenario presents a generalization of the problem The Chameleons of Camelot, found
More informationCS 387/680: GAME AI MOVEMENT
CS 387/680: GAME AI MOVEMENT 4/11/2017 Instructor: Santiago Ontañón so367@drexel.edu Class website: https://www.cs.drexel.edu/~santi/teaching/2017/cs387/intro.html Outline Movement Basics Aiming Jumping
More informationBig Bang, Black Holes, No Math
ASTR/PHYS 109 Dr. David Toback Lecture 5 1 Prep For Today (is now due) L5 Reading: No new reading Unit 2 reading assigned at the end of class Pre-Lecture Reading Questions: Unit 1: Grades have been posted
More informationAnnouncements. Unit 3: Foundations for inference Lecture 3: Decision errors, significance levels, sample size, and power.
Announcements Announcements Unit 3: Foundations for inference Lecture 3:, significance levels, sample size, and power Statistics 101 Mine Çetinkaya-Rundel October 1, 2013 Project proposal due 5pm on Friday,
More informationChemical Applications of Symmetry and Group Theory Prof. Manabendra Chandra Department of Chemistry Indian Institute of Technology, Kanpur
Chemical Applications of Symmetry and Group Theory Prof. Manabendra Chandra Department of Chemistry Indian Institute of Technology, Kanpur Lecture - 09 Hello, welcome to the day 4 of our second week of
More informationThe Physics of Boomerangs By Darren Tan
The Physics of Boomerangs By Darren Tan Segment 1 Hi! I m the Science Samurai and glad to have you here with me today. I m going to show you today how to make your own boomerang, how to throw it and even
More informationSoftwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany
Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented
More informationCS 124 Math Review Section January 29, 2018
CS 124 Math Review Section CS 124 is more math intensive than most of the introductory courses in the department. You re going to need to be able to do two things: 1. Perform some clever calculations to
More informationThe beginnings of physics
The beginnings of physics Astronomy 101 Syracuse University, Fall 2018 Walter Freeman October 9, 2018 Astronomy 101 The beginnings of physics October 9, 2018 1 / 28 Announcements No office hours this week
More information(January 6, 2006) Paul Garrett garrett/
(January 6, 2006)! "$# % & '!)( *+,.-0/%&1,3234)5 * (6# Paul Garrett garrett@math.umn.edu http://www.math.umn.edu/ garrett/ To communicate clearly in mathematical writing, it is helpful to clearly express
More information1 / 9. Due Friday, May 11 th at 2:30PM. There is no checkpoint problem. CS103 Handout 30 Spring 2018 May 4, 2018 Problem Set 5
1 / 9 CS103 Handout 30 Spring 2018 May 4, 2018 Problem Set 5 This problem set the last one purely on discrete mathematics is designed as a cumulative review of the topics we ve covered so far and a proving
More informationMicroeconomic theory focuses on a small number of concepts. The most fundamental concept is the notion of opportunity cost.
Microeconomic theory focuses on a small number of concepts. The most fundamental concept is the notion of opportunity cost. Opportunity Cost (or "Wow, I coulda had a V8!") The underlying idea is derived
More informationSideNail. Martín Schonaker, Santiago Martínez
SideNail Martín Schonaker, Santiago Martínez March 24, 2010 2 Chapter 1 Quickstart 1.1 Hello, World! Listing 1.1 shows the simplest mapping example one can build with SideNail. The example shows how to
More informationChapter 3. The Scalar Product. 3.1 The scalar product using coördinates
Chapter The Scalar Product The scalar product is a way of multiplying two vectors to produce a scalar (real number) Let u and v be nonzero vectors represented by AB and AC C v A θ u B We define the angle
More informationDiscrete Mathematics and Probability Theory Summer 2014 James Cook Final Exam
CS 70 Discrete Mathematics and Probability Theory Summer 2014 James Cook Final Exam Friday August 15, 2014, 5:10pm-8:10pm. Instructions: Do not turn over this page until the proctor tells you to. Don t
More informationReal Time Operating Systems
Real Time Operating ystems Luca Abeni luca.abeni@unitn.it Interacting Tasks Until now, only independent tasks... A job never blocks or suspends A task only blocks on job termination In real world, jobs
More informationRecap Social Choice Functions Fun Game Mechanism Design. Mechanism Design. Lecture 13. Mechanism Design Lecture 13, Slide 1
Mechanism Design Lecture 13 Mechanism Design Lecture 13, Slide 1 Lecture Overview 1 Recap 2 Social Choice Functions 3 Fun Game 4 Mechanism Design Mechanism Design Lecture 13, Slide 2 Notation N is the
More informationAlgorithms for Uncertainty Quantification
Technische Universität München SS 2017 Lehrstuhl für Informatik V Dr. Tobias Neckel M. Sc. Ionuț Farcaș April 26, 2017 Algorithms for Uncertainty Quantification Tutorial 1: Python overview In this worksheet,
More informationIntermediate Logic. Natural Deduction for TFL
Intermediate Logic Lecture Two Natural Deduction for TFL Rob Trueman rob.trueman@york.ac.uk University of York The Trouble with Truth Tables Natural Deduction for TFL The Trouble with Truth Tables The
More information1 PSPACE-Completeness
CS 6743 Lecture 14 1 Fall 2007 1 PSPACE-Completeness Recall the NP-complete problem SAT: Is a given Boolean formula φ(x 1,..., x n ) satisfiable? The same question can be stated equivalently as: Is the
More informationStructure of Materials Prof. Anandh Subramaniam Department of Material Science and Engineering Indian Institute of Technology, Kanpur
Structure of Materials Prof. Anandh Subramaniam Department of Material Science and Engineering Indian Institute of Technology, Kanpur Lecture - 5 Geometry of Crystals: Symmetry, Lattices The next question
More informationThe Inductive Proof Template
CS103 Handout 24 Winter 2016 February 5, 2016 Guide to Inductive Proofs Induction gives a new way to prove results about natural numbers and discrete structures like games, puzzles, and graphs. All of
More informationLecture 5: Jun. 10, 2015
CMSC 132, Object-Oriented Programming II Summer 2015 Lecturer: Anwar Mamat Lecture 5: Jun. 10, 2015 Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor.
More informationPHYSICS 107. Lecture 1: The Puzzle of Motion. In American universities there are three main types of physics courses for nonspecialists.
PHYSICS 107 Lecture 1: The Puzzle of Motion About this course In American universities there are three main types of physics courses for nonspecialists. The first kind teaches about the physics of everyday
More informationTuring Machines Part III
Turing Machines Part III Announcements Problem Set 6 due now. Problem Set 7 out, due Monday, March 4. Play around with Turing machines, their powers, and their limits. Some problems require Wednesday's
More informationVPython Class 2: Functions, Fields, and the dreaded ˆr
Physics 212E Classical and Modern Physics Spring 2016 1. Introduction VPython Class 2: Functions, Fields, and the dreaded ˆr In our study of electric fields, we start with a single point charge source
More informationAsk. Don t Tell. Annotated Examples
Ask. Don t Tell. Annotated Examples Alfonso Gracia-Saz (alfonso@math.toronto.edu) The three principles: 1. Where is the student? 2. Help minimally. 3. Ask. Don t Tell. Ask. Don t Tell. 1 BRETT 1 Brett
More informationPHY131H1F - Class 4. Clicker Question
PHY131H1F - Class 4 Today: Vector Math Velocity and Acceleration in 2- dimensions Relative Velocity Constant Acceleration in x and y Projectile Motion Motion on a Circular Path Clicker Question A large,
More informationBig Bang, Black Holes, No Math
ASTR/PHYS 109 Dr. David Toback Lectures 10, 11 & 12 1 Prep For Today (is now due) L12 Reading: (BBBHNM Unit 2) Pre-Lecture Reading Questions: If you were misgraded, need help or an extension let me know
More informationLecture Notes on Data Abstraction
Lecture Notes on Data Abstraction 15-814: Types and Programming Languages Frank Pfenning Lecture 14 October 23, 2018 1 Introduction Since we have moved from the pure λ-calculus to functional programming
More information6.001 Recitation 22: Streams
6.001 Recitation 22: Streams RI: Gerald Dalley, dalleyg@mit.edu, 4 May 2007 http://people.csail.mit.edu/dalleyg/6.001/sp2007/ The three chief virtues of a programmer are: Laziness, Impatience and Hubris
More informationHW9 Concepts. Alex Alemi November 1, 2009
HW9 Concepts Alex Alemi November 1, 2009 1 24.28 Capacitor Energy You are told to consider connecting a charged capacitor together with an uncharged one and told to compute (a) the original charge, (b)
More informationYou Might Also Like. I look forward helping you focus your instruction while saving tons of time. Kesler Science Station Lab Activities 40%+ Savings!
Thanks Thank you for downloading my product. I truly appreciate your support and look forward to hearing your feedback. Connect You can connect with me and find many free activities and strategies over
More informationApplied C Fri
Applied C++11 2013-01-25 Fri Outline Introduction Auto-Type Inference Lambda Functions Threading Compiling C++11 C++11 (formerly known as C++0x) is the most recent version of the standard of the C++ Approved
More informationLocus Problems With Complex Numbers
Locus Locus Problems With Complex Numbers We start with a definition concept of locus. Then, we will present some basic examples of locus problems, given as regions in the complex plane. A locus is a set
More informationHW#9: Energy Conversion and Conservation of Energy
HW#9: Energy Conversion and Conservation of Energy Name: Group Galileo s Pendulum Experiment 1: Play the video Galileo Pendulum 1. Watch the entire video. You could check out the Pendulum lab simulation
More information