Strategy, Template, and Bridge
Uncle Bob plays with my favorite patterns
I know you're not supposed to have a favorite design pattern or else you're likely to go in search of nails to pound with it. That being said, my favorite of the Gang of Four patterns is the Template Method. It is certainly my favorite in an introductory class because students see the power of polymorphism and the point of inheritance.
In the latest installment of Robert C. Martin's "Principles, Patterns, and Practices" column, Uncle Bob looks at The Strategy, Template Method, and Bridge Patterns. Students often have difficulty choosing which pattern to apply when more than one would solve the problem. This article shows problems that could be solved with either Template or Strategy and shows how you can see that choosing the less appropriate one would unnecessarilly complicate your design.
in Java Today , threading is much improved in J2SE 5.0, with the old
notify() augmented with a whole new package of tools for coordinating threads. In Advanced Synchronization in Java Threads, Part 1, an excerpt from Java Threads, 3rd Edition, Scott Oaks and Henry Wong introduce the Semaphore, Barrier, Countdown Latch, Exchanger, and ReaderWriterLock classes introduced by the new java.util.concurrent package.
Here's a light piece for a Friday - the Blog Glossary. No Tiger, no look at the latest APIs, just some definitions from the world of blogging like Anti-idiotarian, Blogorrhea, Blogstipation, and Hitnosis.
In Projects and
Communities , the Java Device Open System (JDOS) project, part of the JDDAC targets a 12cm x 12cm miniature motherboard and Gentoo Linux to fit a lot of J2SE 5.0 in a very small space.
What about a javac -source 1.6 -target 1.5 [or 1.4 or 1.3] in Mustang? In today's Forums Jodeleit writes "It would be cool if Mustang / 1.6 / 6.0 would use @Since(major=1,minor=6,micro=0) for classes / packages / methods instead of the "out of fashion" javaDoc tag. Combined with package annotations for the jar [@jar("rt.jar")] errors could be generated like: Error: target is 1.5 - usage of "java.lang.String.coolMustangFeature()" is not allowed.."
MGrev complains that "Conditionally adding items to a JComboBox is unnecessarily verbose. Today one need to iterate over the items to do this or cast the model to a DefaultComboBoxModel which isn't intuitional unless you read the API source code.I suggest adding some or all of these convenience methods[..] addUniqeItem(Object item), setSelectItem(Object item, addIfNotExist), containsItem(Object item)."
MThorton adds to the primitives and generics discussion saying "It was certainly considered. I made a proposal that would allow primitives as type arguments during the first public review. The biggest problem wasn't technical, but rather the political problem of reopening the debate about whether primitives should exist at all (i.e. continue to have special status relative to regular objects). "
In today's java.net
- Early Draft Review: JSR 182 - JPay Payment API
- Apache Turbine 2.3.1
- JavaPolis Conference Registration Starts
- Windward Reports 3.0
- JFtp 1.44
- SwingSet 0.9.0-beta
- Industry Process Accelerator for Business Intelligence (IPA4BI) Initial Release
Registered users can submit news items for the
href="http://today.java.net/today/news/">java.net News Page
using our news
submission form. All submissions go through an editorial
review before being posted to the site. You can also subscribe to
News RSS feed.
Current and upcoming
- October 24-28, 2004
- October 27, 2004
href="http://www.jini.org/webinar/index.html">Jini Community Webinar
- October 30, 2004 JaMU - JUG
Indonesia:Compiere and Jasper
- October 30, 2004 JUG Sardegna meeting
Registered users can submit event listings for the
href="http://www.java.net/events">java.net Events Page using our
href="http://today.java.net/cs/user/create/e"> events submission
form. All submissions go through an editorial review before being
posted to the site.
Archives and Subscriptions: This blog is delivered
weekdays as the
Today RSS feed. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.
Uncle Bob plays with my favorite patterns