Hainan Chicken
July 5th, 2008 by JonHainan Chicken
42mm, f/2.8, 1/60s
Finding the Fun.
Hainan Chicken
42mm, f/2.8, 1/60s
Making a Java app look “native” on Mac is a hard problem on many levels. I’m not talking about slapping the “Aqua” look and feel or setting the system property to make the menu bar go to the top. I’m talking about the 10 million “little things” that make a Mac app feel like one. Architecture-wise, you also end up with a mess of if-statements and refactor your code using an AbstractFactory or some other pattern to keep things clean.
I spent a good night tackling some of these “little things” and Googling around, and while each one is tiny, they add up to a much better experience, and I guarantee that you Mac users out there will find StencylWorks to be one the most Mac-friendly Java programs out there and easily the best feeling Mac game creator out there, barring Unity3D, which is a native Mac app.
For those of you who haven’t figured it out by now, I do have a MacBook Pro, which has let me do this and a lot more, so to all Mac users out there, you’re covered well and won’t feed any my users dog food like I’ve seen some others do just to rush the product out the door.
Trying to explain why a programmer is productive one day while being completely unproductive the next day can sometimes be a futile exercise. The lazier amongst us won’t even bother to explain our unproductive days, citing “I was tired” or “I just didn’t feel like coding” as excuses. Excuses, excuses.
Today, I’m not going to talk about the bad days. I’m going to talk about the good days, the days when you feel energized and productive because you got a week’s worth of quality work done on one night. What’s going on there, and what makes it happen?
Coding is a mentally demanding activity. I’m talking about real coding in which you are tackling a problem that you haven’t encountered before. For your coding session to be productive, there are a few required conditions, in my opinion.
Coding is like sleep.
With those three conditions in place, you can begin coding, but what actually happens? Coding is much like sleep in the sense that there are various stages of sleep, and like sleep, your goal is to get into the deepest stages, and those are the stages in which you become optimally productive. Like sleep, you tend to lose awareness of your surroundings and focus entirely on the problem at hand, and for lack of a better word, some bottleneck in your mind disappears, and you begin progressing without slowing down or pausing. You just keep moving forward, feel good about it, and continue until the problem is solved.
You must load in the problem.
How do you get into this state? My theory is that to reach this state, your mind has to “load” in the entire problem that you are tackling, much like a computer that’s loading a program into memory. Your memory capacity is limited, but once you load that entire problem in, then you can begin processing it. This process takes anywhere from 10 minutes to an hour depending on the person and the problem. Once the problem is loaded in, you begin processing it, and while doing it, your mind “optimizes” things along the way (think like a JIT compiler), so you begin to process things faster and faster until you reach that optimal state in which nearly nothing can stop you.
Distractions = Preemptions
Now what about those distractions? Distractions can be likened to preemptions, interrupts, or whatever you’d like to call them. All of a sudden, you switch gears, you load something entirely different into your “memory”, and if the distraction is bad enough, it may cause you to lose your focus, equivalent to a page flip in computing. Once that happens, you have to waste time reloading the “problem” into “memory” before getting back into your relative state of programming nirvana.
While this analogy may sound strange, I find that it pretty nicely explains why you’re productive on some sessions, what you feel when you’re productive, and to everybody else out there, why we programmers hate distractions. Next time you distract a programmer who’s absorbed with a problem and get an angry glare from him or her, this is why.
What are your thoughts on this topic?