Search   Feed   Browse   Add
Feed items 1 - 6 of 6 for October 2007

Immutable objects in Java - October 31, 2007

I just read a clever post from JP Moresmau on a functional language he is writing which translates to Java. One idea which lept out at me was how to provide setters to immutable objects in Java: the setters are instance factory methods, thus: class DontTreadOnMe public final String species; public final int length; DontTreadOnMe(String species, int length) this.species = species; this.length = length; Snakes can grow but cannot change species ...
http://binkley.blogspot.com/2007/10/immutable-objects-in-java.html

Java enum state machines - October 30, 2007

A clever article from Berin Loritsch on using Java enums for finite state machines. Clever hackery with enums is a fascination of mine. UPDATE: And a well-reasoned counter opinion.
http://binkley.blogspot.com/2007/07/java-enum-state-machines.html

Brilliant article on Phythorean Theorem - October 29, 2007

This popped up on DZone — Surprising Uses of the Pythagorean Theorem. Keep this in your backpocket.
http://binkley.blogspot.com/2007/10/brilliant-article-on-phythorean-theorem.html

Hamcrest matchers - October 27, 2007

I missed this post from Joe Walnes a while ago on using Hamcrest matchers for more than testing. I appreciate their DSL-like quality and clever mixture of literate class names, static factory methods and Java generics. In his post Joe Walnes references Hkan Rberg's nice idea for filtering collections with Hamcrest matchers, but unfortunately that post links to no code, usage examples. select and reject are trivial to code: public static <T> List<T> select( final...
http://binkley.blogspot.com/2007/10/hamcrest-matchers.html

Java data validation trick with bit-twiddling - October 11, 2007

I have a specialized value object with the property that fields can be null but only in a particular order: class Data private final String field1; private final String field2; private final String field3; public Data(String field1, String field2, String field3) if (!valid(field1, field2, field3)) throw new IllegalArgumentException(); this.field1 = field1; this.field2 = field2; this.field3 = field3; ... The..
http://binkley.blogspot.com/2007/10/java-data-validation-trick-with-bit.html

Dethreading a chicken - October 10, 2007

Anyone who has tried knows what messy task deboning a chicken is (unless you are Morou Ouattara.) Likewise I face the messy task of protecting multi-threaded legacy code from itself. I face a complex graph with an elaborate API. It is thread-safe in that individual nodes are locked, but it is not thread-consistent: changes traversing the graph are not isolated from each other. What to do One approach which is of general application is to dethread the data structure. That is, turn it from...
http://binkley.blogspot.com/2007/10/dethreading-chicken.html
Available Archives
- May (1 item)
- June (3 items)
- July (1 item)
- August (3 items)
- September (1 item)
- October (6 items)
- November (5 items)
Sponsored Links
© 2008 FeedCapsule.com  |  Contact