Play Ball!

   

Articles Index


Imagine you're a Major League pitching coach, briefing your pitcher before he takes the mound. The Yankees' Alfonso Soriano is up to bat next. Your laptop screen displays exactly what you need to tell your pitcher: "Soriano swings at curve balls that are below his knees and outside 62 percent of the time when he's behind the count, and he only hits .033 when he does."

That's how two teams (the NY Mets and Oakland As) played the game this season, and many more will do so next season.

" Tendu gives professional ball players and their coaches the opportunity to instantly explore a very rich game database through a very simple user interface," says Ron Antinoja, Tendu's president and application architect. "We offer the most complex pitching database available to Major League teams."

What would it take to develop something like this? Less than you might think: an application architect, a developer, Swing components, a flat-file database, a homegrown app server, an Apache web server, and the Java Runtime Environment. And on the data-collection end: A half-dozen former minor and collegiate players with TiVo systems to enter every event from every Major League game into the application's data-collection interface.

With just these resources, Tendu is one of the few stats providers to focus on both "scoring" the game (recording at-bats and plays) and recording several variables on each pitch. "We have pitch type, speed, movement, and location for roughly 80 percent of the Major League pitches over the last two years," he says. "We also record what happens after the pitch, what the hitter does, where the ball goes when he hits it, what the runners are doing, and how the ball was fielded."

The value of collecting both pitching and scoring data is that it allows teams to study tendencies in the context of a game, to see what actually happens as a result of each event. This little system of Java applets and applications could radically change the outcome of Major League Baseball next season.

Safe and in Scoring Position

"When we first looked at the application design for Tendu, we had chosen Java technology as the platform, and we were looking at a traditional browser-based dynamic HTML arrangement," says David King, Tendu's CTO and sole developer. "We realized that because much of the game data is entered in real time during a game, 'click and wait' wasn't the way to go for this type of application. I can't imagine trying to score a live baseball game over the Internet. It just isn't fast enough."

After some research, programmer King and architect Antinoja decided that a downloadable applet/application combination was their best option. "When a user first downloads the applets to reside permanently on their machine and be accessed as applications from a desktop icon, they download and install them from a menu," says Antinoja. "After that, every time they log in, our software checks to see if their version is obsolete; if it is, InstallShield automatically downloads a new version for them."

"Even the initial install doesn't take long to download, and there it is on the client, with or without a connection," says Antinoja. "That means you can enter data on a laptop at a game and work with it later when you have a connection. It provides a lot of flexibility for additional Tendu markets, such as non-televised minor-league games."

Most Valuable Rookie

Fulfilling Antinoja's architectural vision, King wrote all six applet/applications himself as his first Java technology coding project. "I was a C++ developer for many years, so Java coding was easy to learn." King says, "We chose to build most of the system from scratch. We wrote the database as a set of flat files, and we wrote our own application server."

Why? "In our experience, application servers end up imposing unnecessary restrictions down the line," says Antinoja. "Our application would probably be 5-10 times larger in footprint and a good deal slower using one of the popular application servers. I also find the restrictions imposed by them to be unacceptable. When you use a tool to reduce the complexity of building and running applications, you give up other things. We weren't willing to do that with Tendu. Instead, we just built our applications from scratch and let the user requirements, rather than the limitations of the tool, drive the development. We had complete control, and the result is much better."

Anitoja admits that not everybody would want to take that path. "I have the advantage of a developer who probably builds applications faster without those support tools." And he cites an additional luxury: "There are a lot of revision and communications advantages to having just one architect and one developer. It's very efficient and reduces mistakes."

Developer King, however, will admit that one API in particular saved a lot of time and trouble.

Swing Made a Big Hit

King chose Java Swing components to develop the user and data-entry interfaces. "Swing is by far the best API I've ever used to develop a graphical interface," says King. "Rendering in Swing works incredibly well. Our constant screen repainting is seamless to the user. This would have been a much harder set of applications to write if the rendering speed wasn't as fast."

He explains that instead of having pop-up windows for various error conditions, which would slow data entry, he was able to use the rendering components of Swing to display colors on the graphical screen: "If data is entered in the wrong field or the application's consistency checker finds an error, we use a yellow color field to warn the user."

Distribute the Processing Burden

King's advice for designing similar types of applications is to give a lot of consideration to where your processing power has to be. The Tendu code is running in Sun's Java 2 Runtime Environment, Standard Edition (JRE) 1.3.1, with an upgrade expected in the near future.

"Our app server provides the database, but the interfaces and a lot of the number crunching all reside on the client-side Java applet/applications," says King. "For us, that means all of our downloaded applications get their computing power from the end users' computers. So we don't have any major CPU bottlenecks. If you can distribute that power to your client applications, it works out nicely. Our strategy was to make our server as thin as possible, and it seems to have been the best solution for us."

King notes, "Today, our server and database run on a Sun Solaris machine, I develop on a Linux machine, and our applications run on a variety of Windows machines. And it all works well for us."

How Does Tendu Give Major League Teams a Competitive Advantage?

Sure, Ron Antinoja, Tendu's president and application architect, and his only developer, Dave King, have created a unique system with a minimalist approach to architecture and coding. But how do they play the game of delivering Java-based technology value to a staunchly traditional business that still won't even allow aluminum bats? How to collect information players can act on, delivered in the simplest possible format?

It can be incredibly complex to analyze -- for example -- the tendency of a given pitcher to throw a curve ball in a certain speed range to a certain area of the strike zone in a given game situation. But Tendu can do it.

"If you like, you can analyze tendencies in the context of what the ball/strike count is, what pitch was thrown last, if there are runners on base in scoring position, what the inning is, and what the score is. Or dozens of other factors. It all depends on your needs."

One of the tricks is to offer "pattern matching" as a query technique. The user can look for high-probability events in any given scenario: What is the probability that Josh Beckett of the Florida Marlins will throw a high-and-inside fast ball on a 3 and 2 count in the third inning? Tendu knows the answer.

Accurate Data Capture

First, Antinoja's crew of live transcribers -- most of them players themselves -- sit in front of TiVo digital video recorders connected to satellite feeds and meticulously record every event in a game into the application's database. They play and replay every at-bat and event in a game, frame-by-frame, until they've captured all of the relevant data.

"This is way too much fun to be a job," says Bryan Dormaier, one of Tendu's game recorders.

Two aspects of the Tendu software system give it the edge over other systems in use: its data collection interface and analysis user interface.

Data Collection Flexibility Is Key

Even with all of its interface pizzazz and probabilistic capabilities, the slickest part of the Tendu system is its data-collection interface.

Recording the often-subtle, high-speed events that occur in a baseball game can be a tedious experience -- even with a TiVo system. "There are probably 3000 places to make a mistake scoring a baseball game, and these statistics have to be highly accurate," says Antinoja. Previous baseball data collection interfaces have generally fallen short of being able to capture the incredibly diverse number of events that can happen in a game. "Baseball is a never-ending source of strange plays," he says. If the data collection interface requires you to enter the data in a certain order, or switch screens frequently during play, or causes you to lose data to correct mistakes, forget it -- "you're outta there."

The Tendu data collection interface is a Java applet that resides on laptops used by the game transcribers and can be run online or offline. It's a densely packed screen of fields that accepts data in any order, and allows for quick revisions without losing other data or switching screens. If you're entering data in real time live at a game and you miss a pitch or a hit, or you can't complete a batter's sequence before the next batter is up, you just move on and add it later. The system will take what you have and warn you that certain data is missing or inconsistent.

"The interface has an enormous number of baseball-specific consistency checks that are constantly going on as you enter data," explains Antinoja. "The interface is quick to warn you with a Swing-rendered yellow color in the data field when you enter data that doesn't fit the rules of the game, or move to the next step without entering needed data. But it doesn't slow you down with pop-up screens or required corrections. You can move on and come back to correct it later. Just look for the yellow fields."

Antinoja adds, "The data collection interface is the part of the application that we worked the hardest to perfect. It's amazingly flexible, and it's different than anything else I'm aware of." He invested the majority of his development resources into this area of the application because he wanted it to be used by a wide range of users -- for example, team assistants in minor league and college baseball, in real time at games, without the advantage of TiVo devices.

Take It to the Users: Hide the Complexity

The second key advantage of the Tendu system is the user interface. Tendu's graphical, easy-to-navigate user interface is what makes the database so powerful for users. "Other systems offer a query interface to the basic statistics, which is something Tendu plans for next year," says Antinoja. "The query interface allows users to construct their own queries to answer a question about the data. Instead, what Tendu built first is an exploratory interface, which allows a user to answer questions by roaming in the database, but without requiring query construction skills -- just baseball knowledge, and the ability to point and click." The beauty of the interface is that players and coaches can really make it perform to their required level of detail without much sophistication, or even much training.

The user interface is a rich graphic of point-and-click options, labeled strictly in baseball language. "Most players can use it after about five minutes of instruction," says Antinoja.

Antinoja describes an extreme example: "One of our users is a coach who doesn't speak Spanish, and has very limited communication with his Spanish-only pitcher. But he can point to the strike-zone graphic on the screen and prepare the pitcher for specific batters before a game: "Rojo (red), no pitch. Verde (green), pitch."

The showdown between the Florida Marlins and the New York Yankees is over for this season. But when spring training arrives, Tendu intends to toss a new level of insight-driven competitive unpredictability into the game.

Additional Resources

Tendu, Inc: A Software Product for Coaches, Players, and Fans
http://tendu.net/

TiVo, Inc: TiVo Service and Digital Video Recorders
http://www.tivo.com/1.0.asp