All posts by niv

Going in to 2014

Man, I forgot about this place. No time for apologies, let’s get into it.

It is February 19, 2014. There is a high likelihood of a lot of new users coming to ottoneu in the next month before the season starts, but let’s look at where things are now, shall we?

  1. 1917 active teams.
  2. 25 active prize leagues and 123 active non-prize leagues.
  3. 401,293 player transactions, spending $538,395 in ottoneu cap.

I’m going to throw a parade when we get over $1mil in cap spent. There are a few other important things to note, especially in regards to the now woefully outdated first 30 days post. My users remain incredibly patient and smart and understanding. The number of “shit is broken” emails have decreased to a trickle – ottoneu has become a relatively stable (KNOCK ON WOOD) platform! Even the auction drafts are performing smoothly, to the point where most of the emails about them are for really interesting feature enhancements, not “man this was slow, give me some money back.”

So, that is the basic state of things today. Now, what are the big things on the horizon? Well, there are 3 big initiatives this year, each worthy of its own series of posts:

  1. Rewriting the stats backend – after determining that a soft innings cap (and thus allowing pitcher streaming on the last day of the season) was a double-edged sword for owners and self-balancing, there is a massive opportunity for performance improvements and general efficiency with ottoneu’s stats backend. This project is ongoing and should be wrapping up in the next couple of weeks. It should be completely transparent to users, and it has to get done before the season starts. So, that’s priority #1.
  2. A better lineup page experience – the lineups page is fine, it gets the job done. But during the long baseball season, this is where a lot of time is spent. It also is the basis for the off-season roster organizer. More stats, splits, and a smoother experience swapping players in and out will go a long way towards making ottoneu feel world-class.
  3. A full redesign – while I may have sentimental attachment to the Waste Management colors and my crazy-good (read: not) logo, I think ottoneu can look significantly better. This project is actually really close to being done, but probably won’t be released until the All-Star break, just to tighten everything up and not get in the way of the top two priorities. The new logo looks boss.

That is where things stand going into this season. I plan on keeping a loose development blog here, so feel free to comment here, tweet at me, hit me up on Facebook, or just plain email me (help at ottoneu dot com). I cannot wait for baseball. Good luck this season!

Raising Money

Sorry about the recent lack of posts.  Things always get quiet towards the end of the year, and I have been traveling and coding and coding and traveling non-stop the last few weeks.  Hopefully Geoff and I will get things going again as baseball season nears.

A few days ago, my friend Zach and I had a discussion over email about raising funding for internet startups.  The conversation was spurred by this article from the Economist, discussing a possible pending tech bubble.  Zach argued that the bubble was clear to him when someone, somewhere decided that the reported $6 billion bid on Groupon by Google was not enough money and called the deal off.  My counter point or more accurately put continuation of the conversation is below, slightly edited.

[T]o me the ‘bubble’ aspect is that a lot of pointless things (as the economist points out) are getting funded.  Like, pointless things.  gimmicky neat tech demos are getting funded.  And to me that is the main point of irrationality.

[It] sounds like irrationality is closing in on two fronts though.  one on the “spray and pray” front where angels will fund idiotic ideas, and another on the high end where companies are being overvalued.  the former seems more pervasive, and the latter seems bubble-y.

Part of this has to do with comfort.  Stupid-to-less-than-stupid-to-reasonable-but-unproven ideas should all be bootstrapped.  Instead, we have these idiots who are so afraid of eating ramen that they spend all their time and effort on figuring out how to raise money instead of how to build a true business.  The raising money is the goal, because then you can make 80k a year doing your own stupid thing and it’s living the dream.

I interviewed with that Sunfire place again last night.  the woman I spoke with asked me if i wanted to raise money.  I said preferably no, but i could see reasons to.  And i said the only reason I would was if I was not at enough users to pay for itself but enough users that I saw a future in the business.   And she made a reality-based statement that depressed me – it’d be really hard to raise money if I don’t have the numbers I was hoping for – its easy if you get huge amounts of growth, of course.  But I was like – wait, if i have enough users, why would I ever raise money?

And part of that is the thing too.  If you don’t have ANY proof, you’re in a better spot than if you have numbers that aren’t stellar.  And in a way, that is the investor needing comfort too – either the comfort of the irrational kool-aid or the comfort of stellar numbers.  Less than awesome numbers on a launched product that might require (gasp) work was looked at by the woman I was talking to, accurately, as a liability.

So, this is why I don’t want to raise money.  mostly because investors are risk-averse assholes.  And also because I like ramen.

Despite being one of the risk-averse assholes I called out in that email, Zach liked the response, and the more I think about it, the more I like it as well.  I understand the need to raise money even if your startup proves itself spectacularly – growth can always use more capital, etc, etc.  But there is a lot of weirdness in the money-raising world, and until I find some people who see things a bit more in line with how I see things, I don’t see myself actively pursuing funding.

The Solution? More Tables

I don’t know very much about database design.  I tried taking a course once in college but the professor scared me on the first class and I ended up dropping it, which I guess now that I write it out I regret.  What little I do know I have taught myself from both production examples from my previous jobs and just general experience.  That being said, there is one  rule that I’m slowly learning that I feel the need to record.  Whenever there is some sort of complication with storing or retrieving data in a relational database, the solution is always more tables.

Yesterday I was struggling with a problem.  If two teams agree to a trade involving a given set of players, all other trade proposals including those players should no longer be active.  For example, if Albert Pujols is involved in a trade that has been accepted, he shouldn’t be still out there in other trade proposals – we don’t want two or more teams concurrently accepting trades with Albert Pujols!

On its face, this seems like a basic enough problem, but the twist is my existing database schema.  It looks like this:
[cc lang=”mysql”](
ID int(11) NOT NULL auto_increment,
ProposalDate date NOT NULL,
ProposingTeam tinyint(4) NOT NULL,
TargetTeam tinyint(4) NOT NULL,
ProposingTeamPlayers varchar(30) NOT NULL,
TargetTeamPlayers varchar(30) NOT NULL,
ProposingTeamLoan int(11) NOT NULL,
TargetTeamLoan int(11) NOT NULL,
Accepted tinyint(4) NOT NULL default ‘0’,
Rejected tinyint(4) NOT NULL default ‘0’,
PRIMARY KEY (ID)
)[/cc]The problem here is that I’m storing “ProposingTeamPlayers” and “TargetTeamPlayers” as strings. So for each trade, I implode the array of players involved into a comma-delimited list. This is all well and good until you realize you want to search for all trade proposals involving a given player. The process then becomes:

  1. Find all trade proposals involving either team
  2. Get all players involved in said trade proposals
  3. Check if any of the players are involved in the just accepted trade
  4. If yes, then mark that trade proposal as rejected (which, implicitly, it is)

The solution to getting rid of this awful, slow code? Add a new table:[cc lang=”mysql”]TradeProposalID int(11) NOT NULL,
PlayerID int(11) NOT NULL,
TeamID int(11) NOT NULL,
PRIMARY KEY (TradeProposalID,PlayerID)[/cc]Then this query gives us what we want:[cc lang=”php”]$sql = “SELECT ID FROM TradeProposalsIndexTable JOIN TradeProposalsPlayersTable ON ID=TradeProposalID WHERE Accepted=’0′ AND Rejected=’0′ AND PlayerID=$playerID”;[/cc]Mark all those trades as rejected, and all done.

Without adding new tables, I had a mess trying to store multi-player trades in my database, and I had a hacky solution that clearly was not well thought out.  Add a table, remove those ProposingTeamPlayers and TargetTeamPlayers columns, and a multi-line complete mess of a solution turns into 2 elegant lines of SQL.

So we’re left with a simple rule to follow at all times: if you are getting confused by how to get or store data with your relational database, add some more tables.

First Pitch

We are now 4 days back from First Pitch: Arizona.  I can’t speak for Geoff, but for me, the conference was a rousing success.  If you had told me all the positive things that happened in Phoenix were going to happen before going, I would have gladly paid twice.  An overview:

  • Maybe not the father of fantasy baseball, but at least a pretty influential uncle, Ron Shandler is the real deal when talking about one of the game’s great minds.  He presented a new approach to fantasy baseball at the conference, one which is similar to my game in a number of ways.  We met (along with Geoff!) for a hour after he presented his game, and he came away with a very favorable impression of what I’ve been working on.  He even mentioned it as legit to the entire conference.  If that isn’t a strong endorsement, I don’t know what is.
  • Joel Henard at Baseball Prospectus Radio offered to interview me for his show.  Repeat: I was offered an interview.  About a fantasy baseball game.  From the guy who has interviewed real, actual GMs and baseball players.
  • Everyone, without exception, who got a taste of my full pitch was asking me things varied from “sounds awesome” to “when can I sign up?”
  • Joe Sheehan recognized me coming up an elevator and asked if I’d be around later at the Rising Stars baseball game or for poker later on.  Swoon.

The amazing thing about having people, real live people validate what you’re spending hours a day working on – what you’ve left a safe, comfortable job, to work on – is that it makes you forget everything else.  It just makes you want to f’n code the hell out of it.  So, I’ll say it again: let’s go.

Leaping

Much like Geoff, I haven’t checked in over here in far too long.  The last time I posted, I mentioned that I had given notice at my previous job and was going full time on the project that most of you know about already.  So it seems like that is as good a place as any to start.

While Geoff is working on an extreme research project, I am working on almost the opposite: a new consumer-facing fantasy sports service, ottoneu.  In the vein of Yahoo! Fantasy Sports, ottoneu will provide fantasy games for users, but with an emphasis on niche users and in-depth, hardcore games.  Without getting in to the details (and blowing any fun surprises that might be coming down the line), I can safely say a few things.

  1. The fantasy baseball product I am working on is unique and fun
  2. Working for yourself is fun and stressful
  3. It is incredibly rewarding to spend 100% of the day working on something that you are not only interested and invested in, but you truly enjoy

So I have leapt.  I am now the Founder and CEO of ottoneu, Inc.  Soon, I will be bringing you better fantasy sports – richer, more interesting, more engaging, and much, much more fun.  My goal here is to, without ruining any good surprises, take you along on the ride to launch day.

The Implications of Inning Limits

Recently I ran across a problem with my deployed version of ottoneu: there was no programmatic limit for games played or innings pitched for any given fantasy team.

Let me back up.

Fantasy baseball games, in general, have limits around the number of games a team can ‘play’ at any given position.  For example, if there are 162 games in a season, it doesn’t make much sense to allow an owner to manipulate his lineup enough to squeeze 170 games out of a given position.  This might not be possible for all owners, and it doesn’t fit in with the idea of mapping fantasy baseball to real baseball.  If the Yankees can’t go out on their off days and get extra games in with their backups, well, then, neither should your fantasy team that you’ve cleverly named after them.

Most games will run with limits along the lines of 162 games per lineup slot, which includes things like 162 games per OF spot (in our 5OF lineup, we have a 810 game limit at OF) as well as 162 games per special position (middle infielder, corner infielder, utility).  Innings pitched can be a little bit more varied, but we went with the tried and true multiply 162*9 and add a few extra to get to a nice round number, so our limit is 1500IP.

So back to where I started – ottoneu did not have programmatic enforcement in place for when teams went over these limits.  While this isn’t a gigantic problem with 12 owners, once you’re talking a game with leagues on the order of 100, then yes, we have a problem.  I decided to tackle the problem last week, and immediately an interesting question arises: when does the inning limit kick in?  Can you run right up to 1499.2 IP at the end of a day, and start 5 guys the next day and then the limit kicks in at the end?  Should there be a rule put in place that says when you are within some arbitrary distance of the 1500 IP limit at the end of a day, you can’t play any more pitchers?  Or the final option – add up stats until you hit 1500 IP, no matter if it is in the middle of a start or an appearance by a reliever or anything?

I kicked this question around with Geoff for a little bit, and we decided that first off, it made no sense to build any kind of lower buffer.  A 1500 IP limit doesn’t mean “1495-1500”.  We thought about calculating the inning count at the end of every day, but this solution again made a inning limit closer to “1500-1525” instead of the hard 1500IP cap that we wanted.  So that leaves the last option.

The idea of these limits, like I said, is not only to put everyone on equal footing, but also to line up the game against real baseball.  This last option, in which the live scoring script literally stops taking your statistics once you hit 1500IP, is the least connected to real baseball.  If I’m at 1497.0 IP, and Jon Lester going on the last day of the season (I know, it would never happen), there’s a very real possibility that only half of his start will count towards my fantasy statistics.  Cutting off starts in the middle divorces the idea that these player’s days line up perfectly with your team’s day.

We decided to go with this option, but where does that leave ottoneu?  The first line of ottoneu’s constitution is as follows:

The intention of this league is to mimic the job of an actual general manager as closely as possible.

Clearly managing who plays and who doesn’t on a day to day level isn’t on a GM’s plate, but if we our goal is to reflect reality, this solution is actively hurting us.  I don’t have any good answers here – one can go down the path of explaining the other ways ottoneu isn’t like real baseball, but I am not sure if that is a compelling defense of this solution.  Clearly the alternatives we discussed were not better than what we decided on, but maybe there was something else I didn’t consider?  I open it to the floor.

The best part of designing a game is that you get to run into interesting questions about the system you are building all the time.  Of course, that is also the worst part.

Frameworks

As the other half of this little venture, I have not been pulling my weight on this blog.  But no more!  It is my turn to chime in with a few lines of thought that might only be interesting to me.

My free time the last few days has been spent developing my side of the project, a new fantasy baseball game.  Developing is not the right word – more like refactoring for scale.  Right now the game is written to handle the one league and 12 teams that have been using it for the last 5 years.  However, if I want it to go anywhere, people should be able to sign up, create teams, join leagues, and so on and so forth.  So after multiple false starts, I’ve decided to take the working code I have now, refactor it for legibility and to fix the bugs that I have found, and push it out to the world next spring.

There turned out to be two clear options for me in considering scale for ottoneu.  One option is the one I took – take my manually written, inefficient, and generally goofy PHP and turn it into somewhat legible, slightly less inefficient, still remarkably goofy PHP that allows more than 12 people to play this fantasy game.  The other option would be to start over from scratch and develop a scalable, efficient piece of software against a proven MVC framework.  I tried the second path two or three times, and I’ve learned, basically, that I hate development frameworks.

I decided to work with Zend, a PHP framework with which I had heard good things.  I started from knowing nothing, and only towards the very end of my experience did I start feeling any bit of understanding towards the framework.  Basically, learning Zend was like learning a new language, but with this whole level of indirection on top of it – it looks like something I knew, but it wasn’t anything that I knew, and hiding everywhere in the framework was some call or some method that was the “Right” way to solve a problem.  Some people have this problem with base PHP – lots of silly built-in methods/functions, lots of ways of solving a problem, but the difference is that when using a framework, there really was the “Right” way and the dangerous way, whereas base PHP has multiple right ways, depending on what you are trying to do.

The second attempt at going down the Zend path had me hire a developer who had serious production experience with the framework and, I hoped, would be able to guide me and help me develop the new version of ottoneu.  However, the problems here were fairly straightforward – I still wasn’t learning anything about Zend, I barely had an idea of what was going on, and the developer was a freelancer, not invested or interested in being invested in the project.  So fine, this isn’t a beef against the framework, but… Goddamnit, I’m a reasonably smart person and a decent developer.  If your framework is too obtuse for me to pick up and build a reasonably complex project with, it isn’t doing its job.  All the “Hello Worlds” and simplistic authentication examples in the world won’t convince me otherwise.

So I decided, with a little help from this post from Joel Spolsky, to run with what I had.  Yes, it was ugly code.  Yes, I’m embarrassed to share it with anyone with anything more than self-taught PHP experience.  Yes, it had bugs galore, didn’t interact consistently with MySQL, and was way slower than it should be.  But look – it works.  The damn code works, and has worked for 5 years.  Best of all, I understand what I am working with – I wrote all this code, so I know what it is trying to do, how to fix various issues with it, etc.  And for just that reason, I know it will be faster for me to get to launch day, Spring 2011 than it would have been using Zend.

My conclusion is this – frameworks are good for someone starting out from scratch, but only if 1) the project is going to use a ton of the built-in help the framework gets you and 2) won’t need a lot of stuff that is outside the scope of the framework.  There are ways for me to eventually get my code to something much cleaner and more legible and even faster, but starting over from scratch was not one of those ways.

Next up, I’ll discuss a more interesting, more fantasy baseball-oriented topic: how do game and inning limits work?

The Reboot

You can tell it is new by the capital letters.

So let’s try this again.  The Tribe is mired in a 3 year slump, but not all starts and ends with them.  Big things are happening!  And here is where we will track it all.  Geoff is working on a new system that has a lot of potential and seems very interesting.  I’m trying to change the game with fantasy sports, starting, of course, with a baseball tilt.  And we are both adults*, which in this case purely means we have a better chance at success than ever before.

So, come along and join us, and let’s see what happens.

* Not an indicator of maturity, per se.