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="http://today.java.net/pub/a/today/2004/10/22/obfuscation.html">
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
gone."


In today's Weblogs,
Bob Lee points to a Russell Miles article on href="http://weblogs.java.net/blog/crazybob/archive/2004/10/onjavacom_an_in.html">
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="http://www.newyorker.com/printable/?fact/020722fa_fact">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="http://webservices.xml.com/">webservices.xml.com, Marc
Hedlund offers an introduction to href="http://www.oreillynet.com/pub/a/network/2004/09/28/bloglines.html">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="http://groovy.codehaus.org/">Groovy code.


In Projects and
Communities
, the href="http://wiki.java.net/bin/view/Javapedia/WebHome">JavaPedia
entry on href="http://wiki.java.net/bin/view/Javapedia/StringBuffer">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
Enterprise
community's href="https://verge.dev.java.net/">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."


href="http://forums.java.net/jive/thread.jspa?messageID=3729&tstart=0#3729">
Are Math functions called on the wrong object? In today's href="http://forums.java.net/jive/index.jspa"> 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="http://forums.java.net/jive/thread.jspa?messageID=3617&tstart=0#3617">
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
supertype."


In today's java.net
News Headlines
:

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
the href="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net
News RSS feed.


Current and upcoming
Java Events
:

  • October 19-22, 2004 href="http://www.educause.edu/conference/annual/2004/"> Educause
    2004
  • October 22-24, 2004 href="http://www.nofluffjuststuff.com/2004-10-boston/index.jsp"> New
    England Software Symposium: Fall Edition
  • October 23, 2004 href="https://hkjug.dev.java.net/servlets/NewsItemView?newsItemID=1351">Hong
    Kong Java User Group: Maven
  • October 24-28, 2004 href="http://www.oopsla.org/2004/ShowPage.do?id=Home">OOPSLA
    2004
  • October 25, 2004 href="http://www.vircon.com/events/javabythebay.html">Java By the Bay
    JUG
  • October 26, 2004 href="http://java.sun.com/developer/ChatClient.jsp"> Project Looking
    Glass online chat
  • 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
Java
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.

Playing Texas Hold-em with your code