Skip to main content

Dealing two cards down

Posted by daniel on October 22, 2004 at 8:39 AM PDT

Playing Texas Hold-em with your code

Kimmy-the-wonderwife loves to watch celebrity poker on cable. Each
player gets two cards dealt face down. Then after some betting three
cards are dealt face up in the middle of the table. More betting,
another card up, more betting, one more card up, and finally more
betting. Each player's final hand consists of the best hand that can
be built from their two cards and any three of the five face up cards.

What makes the game interesting to play and watch is how much
information is presented out in the open. But which of the five face
up cards will other players use? What are their face down cards? It
turns out that much of the information communicated is through the
betting. Better players are aware of how to mislead the other players
into coming to false conclusions based on the combination of betting
and the exposed cards.

Don't ask me why I make these connections - but I was thinking
about poker in connection with Paul Tyma's article href="">
The New Obfuscation. You don't just map one method name to the
same name all of the time in a one to one mapping. It would be like
betting transparently in the poker game. Consider this example from
the article of mapping method names to other names.

public long getPayroll(int x) {  }    →    abc
public long getPayroll() { }          →    xyz
public long saveState(int x) {  }     →    xyz
public long getDate() { }             →    abc

This is a clever example because "The interesting point is that where
getPayroll had two overloaded versions, those methods
are now renamed to different names. That is, the original
overloading relationship is gone. Also, methods that were
previously unrelated now have overloading relationships. Assuming
that method overloading is a tool that conveys information (i.e.
the two original getPayroll methods were different
implementations of the same task), that information is now

In today's Weblogs,
Bob Lee points to a Russell Miles article on href="">
Porting the Cuckoo's Egg. "The CuckoosEgg interceptor routes
method invocations to alternative implementations in his
ReplacementFeature class."

In Also
in Java Today
, Malcolm Gladwell, author of the Tipping
Point, writes in the New Yorker about href="">The
Talent Myth: Are Smart People Overrated? He quotes Enron's
policy, "We hire very smart people and we pay them more than they
think they are worth." They followed the McKinsey recommendation of
"sorting employees into A, B, and C groups. The A's must be
challenged and disproportionately rewarded. The B's need to be
encouraged an affirmed. The C's need to shape up or be shipped out."
Gladwell writes that you need to measure potential and not talent,
intelligence, and performance.

In a feature article from href="">, Marc
Hedlund offers an introduction to href="">The
New Bloglines Web Services. By offering a web services API, he
writes, Blogilines makes it "very easy for developers to use RSS and
Atom content for many purposes, and the services will also ease the
traffic pileup that aggregators are beginning to cause for many
large RSS/Atom publishers." He also shows off the power of the API
by developing a Swing feed-reader with just 150 lines of href="">Groovy code.

In Projects and
, the href="">JavaPedia
entry on href="">StringBuffer
has been updated to include a link to the new Tiger class
StringBuilder which "is designed for use as a drop-in replacement
for StringBuffer in places where the string buffer was being used by
a single thread"

The Java
community's href="">Verge project "is a suite of
tools that help developers build J2EE applications by providing a
variety of tools and frameworks that developers can use to minimize
the up-front overhead of creating those frameworks themselves."

Are Math functions called on the wrong object? In today's href=""> Forums,
Kcpeppe writes "angle.sin() makes much more symantic sense than
Math.sin( angle) because.. that is what you are doing, asking an angle
for it's sin. In the other case, you are asking a third party to
evaluate sin. Much less polymorphic and relies more on overloading. "

Here's a href="">
Completely wild starter: type safe subtypes of primitives using
erasure from Bruce Chapman. He begins with the suggestion that we
"Add support in the language for type safe sub types of primitives,
these erase at compile time (after type checking) to their primitive

In today's
News Headlines

Registered users can submit news items for the href=""> 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
the href="">
News RSS feed.

Current and upcoming
Java Events

  • October 19-22, 2004 href=""> Educause
  • October 22-24, 2004 href=""> New
    England Software Symposium: Fall Edition
  • October 23, 2004 href="">Hong
    Kong Java User Group: Maven
  • October 24-28, 2004 href="">OOPSLA
  • October 25, 2004 href="">Java By the Bay
  • October 26, 2004 href=""> Project Looking
    Glass online chat
  • October 27, 2004 href="">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=""> Events Page using our href=""> 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 it will be
archived along with other past issues in the href=""> Archive.

Playing Texas Hold-em with your code