51 Pages

Proxy Exercise

Course: CS 525, Fall 2009
School: Maharishi
Rating:
 
 
 
 
 

Word Count: 456

Document Preview

Lab: Proxy Proxy Exercise Lab:: 1) Simple Logging /Debugging Proxy: (from class) Complete the simple proxy from class, which should be a proxy that just does a simple pre- and post- message. The steps are: a) Define a Main which should call b) Define a class Thing, with a single compute() method. For now, just have the method print its single argument. c) Define a proxy pThing, which can proxy a Thing and gives...

Register Now

Unformatted Document Excerpt

Coursehero >> Iowa >> Maharishi >> CS 525

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Lab: Proxy Proxy Exercise Lab:: 1) Simple Logging /Debugging Proxy: (from class) Complete the simple proxy from class, which should be a proxy that just does a simple pre- and post- message. The steps are: a) Define a Main which should call b) Define a class Thing, with a single compute() method. For now, just have the method print its single argument. c) Define a proxy pThing, which can proxy a Thing and gives a simple message both before and after the delegation to the actual proxy'ed subject (Thing) object. d) Improve the design by encapsulating the pre and post actions (simple messages here) into their own methods in pThing. 2) Generalize using Functor: (Lab to do) Make the proxy more general, by abstracting the pre/post methods from the proxy class, and using instead a functor argument to define them (dynamically). a) Define the Functor interface. b) In main, instantiate a functor instance of a concrete functor, which replicates the behavior of just printing pre & post messages. c) Improve this by having the proxy also print the argument values for each proxy'ed method call. d) Update Main to test this. 3) Generalize using Generics: (Lab to do) This proxy is general over methods, but specific on the (static) type of the arguments to the Thing.compute() method. Make it more general, by making both Thing and the proxy generic over this type. argument a) Make Thing generic over the argument type to its compute() method. b) Convert pThing to also be generic over this type. c) Update Main to test this. 4) Generalize over different Subject types: (Next class! ...) To make the proxy more general, we would like to have it be able to proxy various subject types, not just Thing. This is hard, because an abstraction over the target type would mean somehow (automatically) having different wrapper methods in the proxy (each with appropriate names, and argument lists and types from the subject class), and inside of each the proper delegation code which would also have to be custom for each specific method (name and argument list and types) of the target class. None of the abstraction methods we have so far can do this. Classes abstract over structure, fu...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Maharishi - CS - 525
ASD LabsAdvanced Software DevelopmentCS525Lab notes:Observer Strategy Iterator command State Chain of Responsibility (COR) Bridge Factory Visitor CompositeNote: In several places in the notes I pose a question about the lab and its design or
Maharishi - CS - 525
TimeLog report for CS525 LabsStudent: Lab:DateTime start Hours ActivityResultTotal Hours:
Maharishi - CS - 525
Advanced Software DevelopmentDaily TopicsDay 1: Overview of Advanced Software Systems o Elements of Software Development Definition of Advanced Software Development & topics o Methods of ASD o Levels of Abstraction(s) Software Metrics Laws Pr
Maharishi - CS - 401
MPP Lab Programming StructuresLevel 1Objectives: Review Java Programming Structures o main, variables, control structures, operators, passing arguments. Compiling and running from the command line. Tasks: 1. Open the Notepad editor and write a
Maharishi - CS - 401
CS401 Modern Programming Practices (MPP) Lesson 2 Classes and Objects The Unity of Differences Wholeness Objects can be modeled in many different ways, depending on their relationships with each other. It is important to model the classes such that t
Maharishi - CS - 401
MPP LAB - CLASSES & OBJECTS Level 1Objectives: Familiarize yourself with the Eclipse Integrated Development Environment (IDE). Familiarize yourself with the Java website and the Java API Documentation. Tasks: 1. Go to C:\Program Files\Java and fam
Maharishi - CS - 401
Modeling the Static/ Data Aspects of the SystemHaving employed use case analysis techniques in Chapter 9 to round out the SRS requirements specification, we're ready to tackle the next stage of modeling, which is determining how we're going to meet
Maharishi - CS - 401
Lesson 3 Lab 3.1 Page 1 of 2 COMPOSITION, ASSOCIATION & DELEGATION Human Resource ApplicationObjectives: Learn how to implement Composition and Binary Associations. Learn how to implement Delegation and Propagation Create an application to keep t
Maharishi - CS - 401
Lesson 3 Lab 3.3 Page 1 of 2 REFLEXIVE ASSOCATIONS Reporting HierarchyObjectives: Learn how to implement Reflexive Associations. Practice more Delegation and Propagation. Add a reflexive association to the Position class in order to maintain a co
Maharishi - CS - 401
Lesson 5:InterfacesJava interface is similar to abstract except.No instance variables(except final variables)No implemented methods interface replaces classpublic interface Runnable { . }implements replaces extendsMyClass extends SuperCla
Maharishi - CS - 401
Template Method PatternDon't call us, we'll call you.Case Study: Rainbow CafeTraining manual:Coffee recipeBoil some water Pour boiling water over ground coffee beans Pour coffee into cup Add milk and sugar to cupTea recipeBoil some water Ste
Wisconsin - LANDSCAPE - 565
Lundrcupe E&iogy ECoiogy 13: 65-77, 1998. @ 1998 Kluwer A c u d e m i c P u b l i s h & s . P r i n t e d i n t h e N e t h e r l a n d s .Landscape context of rural residential development in southeastern Wisconsin (USA) IJames A. LaGro Jr.Depar
Maharishi - CS - 435
CS435 Algorithms DE CourseStudent ID 000-98-1280 000-98-1551 000-98-1148 000-98-1366 000-98-1368 000-98-1519 000-98-1070 000-98-1371 000-98-1487 000-98-1385 000-98-0984 000-98-1529 000-98-1284 000-98-1444 000-98-1288 000-98-1467 000-98-1248 000-98-1
Maharishi - CS - 581
Introduction To Jess and Jess SyntaxWhat Is Jess?1. A rules engine and scripting language developed by Ernest Friedman-Hill, based on the CLIPS rules language (which is based on C and has been the baseline standard for rules languages. 2. Jess pro
Maharishi - CS - 581
Facts And Rules In JessOverview of the Jess Rule Engine1. The Jess rule engine has a working memory in which data, called "facts" are "asserted" 2. Rules are inserted into the "rule base" and will operate on the facts in the working memory. 3. The
Maharishi - CS - 581
Jess ApplicationsPart I: The Tax Forms Adviser ApplicationOverview1. The Tax Forms Adviser application is an example of a (simple) expert system. Typically, expert systems provide an interactive interface with a user; the system gets input from
Maharishi - CS - 505
TimeLog report for CS525 LabsStudent: Lab:DateTime startHours ActivityResultTotal Hours:
Maharishi - CS - 505
COMP 505: Formal Methods in Programming Languages: The Perfection of Vedic Language Lesson 0: Introduction to Formal Methods in Programming Languages: Capturing wholeness at the Abstract Field LevelIn all areas of study, it is the ability to form ab
Maharishi - CS - 505
Review TopicsReview Topics: Week 1 IP, FP Lexical analysis micro/macro syntax tokens, phrases language paradigms destructive IPs Regular Expressions meta-language semantic gap Chomsky Hierarchy CFG, BNF meta-circular Interpreter Princi
Maharishi - CS - 450
Computer Networks Lab 1Use Telnet to Contact a Time Server, get a Web Page and Send an EmailPurpose:To learn how to use telnet to experiment with some application layer protocols.Overview:Use the telnet program to open a connection with network
Maharishi - CS - 450
Computer Networks Lab 2Download and Use a Packet Capture ToolPurpose:To learn how a packet capture tool works. Packet capture is especially useful when debugging network applications, so mastering the use of a packet capture tool will be especial
Maharishi - CS - 450
Computer Networks Lab 3Experience with FTPPurpose:To learn how to use the file transfer protocol, FTP, and analyze the packets involved with the transaction.Overview:The file transfer protocol is a basic networking protocol for moving files bet
Maharishi - CS - 450
Computer Networks Lab 4CRC Practice Purpose:To gain some experience with creating a CRC code for a byte array.Overview:Cyclic Redundancy Codes are used in some link layer protocols like HDLC. Java provides a class called CRC32 in the java.util.z
Maharishi - CS - 450
Computer Networks Lab 5Explore a DHCP ServerPurpose:To explore the DHCP protocol by accessing a DHCP server and testing the commands to get an IP address and renew it.Overview:The DHCP protocol is designed to provide a flexible way of allocati
Maharishi - CS - 450
Computer Networks Lab 7Looking up Internet Addresses in JavaPurpose:To gain experience with Java's InetAddress class and learn its many uses.Overview:The InetAddress class is Java's high-level representation for an IP address and it is widely
Maharishi - CS - 450
Computer Networks Lab 9bBuild a Web site DownloaderPurpose:To explore the URL class and gain experience using it to retrieve data from the network, you are asked to create a program to download a list of web sites.Overview:The URL class can re
Maharishi - CS - 450
Computer Networks: Wholeness on the move.CS450 Computer NetworksProfessor Mark RainbowBlock 5 January 20071-Computer Networks: Wholeness on the move.Maharishi University of Management is an Equal Opportunity Institution. 2006 Maharishi Un
Maharishi - CS - 450
Lesson 2 Physical LayerIntelligence on the move.Main Points1. The physical layer of the network reference model describes the mechanical, electrical and timing characteristics of the network. Transmission media are either guided media (copper or
Maharishi - CS - 450
Lesson 4 Media Access Control Layer - EthernetThe Unified Field is here, there and everywhere.Main Points1. The channel allocation problem is the central challenge of the MAC sublayer. Protocols for sharing access have evolved from static methods
Maharishi - CS - 450
Lesson 5 Media Access Control Layer WirelessThe Unified Field is here, there and everywhere.Main Points1. Wireless networking is the fastest growing segment of computer networks, and new specifications are rapidly evolving to meet the need for n
Maharishi - CS - 450
Lesson 6 Network Layer RoutingTaking the path of least action.Main Points1. Network layer routes packets from source to destination. The route may be pre-determined (in virtual-circuit subnets) or determined per packet (in datagram subnets). Acti
Maharishi - CS - 450
Computer Networks CS450 Mid-term ExamOctober 15, 2005 Name_ ID _ Circle the correct answer. Circle only one answer per question. 1. Why is the OSI Network Reference model still referenced in publications and discussions of network technology? a) It
Maharishi - CS - 203
LESSON 1 INTRODUCTION to COMPUTER PROGRAMMING 2 Progress Takes Place in Steps In this course we will build on your experience in previous programming courses to gain deeper knowledge and experience of Java programming. The experience of deeper inner
Maharishi - CS - 203
LESSON 2 REVIEW of JAVA The Knower, Known and Process of Knowing Java has some intrinsic types, but most of our work in programming is in creating new classes to represent the objects in the problem domain. Java includes math and logical operators, c
Maharishi - CS - 203
Pink Moon/ Nick Drake/ 4/3-Feb-2007/JazzSomersault/Zero/3/15-July-2007/AlternativeSomersault/Zero/3/1-Sept-2007/AlternativeSomersault/Zero/3/17-Nov-2007/AlternativeFearless/Taylor Swift/5/12-Dec-2008/PopDark Horse/Nickelback/4/20-Dec-2008/RockT
Maharishi - CS - 440
MAHARISHI UNIVERSITY OF MANAGEMENTCOMPUTER SCIENCE DEPARTMENT COMP 440 - CompilersProgramming Assignment 1Symbol Table ClassesIn this programming assignment, you are to write Java classes to implement a symbol table. The purpose of the symbol t
Maharishi - CS - 440
MAHARISHI UNIVERSITY OF MANAGEMENTCOMPUTER SCIENCE DEPARTMENTCOMP 440 - Compilers DEProgramming Assignment 4Phase 1 of the Type Checker Building the Symbol TableSTOP: Before you begin lab assignment 4, read and make sure you understand the han
Maharishi - CS - 440
MAHARISHI UNIVERSITY OF MANAGEMENTCOMPUTER SCIENCE DEPARTMENT COMP 440 - Compilers - DEProgramming Assignment 5Phase 2 of the Type CheckerOverview of the Project So far we have implemented two of the front-end components of our simple compiler (
Maharishi - CS - 505
AN INTRODUCTION TO FUNCTIONAL PROGRAMMING THROUGH LAMBDA CALCULUS Greg MichaelsonDepartment of Computing and Electrical Engineering Heriot-Watt University Riccarton Campus Edinburgh EH14 4AS9. FUNCTIONAL PROGRAMMING IN STANDARD ML 9.1. Introductio
Maharishi - CS - 505
MAHARISHI UNIVERSITY OF MANAGEMENT COMPUTER SCIENCE COMP 501 : Formal Methods in Programming LanguagesStudy Notes:Functional Programming & Lambda CalculusThe underlying model of computation in functional programming is the function and the compu
Maharishi - CS - 450
Computer Networks Lab 1Use Telnet to Contact a Time Server, get a Web Page and Send an EmailPurpose:To learn how to use telnet to experiment with some application layer protocols.Overview:Use the telnet program to open a connection with network
Maharishi - CS - 450
Computer Networks Lab 2Download and Use a Packet Capture ToolPurpose:To learn how a packet capture tool works. Packet capture is especially useful when debugging network applications, so mastering the use of a packet capture tool will be especial
Maharishi - CS - 450
Computer Networks Lab 3Experience with FTPPurpose:To learn how to use the file transfer protocol, FTP, and analyze the packets involved with the transaction.Overview:The file transfer protocol is a basic networking protocol for moving files bet
Maharishi - CS - 450
Topics for ProjectTopics for presentations or research papers.Please write a 2-page paper on one of the following topics. The following questions may help guide your report. What are the main principles or ideas expressed in the technology? How do
Maharishi - CS - 525
ObjectObject-Oriented Application FrameworksMohamed Fayad Douglas C. SchmidtThe following is the guest editorial for the Communications of the ACM, Special Issue ObjectFrameworks, on Object-Oriented Application Frameworks Vol. 40, No. 10, October
Maharishi - CS - 525
Search for: Use + - ( ) " "within . Search helpIBM home | Products & services | Support & downloads | My account IBM developerWorks > Java technology Building object-oriented frameworks Through its use of frameworks, Taligent, Inc. is realizing t
Maharishi - CS - 561
Mapping the Business Architecture to a Component-based Software Architecture through repeated application of patternsAli Arsanjani Maharishi University of ManagementMapping the Business Architecture to a Component-based Software ArchitectureMapp
Maharishi - CS - 561
Some Patterns for Software Architecturesby Mary Shaw Carnegie Mellon UniversityChapter?Software designers rely on informal patterns, or idioms, to describe the architectures of their software systems-the configurations of components that make
Maharishi - CS - 561
Externalizing Component Manners to Achieve Greater Maintainability through a Highly Re-configurable Architectural StyleAli Arsanjani IBM Global Services, USA Maharishi University of Management, DeMontfort University aarsanjani@acm.org AbstractThe m
Maharishi - CS - 435
Lesson 3 ALGORITHM ANALYSISProgress takes place in steps of activity and rest.Main Points1. Algorithms can be analyzed by stepping through the pseudo-code to calculate the number of primitive operations as a function of the input size. Progress i
Maharishi - CS - 435
Lesson 4 STACKS AND QUEUESKnowledge is Structured in ConsciousnessMain Points1. In the natural world, abstract layers of intelligence are more general, as they synthesize and harmonize more concrete, expressed layers. In data structures, the abst
Maharishi - CS - 435
Lesson 5 VECTORS, LISTS & SEQUENCESExploring the Dynamics of Natural LawMain Points1. The Vector ADT extends the concept of an array storing objects by rank. The rank of an element is the number of elements preceding it. The main operations of th
Maharishi - CS - 435
Vectors12/28/05 16:00Vectors1Outline and ReadingThe Vector ADT (2.2.1) Array-based implementation (2.2.1)12/28/05 16:00Vectors2The Vector ADTThe Vector ADT extends the notion of array by storing a sequence of arbitrary objects An el
Maharishi - CS - 435
Lesson 6 TREES, PRIORITY QUEUES, & HEAPSPure consciousness is a source of orderliness.Main Points1. The Tree ADT models a hierarchical structure between objects simplified to a parent-child relation. Nodes store arbitrary objects and connect to o
Maharishi - CS - 435
Heaps and Priority Queues2 5 9 7 6Heaps and Priority Queues1Priority Queue ADT ( 2.4.1)A priority queue stores a collection of items An item is a pair (key, element) Main methods of the Priority Queue ADTinsertItem(k, o) inserts an item with
Maharishi - CS - 435
Dictionaries and Hash Tables0 1 2 3 4025-612-0001 981-101-0002451-229-0004Dictionaries and Hash Tables1Dictionary ADT (2.5.1)The dictionary ADT models a searchable collection of keyelement items The main operations of a dictionary are se
Maharishi - CS - 525
MAHARISHI INTERNATIONAL UNIVERSITY 1971-1995MAHARISHI UNIVERSITYof MANAGEMENTEngaging the Managing Intelligence of NatureLab 6:Observer PatternObserver : LabObserver : Lab without the observer patternpublic class Counter {.public void
Maharishi - CS - 525
MAHARISHI INTERNATIONAL UNIVERSITY 1971-1995MAHARISHI UNIVERSITYof MANAGEMENTEngaging the Managing Intelligence of NatureLab 1:Strategy patternStrategy labStrategy labpublic class ScribbleCanvasListener implements MouseListener, MouseMot
Maharishi - CS - 525
MAHARISHI INTERNATIONAL UNIVERSITY 1971-1995MAHARISHI UNIVERSITYof MANAGEMENTEngaging the Managing Intelligence of NatureLab 2:Patterns:Iterator and VisitorIterator: LabIterator: Lab without iteratorvoid JButtonAllSwimmers_actionPerformed
Maharishi - CS - 525
MAHARISHI INTERNATIONAL UNIVERSITY 1971-1995MAHARISHI UNIVERSITYof MANAGEMENTEngaging the Managing Intelligence of NatureLab 5:State PatternState : Example without state patternpublic class Application { public class Person { static public
Maharishi - CS - 525
MAHARISHI INTERNATIONAL UNIVERSITY 1971-1995MAHARISHI UNIVERSITYof MANAGEMENTEngaging the Managing Intelligence of NatureAdvanced Software DevelopmentCS Faculty Computer Science DepartmentLesson 3:Patterns:VisitorVisitor : Labpublic clas