2005-04-13

General Undo Redo Framework works now

Undo and Redo some times needed in some projects. The undo/redo I meant is not talking about in GUI perspective but from object state view. This framework is a part of my master thesis. It is called "General" 'cause client programmer doesn't has to make big changes on existing codes. Just declare a "command block" is ok. A command block is a undo/redo unit, it can contain a number of methods or operations. In another word, it identicates a undo/redo step. With this framework, client developer just "plugs" it into existing project, and the project has the unlimited times (only in possible case) undo/redo feature. I think it's nice.

This program is implemented by Java reflection and AspectJ. To get better performance, I didn't store whole object trees snap shot in memory or disk. It definitely will construct a heavy overhead. And it is more obvious if unlimited times undo/redo is needed. So Memento pattern is not used either.

Shortly, the strategy to achieve the requirement are:
-AOP aspect acts as undo/redo observer, it capture any attempt of changing an object(mainly fields changing)
-Save the changing field old value into some structrue, e.g. hashtable , reflection used here.Save the method objects, owner object and arguments, which lead to an object change within a single command in certain order, reflection used as well.
-Undo - get the right command from command manager, restore the old values of changed fields.
-Redo - get the right command and execute all methods stored in command.methodlist again.

Object references, Collections and navigation between associated classes like composition, aggregation are some points I paied attention. Especially the last one, I found a bug about it during redo, and fixing it cost me one day! (Not all the time :) )
More testing is needed on this framework.

Dust found on my Nikon D70 CCD!!

3 dots found in some pictures, they are in same postion.

I blowed CCD, but made no sense.
Fortunately, it is not so serious. Those dust-dots only can be noticed in pictures with F> F16. And 'cause generally pictures has relative complex background, so those dots is hardly noticed.

2005-04-04

some words on my camera

I have to say, Nikon D70 is a really good camera. Gradually I am getting familiar with it. I like it. I bought a tripod for it 2 days ago in MediaMarkt. Some forum help me a lot on taking picture. This weekend the weather is really good. My girlfriend and I went out to take a walk around the little lake, and I took some pictures. See below, I hope the picture link works. I took these two pictures with CPL in sRGB III color mode. In fact I didn't do much processing with them using image processing tool, typically photoshop. I think the camera is quite ok.

Picture1

Picture2

My thesis

I am working on the first stage. Getting some knowledge about MDA, Octopus and OCL, a good complementary of UML. I have known AOP, but based on Spring implementation. My thesis needs some implementation with AspectJ. In Spring there is no "particular complier" for aspects, since it uses Proxy mechanism. For AspectJ, after coding aspects, all java files and aspects must be compiled again by a "aspectJ complier". And some good Eclipse Plugins are available. I picked the most famous one "AJDT". It took me a lot of time to let them work properly. Why? the installation is easy, but after I create an Aspect project, when I coding, no matter .aj or .java file, the auto-complete functionality has gone. I have to exactly remember the fields and methods of each object. :( Finally I download a milestone version, and it works. (at the beginning the version I downloaded is release version) However, it only works on java file, in aspect, there is no auto-complete as well.

Now I am implementing a AOP based Undo/ Redo framework, some related design patterns were used ( mainly Memento, Marker interface and Command). Collection clone is a problem. I plan to solve it using Memento pattern. Which means I will store a lot of (maybe not too much) objects' copy in memory. I don't know if this overhead is significant. But I have not thought out other solution on that yet.

The implementation is supposed to be finished in 3 days.