DOC PREVIEW
MIT 6 170 - Problem Set 3: Mechanical Extraction of Object

This preview shows page 1-2-3-4 out of 13 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

IntroductionHow to Get Started:Problem 1 and Problem 2: Preliminary ExercisesHow to draw the diagrams:TODO:Problem 3: Compilation, Bytecode, and Virtual MachinesJava BytecodeTODO:Problem 4: The BCEL libraryTODO:Problem 5: THINKING about writing a static analysis tool forTODO:Problem 6: Writing a static analysis tool for Java bytecodeProblem 6.1: ArraysTODO #1:TODO #2:TODO #3:Problem 6.2: CollectionsTODO #1:TODO #2:TODO #3:Problem 6.3: YourtestsTODO:Bonus points:Problem 6.4: Singleton / Fixed SetSingleton / Fixed SetTODO #1:TODO #2:TODO #3:Problem 6.5: Function TableTODO:Problem 7TODO:Checking InGradingHintsErrataQ & AFurther Reading6.170 Laboratory in Software Engineering Fall 2005 Problem Set 3: Mechanical Extraction of Object Models from Bytecode Due: Thursday, October 6, 2005 at 1:00pm Contents: • Introduction • How to Get Started • Problem 1 and 2: Preliminary Exercises • Problem 3: Compilation, Bytecode, and Virtual Machines • Problem 4: The BCEL library • Problem 5: Thinking about writing a static analysis tool for Java bytecode • Problem 6 and 7: Implementing a static analysis tool for Java bytecode o Checking In o Grading o Hints • Errata • Q & A • Further Reading Introduction This problem set will deepen your understanding of object models by having you write a tool to mechanically extract them from Java bytecode. (In other words, you will write a program that reads in compiled Java class files and draws a picture of them.) By completing this problem set you will learn: how easy or difficult it is to express each feature of the object model notation in Java; and what is easy for a programmer to understand from reading code, but is difficult for an automatic extraction tool to deduce. We have listed the estimated required time for each problem. The time is loosely based on the amount of time that the TA's spent working on it, as well as the level of learning curve we estimate from one question to the next. It is only meant to help guide your effort; do not feel discouraged if you spend more time on a question. In fact, all the questions are cumulative, so if you spend more time figuring out how to tackle 1 question, it will help you solve the following questions as well.How to Get Started: Step 1: First of all, you must make sure you have access to the dot program. On Athena, type add outland to add it to your search path. Elsewhere, download a pre-built binary from graphviz.org. If you are working from home, you must make sure that dot is on your program search path before loading Eclipse (otherwise Eclipse won't find it). More instructions can be found on the working at home document in the tools section. Note: To verify whether your DOT is working or not, type "dot -V" on a command line prompt. You must have version 1.11 or later. (If you're on Windows, you must make sure your DOT version is 2.6 or newer). Step 2: Start up Eclipse and check out ps3. Go to the left side of the window, under ps3, you should see a file named build.xml. Right click on it, then click Run As, then click Ant Build. Make sure there are no error messages of any sort. In the past, students have reported many troubles with running Dot on a Sun Athena. Dot appears to work fine on Linux Athena and on home machines. If Dot is giving you trouble, you may need to switch to a Linux Athena machine, then type cp -r 6.170 6.170.backup to make a copy of your old 6.170 files. Then type: eclipse and then repeat the initial setup steps you did in problem set 0 (to create the two CVS repositories, and then set Java Compiler level to 5.0) Step 3: Start a web browser, then load the file ps3/doc/report.html into your browser. Make sure the file looks okay on your browser. There must be 1 picture under question 1 and 8 pictures under question 6. Throughout this problem set, you will be typing your answers into the report.html, so it is very important that you can complete all the steps listed so far. If there are any problems, please post your question to the 6.170 web forum or email a TA. Problem 1 and Problem 2: Preliminary Exercises Approximate time to completion: 15 to 30 minutes This pset will require you to type your answers into an HTML file. You do not need to know any HTML tags to do this: just open up the HTML file, search for "your text here", and write your answer in.Please use a regular text editor (eg, Eclipse's default text editor, emacs, vi, notepad) to edit the HTML, or a program that is designed to edit HTML. Please do not use a program like Microsoft Word, that can save HTML files but is not really an HTML editor. How to draw the diagrams: During this problem set you will be producing diagrams using the "Graphviz/Dot" tool. To use this tool, you (or your Java analysis tool) should write out the list of nodes and list of edges into a ".dot" file. Then you can use the "dot" program to automatically convert your ".dot" file into a graphical ".png" file. Here is a sample file that will probably have all of the features that you will need to know: digraph FileSystem { // The following 2 lines define the default NODE and EDGE attributes node [shape="box", fontname="courier", fontsize="12"]; edge [arrowhead="open", arrowsize="0.8", fontname="courier", fontsize="12"]; // subsets // note that the edges are nominally backwards // in order to get dot to draw them how one would expect // use the parallelogram shape for abstract sets FSO [label="abstract\nFile System Object", shape="parallelogram"]; FSO -> Directory [arrowhead="none", arrowtail="empty"]; Directory -> Root [arrowhead="none", arrowtail="empty"]; FSO -> File [arrowhead="none", arrowtail="empty"]; File -> Link [arrowhead="none", arrowtail="empty"]; // relations Directory -> FSO [arrowhead="open", label="contains", headlabel="*", taillabel="?"]; Link -> FSO [arrowhead="open", label="to", headlabel="!", taillabel="*"]; // use the Msquare shape for fixed sets Fixed [shape="Msquare"]; } If you save that in a file called example.dot and run the following commands you'll get the picture below: dot -Tpng -o example.png example.dotTODO: Problems 1 and 2 are listed in the file ps3/doc/report.html that we provided for you. Please open up the file, and fill in your answers to problems 1 and 2. Problem 3: Compilation,


View Full Document

MIT 6 170 - Problem Set 3: Mechanical Extraction of Object

Download Problem Set 3: Mechanical Extraction of Object
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Problem Set 3: Mechanical Extraction of Object and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Problem Set 3: Mechanical Extraction of Object 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?