aboutsummaryrefslogtreecommitdiffstats
path: root/docs/teaching/exercises/pre-letter.txt
blob: 4833beeb558a12a592abdf2af10ca0bff2bc4a6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
Dear OOPSLA 2002 attendee;

We have you listed as being registered for tutorial T40,
Aspect-oriented programming with AspectJ.  We are excited about giving
this tutorial, and hope you will enjoy the presentation, exercises and
discussion we have prepared.

As with our past tutorials of this form, in the afternoon we would
like to break the attendees into groups of two or three and work
through a number of AspectJ exercises together.

We will be bringing media and making ourselves available during breaks
for help with setup, but in order to jump straight in and give you the
most we can from this tutorial, it would really help us if many of you
had an AspectJ environment installed early.

This message contains basic instructions on where to get some needed
tools.  These instructions will not take much time. 

If you are planning to bring a laptop to the tutorial, would you
please take the time to do the steps outlined in this message?  

If you're not planning to, you might want to install an AspectJ
environment on your desktop anyway and try the instructions below, so
you will be comfortable when we meet on Wednesday.

[If you already have a working AspectJ environment and are familliar
with it, we still recommend that you upgrade to 1.0.6 and follow the
steps below]

Thank you, and please don't hesitate to contact us (at
support@aspectj.org) if you have any questions.  See you on
Wednesday...

-Erik Hilsdale, 
 Jim Hugunin, 
 and the whole AspectJ Team


Getting Ready for T40, Aspect-oriented programming with AspectJ
--------------------------------------

Overview:

  0. Install AspectJ
  1. Download JUnit and put it on your classpath
  2. Test your setup
  
------------------------------
0. AspectJ

Download the AspectJ 1.0.6 from

  http://aspectj.org/dl

You should definitly download and intstall the tools package and the
docs package.  If you plan to use JBuilder, Forte/NetBeans, Emacs, or
Eclipse for your development, you should download the appropriate
plugin.


------------------------------
1. JUnit

We use the JUnit framework for testing our exercises.  Download JUnit
from 

   http://www.junit.org

and place junit.jar on your CLASSPATH.  


------------------------------
2. Test your setup

a. Create a file "Hello.java" with this class:

    class Hello {
        public static void main(String[] args) {
            System.err.println(getHelloString());
        }
        public static String getHelloString() { 
            return "Hello, WORLD"; 
        }
    }

b. Compile the class with ajc and run it...

    > ajc Hello.java
    > java Hello
    Hello, WORLD

c. Create a file "TestHello.java" with this class:
    
    public class TestHello extends junit.framework.TestCase {
        public TestHello(String name) {
            super(name);
        }
        public static void main(String[] args) {
            junit.textui.TestRunner.run(TestHello.class);
        }
        public void testHello() {
             assertEquals("Hello, OOPSLA", Hello.getHelloString());
        }
    }

d. Compile the class with ajc and run it...

    > ajc TestHello.java
    > java TestHello
    .F
    Time: 0.01
    There was 1 failure:
    1) testHello(TestHello)junit.framework.ComparisonFailure: 
    expected:<...OOPSLA> but was:<...WORLD>
            at TestHello.testHello(TestHello.java:9)
            at TestHello.main(TestHello.java:6)

    FAILURES!!!
    Tests run: 1,  Failures: 1,  Errors: 0

e. Oops... the test case seems to want a different string than the
   tested class.  Fix that, compile whichever file you changed with
   ajc, run the tester again, and you're done.  Thanks!

    > java TestHello
    .
    Time: 0

    OK (1 test)