1. You should see (500) Days of Summer.
2. I listened to the Creative Screenwriting Podcast (heavily recommended) where they interviewed the screenwriter. I guess the movie is heavily based on his having that kind of relationship. Twice.
3. He might have written his script as far back as then. Can't remember.