Daniel Pitts’ Tech Blog

Archive for the ‘Random Thoughts’ Category

Baby.java

Thursday, February 4th, 2010

I’ve been spending more time taking care of my little girl lately, and I was thinking “this isn’t anything like programming.” I realized that it kind of is, just no one has written the JavaDocs so that programmers like me can understand it clearly.

So, I’ve taken it upon myself. Here you go.

// Baby.java
// Copyright(C) 2010, Daniel Pitts, All Rights Reserved.
import java.util.Collection;

/**
 * A Baby. A small child which acts similar to an adult, but has some
 * differences which may be surprising. Any method can throw TantrumException
 * at any time for no decernable reason. All methods are abstract, because
 * every baby is different.
 * <p>
 * Baby's aren't collected by the standard JVM Garbage collector, but
 * instead may be collected by Child Protection Services (CPS for short) if
 * not properly handled.
 */
public abstract class Baby {
    /**
     * Attempt to put baby down for a nap.  You may need to call any of the
     * following methods before this method will succeed.
     * <ul>
     *   <li>{@link Baby#recieve(Bottle)}
     *   <li>{@link Baby#change(Diaper)}
     *   <li>{@link Baby#feed(Meal)}
     *   <li>{@link Baby#change(Diaper)}
     *   <li>{@link Baby#giveAffection(java.util.Collection)}
     *   <li>{@link Baby#playWithToys(java.util.Collection)}
     * </ul>
     * @throws InterruptedException randomly
     * @throws TantrumException when the mood strikes
     * @throws IllegalStateException if the child doesn't want to sleep for
     * some reason or another.
     */
    public abstract void sleep() throws InterruptedException, TantrumException;

    /**
     * Attempt to give the baby a bottle.  Once the baby is done with the
     * bottle, the bottle may be returned or thrown.  This may happen
     * immediately, or after the bottle has been emptied.
     *
     * @param bottle a bottle of formula or milk.
     * @throws TantrumException when the mood strikes.
     * @throws Bottle the bottle, if the baby *really* doesn't want the bottle.
     * @return the bottle.
     */
    public abstract Bottle recieve(Bottle bottle)
            throws TantrumException, Bottle;

    /**
     * Attempt to change the baby's diaper.
     * @param diaper the new, clean diaper.  An attempt to use a dirty
     * diaper will result in a JVM error, and CPS will come by shortly to
     * remove the Baby from your care.
     * @return a dirty diaper. This diaper should be disposed of as soon
     * as possible.
     * @throws TantrumException when the mood strikes.
     * @throws PoopyDiaper if the parent doesn't remove the diaper quickly
     * enough.
     */
    public abstract Diaper change(Diaper diaper) throws TantrumException,
            PoopyDiaper;

    /**
     * Gives a snack to the baby.  May help prevent TantrumExceptions from
     * being thrown for some time.
     * @param snack something delicious and healthful.
     * @throws TantrumException if snack is null, or the wrong kind for the
     * moment.
     */
    public abstract void feed(Snack snack) throws TantrumException;

    /**
     * Gives a prepared meal to the baby.  May help prevent TantrumExceptions
     * from being thrown for some time, also prevents the baby object from
     * being reclaimed by CPS.  Must be called at least three times a day.
     * @param meal something nutricious and yummy.
     * @throws TantrumException at whim.
     * @return a mess which needs to be cleaned up. Older babies may return
     * null more frequently, but don't count on it.
     */
    public abstract Mess feed(Meal meal) throws TantrumException;

    /**
     * This method is very important to call, many times per day.  Remember,
     * the more love you pass in, the more you get back. The love can be Hugs,
     * Kisses, and Talking.
     * @throws TantrumException usually happens only when any of the
     * playWith methods are executing concurrently.
     * @return some love, often more than you give.
     */
    public abstract Collection giveAffection(Collection love)
            throws TantrumException;

    /**
     * Reads a story the baby. This is often a prerequisite for
     * {@link Baby#sleep()}.
     * @param story the story.
     * @throws TantrumException if the story is the babies favorite at the
     * moment, or if the baby realizes that bed-time comes after the story.
     */
    public abstract void read(Story story) throws TantrumException;

    /**
     * This method will be executed on its own from time-to-time.  Not all
     * objects passed in are actually toys, and may cause all kinds of
     * exceptions.  A strong attempt should be made to intercept all calls to
     * this method and filter out non-toys, or otherwise dangerous objects.
     * @param something something the baby thinks is a toy.
     * @throws TantrumException randomly, or sometimes if some object is
     * filtered.
     */
    public abstract void playWith(Object something) throws TantrumException;

    /**
     * Give the child a toy to play with.
     * @param toys something fun to play with.
     * @throws TantrumException once the child is tired of the toy, or if it
     * isn't the toy they wanted.
     */
    public abstract void playWithToys(Collection toys)
            throws TantrumException;

    /**
     * Have this baby play with another group of babies.
     * @param babies a group of babies to play with.
     * @throws TantrumException for many reasons.  Sometimes babies will take
     * toys from other babies, which often causes a TantrumException.
     */
    public abstract void playWithBabies(Collection<Baby> babies)
            throws TantrumException;

    /**
     * Bathe the baby.  Keeps the baby clean and happy. If you go too long
     * without calling this method, CPS will collect the baby.
     * @param bath a warm bath which should have some toys in it.
     * @throws TantrumException whenever.
     */
    public abstract void bathe(Bath bath) throws TantrumException;
}

AT-Robots.

Sunday, December 13th, 2009

Does anyone play AT-Robots any more? Someone mentioned it last year on my guestbook. I apparently don’t check the guestbook often enough ;-)

If there is still interest in AT-Robots, I might consider starting work on my clone again. Heck, I might do that anyway, but its much more likely if other people are interested.

Please leave a comment here if you are interested.  Also, if you’d like me to reopen my forums, let me know.

Where is my Ultimate Portable Computer?

Wednesday, September 9th, 2009

It seems to me that the technology is here, or at least almost here, and all it would take is one company to put all the pieces together.  I have idea of where to get many of these, but due to time and budget constraints, I haven’t been able to start on this.

  • Miniature computer. Maybe gumstix Overo Fire based computer running Linux.
  • Wifi and/or Cellular internet connectivity.  (The Overo Fire supports WiFi and Bluetooth)
  • Glove based input devices (virtual keyboard and pointer/mouse).
  • Video glasses/HUD. Myvu, eMagin, or preferably Lumus glasses.
  • Solar cells to augment battery life.

The bare minimum is the core computer with wifi.  Overo supports an LCD touch-sensitive screen, so you can get input/output through that.

The glove based keyboard is the next important feature. I have yet to see anything on the radar for this type of device.  A pointer device is less important, but would be useful.  It would have to be part of the glove system to be useful.  Oh, and the gloves would have to be rain-proof (water resistant).

The next that I would need is the video glasses. The Lumus glasses look promising, as they allow basically an overlay, rather than off-to-the-side or block-your-vision display.  Unfortunately, they won’t be available to consumers directly from lumus, so we’ll have to rely on vendors.

Finally, the Solar power would enable longer (perhaps unlimited) up-time.  A back-pack made with flexible solar fabric may be the best solution, giving you both the power boost, and an accessory to store additional physical material (real-paper books, lunch, etc…)

This feels real close to me.  If someone had been focusing on this vision, I believe it would have been done by now ;-) .  This is the sort of thing shown in science fiction, but it is actually possible in the next few years.