Lambda the Ultimate

inactiveTopic Memoization in Java Using Dynamic Proxy Classes
started 8/21/2003; 5:43:11 PM - last post 8/22/2003; 11:13:42 AM
Chris Rathman - Memoization in Java Using Dynamic Proxy Classes  blueArrow
8/21/2003; 5:43:11 PM (reads: 1918, responses: 4)
Memoization in Java Using Dynamic Proxy Classes
Memoization has been touched on number of times on LtU, but rarely in connection with Java.

Memoization is a technique borrowed from functional programming languages like Lisp, Python, and Perl for giving functions a memory of previously computed values. Memoizing a function adds a transparent caching wrapper to the function, so that function values that have already been calculated are returned from a cache rather than being recomputed each time.

Version 1.3 of the Java™ 2 SDK, Standard Edition, introduced support for dynamic proxy classes: special classes that can choose which interfaces they implement when created at runtime... By using this feature, it is possible to write a generic caching wrapper class, called Memoizer, that determines at runtime which interface it implements.

Can't say that I liked the method chosen for dynamic proxies in Java. A bit too long winded and cumbersome for my taste. Good to see that someone is trying to put them to use for something.
Posted to OOP by Chris Rathman on 8/21/03; 5:44:51 PM

Ehud Lamm - Re: Memoization in Java Using Dynamic Proxy Classes  blueArrow
8/22/2003; 4:41:29 AM (reads: 728, responses: 0)
Memoization is a technique borrowed from functional programming languages like Lisp, Python, and Perl...

Curious choice, as examples of functional languages, wouldn't you say?

Chris Rathman - Re: Memoization in Java Using Dynamic Proxy Classes  blueArrow
8/22/2003; 7:14:12 AM (reads: 710, responses: 1)
Well, lisp is always thrown into a list whenever you mention some language paradigm. Something along the lines of - object oriented programming languages like Lisp, C++ and Java - or was that AI languages like Lisp and Prolog. :-)

Python and Perl have a lot of tweakers and experimenters, so the first exposure many people have to functional programming styles is through one of these two languages.

Bart van der Werf (Bluelive) - Re: Memoization in Java Using Dynamic Proxy Classes  blueArrow
8/22/2003; 11:13:42 AM (reads: 677, responses: 0)
I liked the idea until i realised that normally stateless calculating methods are static in java.

Toobad about the syntax, these reflection things can make java alot more dynamic.

Ehud Lamm - Re: Memoization in Java Using Dynamic Proxy Classes  blueArrow
8/22/2003; 1:59:09 PM (reads: 686, responses: 0)
I wasn't really concerned about language features per se, but rather on programmers perceptions.

If Perl and Python are functional, we really should stop worrying about functional languages becoming mainstream...