Aaron Schlesinger

Software Engineer, Soccer Player, Creator of Go In 5 Minutes (bitly.com/goin5minutesyt)

Page 2


Anxiety

I just read the my last post, and I’m thinking that everything feels so far in the past. I know that’s a good feeling since life feels almost normal again.

I think there will always be parts of life that will remind me I’m “different.” Most of the reminders have disappeared or are just worries that I can brush off. I’ll always be
bothered that I can’t live a totally care-free lifestyle like I used to, but I’ll try to come as close as I can. I get small fears sometimes that I’ll have another seizure,
but I always work to control those as well. Also, sometimes I feel pretty lonely that very few people I know feels some of these emotions, and I wouldn’t want them to either.

In light of those negatives, I’m proud that I’ve come far enough to be thinking of them instead of the physical health problems. I don’t intend to talk much more in this post about seizures or epilepsy, but instead

Continue reading →


Shock

 A Note

I began writing my last post about Epilepsy because I felt good expressing my experience and feelings via this medium. My first draft was a novel, but I felt relieved because everything was out on the screen. As I edited the text and made it more concise, my thoughts and memories became more clear. I’m happy I found this outlet.

When I shared that post on Facebook, I saw the outpouring of support and was humbled. From the bottom of my heart, thank you to everyone who read that post. It means the world to me, more than I can describe in text. Still, I’ve been conflicted about continuing to write. I usually tend to isolate my feelings, so sharing like this makes me uncomfortable.

Anyway, I’m going for it. The following text describes what happened in the weeks after I returned from Chicago, back to the “real world” that I had waiting in San Francisco.

 Coming back to SF

When I

Continue reading →


Epilepsy

In December 2011, I had a seizure and immediately began seeing a neurologist. At the time, the doctor, my family and I all thought there
were non-neurological reasons for the seizure. There are tons of reasons why parts of the human body can seize, and many of them are not directly related to the brain. I got tested to see if
I had any of those problems, but none of the tests were positive.

I found a statistic somewhere that 1 in every 10 people has one seizure in their life, and that made me feel very hopeful. Maybe it was a fluke and I could move on. Once I made peace with that idea, I moved on.

 Diagnosis

In April 2012, I had another seizure. Medically speaking, when a person has 2 unprovoked seizures they officially have epilepsy, so as of April 2012 I am an epileptic. Once the diagnosis came, I felt like I had a disease. I am now sick, and I can never shake the diagnosis and

Continue reading →


IO for Great Good

 !(Side Effects)

Code is hard in large part because of side effects. If you call a function, it does stuff, and you might not always know what it does. Why? Because it interacts with the outside world.

The concept of a function interacting with the outside world is called purity, and there’s a fancy mathematical explanation of it. But I’m not here to spout a bunch of math at you. The 80% approximate explanation is this: if a function talks to anything outside of its body, it is impure.

So, being pure means you can’t do a lot of things. If your function is pure, it cannot:

  1. write or read any global variable
  2. talk to a database
  3. make a web request
  4. talk to a cache
  5. do anything immediately useful

If you missed it, look at #5 again. So if it’s useless, why the post about purity? Purity has one great advantage: referential transparency.

Again, fancy mathematical explanation aside

Continue reading →


Going from Java to Scala

Scala, in my opinion, is a wonderful language. I have refrained from saying that publicly until after the “honeymoon period” was over between me and it. Now that it is, I feel comfortable with that statement.

Perhaps the greatest feature of Scala is that it can work “seamlessly” with Java. But, that whole “seamlessly” assertion comes with plenty of caveats, because as some know, sometimes not even Java can work seamlessly with Java. But it is possible to ship production quality, stable code that is mixed Java & Scala. And although I think Scala is great, I won’t spend time in this post defending that opinion, so if you disagree or otherwise don’t want to use Scala stop reading now. Otherwise, read on!

 Why you’ll need to tangle with Java

Java is everywhere. If you have never written a line of Java and you’re staring fresh with Scala, welcome to the JVM. Yes, it is an open virtual

Continue reading →


Function Maps in Scala

I find myself using the Function Map pattern a lot in my Scala code. Generally, when I need to group a set of related functions together, I use one of these.
My favorite example is in actors. When passed a label that identifies an action, the actor looks up the action in the function map and then executes is. Here’s the code:

    ...
    case class BaseMessage(s:String)
    case class MessageOne(s:String) extends BaseMessage(s)
    case class MessageTwo(s:String) extends BaseMessage(s)
    case class MessageThree(s:String) extends BaseMessage(s)

    val FunctionMap = Map(
        MessageOne -> ((a:String) => println(a)),
        MessageTwo -> ((a:String) => doSomethingWithString(a)),
        MessageThree -> ((a:String) => doSomethingElseWithString(a))
    )

    val MessageProcessor = actor {
        loop{
            react {
                case b:BaseMessage => {

Continue reading →


StackMob

I recently left my job as a software developer at Zynga and now I work at Stackmob. I had been at Zynga for two years, had a bunch of stock in the company, was paid well for a single 25 year old dude, and I knew in my gut for the last 6 months of that job that I had to get out.

After I left, I took a bit of time off to chill and reflect a bit, and I spent some time trying to answer 2 questions:

  1. Why didn’t I leave immediately after I got the “gut” feeling?
  2. Why did I end up leaving when I did?

The first one is easy. The golden handcuffs were on the whole time I worked there. When I talked to people about possibly leaving, I frequently got the response “stay at Zynga and cash out.” So I took the advice and stayed a while at Zynga.

The second one is tougher. I eventually got out of the cuffs. I switched teams and projects a few times inside Zynga, looking for something I was happy

Continue reading →


Fuck the Easy Way, Find the Challenge

TL;DR Do hard stuff that you will fail miserably at. It’s a great way to learn.

I just got back from playing in a soccer game in which my team was destroyed. The score was 7-2. Yea, destroyed.

The league I play in is a recreational one, and we’re all recreational players. From time to time, we play regular season games against very competitive teams that wipe the field with us. Today was one of those days.

We agree to play these types of teams because games against them help make us better. We get destroyed, and leave with our egos flattened and we learn. How the hell does that work?

Brendan’s article explains it well. You need to be challenged in order to grow. In everything you do.

I see accolades as nice to haves (as in: your life will suck without them because you will feel worthless!), but you need to be in those “I just got destroyed” situations so you can get better (yea, I’m

Continue reading →


Map (no reduce) with Ripeline

I went to MongoSF 2011 and attended a talk called “MongoDB’s New Aggregation Features - A Sneak Peek” by Chris Westin. As of writing, I don’t believe that slides are posted, but they will be soon.

In the talk, Chris said that they’re working on pipeline-based aggregation for Mongo, as well as a rich set of pre-built operators that can be applied in any order in that pipeline. Step 1: define your data (a Mongo collection), step 2: write your pipeline, step 3: profit.

In functional terms, this Mongo pipeline is functionally equivalent to applying multiple mappers to each element in a collection (ruby’s version for Arrays: http://www.ruby-doc.org/core/classes/Array.html#M000249), and streaming results from each mapper to the next. That model fits lots of problems too, and it’s simpler to conceptualize. Sometimes you just don’t need to reduce.

Turns out someone wrote a pipeline for

Continue reading →


Type Safety For Python Functions

Have you ever written something like this Python code?

def myFunction(a, b):
  if type(a) != str and type(b) != int:
    raise "a must be a string or b must be an int"
  #do some more stuff

I find myself writing that all the time. I want the type flexibility of Python a lot of the time, but I also want to enforce types when I need to. Writing that if statement over and over at the top of all of your functions is not very DRY, and it’s error prone and annoying. I solved that problem with a decorator.

 Function Decorators FTW

Python decorators are functions that you tell Python to call & pass another function into it. Python will replace the passed function with whatever your decorator function returns. Here’s a concrete example:

def log(func):
    def inner(*argv):
        print "calling %s:"%(func.__name__)
        func(*argv)
        print "done calling %s"%(func.__name__)

Continue reading →