Wednesday, December 28, 2011

JavaScript Is Not A Language



Recently people presented arguments for and against using CoffeeScript. I felt the argument against was pointless and obviously wrong, but I couldn't figure out why, and I thought the counterargument for was kind of toothless and irrelevant. I've figured out the real issue.

The real argument for CoffeeScript is that JavaScript is not really a language.

Years ago I read something which explained, in my opinion, why Lisp has never achieved the mainstream adoption its passionate advocates believe it deserves. Lisp projects experience a degree of balkanization because everything is left wide open; you can use more than one object-oriented paradigm (potentially even at the same time), you write your own this, you write your own that, you write your own everything.

At Canada on Rails in 2006, somebody asked DHH why Rails didn't have a to-do list generator, and he said it was the wrong level of abstraction; to-do lists are always application-specific enough that any generator worth a damn would be as complicated as Rails itself, and probably as many lines of code. It's not something you can solve at that level of generality.

Lisp fails to recognize this, and rather than being a language, it is an abstract syntax tree manipulation system. An abstract syntax tree manipulation system is something every language needs and is built on, but it is not a language, any more than a skeleton is a person. Programmers who say Lisp is better than any other programming language are really saying that they prefer manipulating the abstract syntax tree directly vs. using somebody else's user interface for the same task, which is all a programming language ultimately is.

JavaScript is a Lisp with hideous syntax. Not surprisingly, it sees similar balkanization. Consider writing modular code. Do you use CommonJS, require.js, or something else? The question is idiotic; it should be answered at the language level. Do you choose which modular code-sharing system to support when you sit down to write your module? If you have three different solutions for writing modular code, you can't write modular code.



I use CoffeeScript for the same reason I use Ruby. Manipulating the abstract syntax tree directly is way more fun, but insufficiently pragmatic.




Update: I realize this blog post gets a bit idiotic with regard to technical details, and I've seen some Lisp fanatics ranting about what appear to be many entirely legitimate objections to the "JavaScript is a Lisp" meme, but I think my basic point here is pretty much dead on. Writing CoffeeScript just feels like using a language in a way that writing JavaScript just doesn't -- and I was doing drag-and-drop widgets before even Prototype existed.

Monday, December 26, 2011

Happy Holidays And All That

Wednesday, December 14, 2011

Comedian Louis CK Abandons Traditional Entertainment Industry Business Model, Makes Bucketloads

The experiment was: if I put out a brand new standup special at a drastically low price ($5) and make it as easy as possible to buy, download and enjoy, free of any restrictions, will everyone just go and steal it? Will they pay for it? And how much money can be made by an individual in this manner?

...this was a premium video production, shot with six cameras over two performances at the Beacon Theater, which is a high-priced elite Manhattan venue. I directed this video myself and the production of the video cost around $170,000.

The development of the website, which needed to be a very robust, reliable and carefully constructed website, was around $32,000...

The show went on sale at noon on Saturday, December 10th. 12 hours later, we had over 50,000 purchases and had earned $250,000, breaking even on the cost of production and website. As of Today, we've sold over 110,000 copies for a total of over $500,000. Minus some money for PayPal charges etc, I have a profit around $200,000 (after taxes $75.58). This is less than I would have been paid by a large company to simply perform the show and let them sell it to you, but they would have charged you about $20 for the video. They would have given you an encrypted and regionally restricted video of limited value, and they would have owned your private information for their own use. They would have withheld international availability indefinitely.


(PS: when he says

I want to thank Caspar and Giles at Version Industries, who created the website.

that is in fact a different Giles.)

Tuesday, December 13, 2011

Pixels Made Of Flammable Gas



via gizmodo. project originates with the Danish MIT

Seriously Awesome Live Drumming D&B



And this is just a tech demo! The drummer here is Michael Shack, who's working on the Netsky tour.

Sunday, December 11, 2011

CNN LED Ticker Tape Hacked?

Here in Los Angeles, CNN has a skyscraper -- I think it's their headquarters -- in Hollywood, at Sunset and Cahuenga. The ground floor showcases several big TVs running CNN, as well as a big LED "ticker tape" display running a constant stream of headlines and short, one-sentence stories.

I went by there yesterday on my way home from somewhere and saw the following two messages:

"GOP proves they do not care about consumers"

"It's sometimes a good idea to turn off the television if the news pushes your blood pressure beyond acceptable levels."

Either CNN got hacked in LA last night, or they've made a major change in editorial direction.

Wednesday, December 7, 2011

Firefox Vibrator API

I learned from HTML5 Weekly that Firefox has a new Vibrator API.

Tuesday, December 6, 2011

Fuck Yeah, Browser Sticky Pads



The Post-It Note will always be, for me, an icon of the "why didn't I think of that?" kind of brilliance that (like Rails) represents something which everybody needed -- and which anybody could have created -- a long, long time before the inventor actually made it happen. Thus, this product is noteworthy (heh) not just because if you know what it's for, you want one, guaranteed, but also because this is a Post-It Note type "why didn't I think of that?" product made out of actual Post-It Notes, making it a recursive Post-It Note.

Go, UI Stencils, go!

Monday, December 5, 2011

Why Is CSS Not Object-Oriented?

There's a brilliant but unreadable book called Pro CSS And HTML Design Patterns which attempts to analyze CSS and HTML and isolate design patterns, like the OOP classic. It fails and it succeeds. The author does identify commonalities and unifying principles within CSS, but these don't really qualify as "design patterns" as they don't have cohesive characteristics or nameable identities. In OO design, it's easy to understand what the Singleton pattern represents -- it's a single thing, instead of one of many. Nothing so comprehensible exists in this book.



I highly recommend this book, but as a mountain to climb, not as a silver bullet. The attempt to treat CSS and HTML like object-oriented software fails, because the DOM is just one massive object whose design cannot be changed, and CSS is not object-oriented at all. It is an incredibly coarse, brittle query language combined with an unimaginably complex set of decorating notations. Object-oriented CSS would be awesome, but faces tough questions. Which is the fundamental unit of CSS: a rule? a cohesive visual element on the page? the DOM tree a rule applies to?

CSS maps a tree of style rules to a tree of DOM objects. These mappings falter and frustrate, because mapping a tree to another tree is no task for human minds -- it's the whole reason compilers were invented -- but they also represent a tremendous improvement over the pre-CSS model, wherein a tag conveyed both styling and semantics.

This suggests an evolution, in which CSS compilers should ultimately exist, and indeed, some already do -- e.g., Front Page and Dreamweaver -- but they suck beyond belief, and the open source avenues to this destination are still very young.

Kyle Neath created a cool project called KSS which addresses the confusion CSS always creates. It's a simple and powerful system for documenting CSS. I think it's a step in the right direction, like Sass, but I also think that the world will be a much better place when we finally get CSS compilers built for grownups -- by which I mean people who could write the output code themselves, but have better things to do, like the intended user base for Rails generators or CoffeeScript.

KSS uses cohesive visual elements on the page as its idea of the fundamental unit of CSS:

You should document a rule declaration when the rule can accurately describe a visual UI element in the styleguide. Each element should have one documentation block describing that particular UI element's various states.

That sounds very object-oriented to me. The end result looks like this:



In keeping with this philosophy, KSS allows you to document an implicit object hierarchy with your section numbering:

KSS documentation is hierarchical in nature — any documentation blocks at [any point within the] styleguide hierarchy apply to the documentation blocks [beneath] that level. This means that documentation for 2.1 applies to documentation for 2.1.3.

For instance, you can cover "Buttons" in section 2.1, "Login Buttons" in section 2.1.1, and "Navigation Buttons" in section 2.1.2.

I plan to retrofit an old project with KSS in the next few days, firstly to get a better feel for it and secondly because I'm very curious if it helps me uncover an implicit object hierarchy which is already there in the code. I'll blog about it some more if I find out anything interesting.

Saturday, December 3, 2011

My Plan For Uncollapse: Drums


Me drumming. I just bought these so I'm still new at this.

In the final months of 2009, I blogged a giant ironic rant against blogging called Blogs Are Godless Communist Bullshit (the title being a Penny Arcade reference). In it, I announced I had finished ranting about Hacker News -- how I wish that had proved true -- and was ready instead to flood the world with information products and coaching services.

That part proved completely true. At the very tail end of 2009 and through most of 2010, the only thing I did for a living was sell videos and coaching services on my blog (and a little bit of affiliate marketing here and there). It worked beautifully. All my life I've wanted to work for myself. But after a while, it didn't work so well, and then it didn't work at all.

Part of the collapse was easy to explain. The quality of my work slipped. People stopped buying my stuff because my stuff stopped being awesome. My stuff stopped being awesome because I stopped being motivated to make awesome stuff.

But it wasn't just that the quality of my material slipped. I also eased up on my sales of stuff which people already wanted and which people were already telling each other was awesome. I even stopped doing dumb affiliate marketing things which worked whether the quality was good or not. And pretty soon I had to go and get a job just like anybody else.

What happened?

Until very recently I've blamed my "medical" marijuana card and the unpleasant social isolation of working from home on your own projects -- and these certainly didn't help -- but now I have a new theory, because I've noticed something. Right around the beginning of 2010, I started a new acting class. This past summer, I stopped taking that class, and gradually, ever since then, many things in my life have gotten better.

I started making real money again, I fixed up my apartment a little, I bought two prints by Takashi Murakami and a MIDI drum set -- things I've wanted for decades -- and most importantly of all, I started eating well again.

Eating well is life or death for me. I have severe heart disease, which already posed a serious threat to my life by the time I was 33, so in 2009 I transformed the way I eat, taking on a very unusual, very strict, nutrient-dense vegan diet, which dropped my cholesterol by 100 points in two months -- an improvement which normally takes people ten years -- and also brought my weight down by 82 pounds within six months. I kept that weight off for a year, but by mid-2010 I had started eating meat, bread, and oils again, and today I only weigh about 10 pounds less than I did in 2008. That's very dangerous for me. It's not cool at all. From mid-2010 onward, I gained weight, and the weight gain finally slowed when I started eating right again, which happened shortly after I left this acting class.

So I'm wondering what the deal was with this class. It didn't seem that bad at the time. In fact, I worked hard and felt I was doing well.

Different acting coaches pursue a wide range of strategies and subscribe to a wide variety of philosophies. This is intrinsic, because acting is an extremely subjective art form. To be fair to my acting coach, she warned us often that her class was a bit like the opposite of therapy. Her technique in some ways resembled finding the weakest elements of your own psychology and stressing those weak elements to see what would break.

My audience is mostly programmers. If more actors read this blog I would definitely use different terms. I'm not naming the acting coach in question here, not just because I think it would be very undignified and wildly inappropriate, but also because, if you are an actor, you want to understand that what I just said about her technique is a wild overgeneralization made for the purpose of communicating to people who are mostly not actors. (If you are an actor, we're talking about a somewhat dark variation on Meisner, although that also is an overgeneralization.) Anyway, there's definitely enough truth in the generalization to get my point across; this coach's technique involved emotional and psychological risk.

This approach to acting is not the one I would recommend today, or at least not the primary one. My favorite acting training is Stephen Book's curriculum, because it uses deliberate practice in the purest sense, and my second favorite is Ivana Chubbuck's studio, because although I don't entirely agree with her philosophy, the work ethic and discipline she cultivates are phenomenal, making it an incredibly focused, purposeful, and energetic place to study.

However, although the class I'm talking about here -- the one I left this summer -- ran somewhat counter to my own philosophies, I took it because I saw good acting in the class and because it pushed me and challenged me to develop my immediacy and sincerity as an actor. I'm glad I did that, and in fact I would even do it all over again, but given how many things in my life have started to improve since I left, I can't shake the suspicion that I paid a pretty hefty price for it.

A stark contrast with Ivana Chubbuck's studio illuminates the power of peer pressure effects. A couple years ago, I stopped taking classes at Ivana Chubbuck Studio after maybe a year of studying there, and I immediately published seven new open source projects in one month because the discipline and work ethic which her studio fosters still had a lot of momentum inside me. I was used to running at a frenetic pace in an actor hamster wheel, so when I switched my attention back to writing code, I did it at the same breakneck pace. After I had been away for a while, the peer pressure effect wore off, but if I look at these classes in terms of their side effects, the psychologically risky class looks very destructive, while the Chubbuck classes look very beneficial.

Unfortunately, I can't actually say for sure how they affected my acting, because I have videos from one class but not the other; because of the inherent subjectivity of the art form; and because I still have virtually no career to speak of as an actor. (I have plans for that in 2012, but that's material for another blog post, or more likely a whole ongoing series.) It would make a simpler story if I were to say that the psychologically risky class gave me crappy training, but it didn't. Both classes I'm describing here were excellent.

Anyway, with respect to the collapse of my entrepreneurial independence and vegan diet, I've been wanting to blog about how I'm going to get back on track ever since I started going off track, but I held off because I really had no idea what the answer would be, and there's no sense making a prescription before you've got a diagnosis. Now that I've been away from that class for a little while, however, everything's starting to improve, which means I have a diagnosis and can formulate a prescription.

The most important difference is I'm done with that psychologically risky acting class. I plan to use Stephen Book's work to create a system of deliberate practice for myself, and I plan to return to Ivana Chubbuck's studio for the beneficial side effects. Also, since social media's been very useful for me in the past, my deliberate practice system for acting will probably involve posting videos on a regular schedule. I did something similar for music a couple years ago; it worked very well and is probably coming back in the very near future also.

However, this is not precisely a plan for getting back on track per se, because I haven't gotten into the business side of things yet, and because there are two elements of my successes in 2010 which I don't want to repeat, although I'm completely happy with them in context.

The first is that I got a bit obnoxious with social media marketing. A few years ago, my blog used to very often be the number one link on Hacker News or Reddit (more accurately, the programming subreddit). In all that time, I never once submitted links to my own blog to either one of those sites, or asked anybody to upvote anything. But in 2010 I made money when people clicked my links, and it changed my approach. I became quite sales-y online as a result. I probably will bring some of that back, but not quite so much of it.

The second aspect I won't be resurrecting is deliberate flimsiness. For 2010, I set out to launch a new mini-business every month. I didn't hit that target, not even close, but it was a useful goal all the same, because, in the process of chasing it, I created minimal practical implementations of several different business models, and many of them worked out all right. This was a pretty deliberate thing, and the whole time, I prioritized practical exploration of new business models over contuining the momentum of existing successes. This is a terrible way to run a business, but it's a great way to rapidly learn and explore several different business models, which is exactly what I wanted to do, and exactly what I did. I can now say I'm pretty comfortable building a variety of very small businesses.

Which I plan to do in 2012. But it won't be a new business every month; it might not even be a new product every month. Similar to the monthly "build a new business" experiment, in 2009, I set out to build a new mini-app every month. Again, I only shipped mini-apps some months, but it helped me develop the habit of shipping things, which was the real goal. Both years, these "new X every month" things were deliberate practice exercises to hone my ability to launch apps and make money on the Internet. But I didn't do one in 2011, and in 2012, it's a pretty safe bet that I'll stick by the things I create, if they make me money. You can't say "a new app every month" unless you free yourself from the responsibility of maintaining those miniapps, and the same is true for businesses, but "a new business every month" is actually a much less useful business goal than "start making money and continue making money."

You may wonder where the acting went in all this business stuff. It remains a priority. My acting, and my music, go in the morning; code and entrepreneurship go in the afternoon. I've been reading Cal Newport's blog and books, and regularly scheduled sessions of intense focus are a major theme. Variation is inevitable, especially if I ever get off my butt and start going to auditions, but systems are a must.

Music and acting go in the morning for three reasons: first, some research I read somewhere indicates that morning sessions of deliberate practice are slightly more effective, on average, than afternoon sessions. Second, if I set myself a strict schedule, I'm more likely to meet that strict schedule if "drums at 9am" is my first task every day. (In fact, this morning, I had gotten in a good half-hour of hard work on the drums by 7am.) Third, it's a simple way to affirm my priorities. I enjoy writing code, and I'm grateful to be good at it in a decimated economy where it's basically the only profitable business still remaining, but I'm determined to do some professional-level work in both acting and music in 2012.

My music deliberate practice so far consists only of drums. I bought a MIDI drum kit a few weeks ago, and began doing deliberate practice on the drums every morning at around 9 or 10 am. The minimum time's been a half-hour and the max an hour. I work on timing, velocity, and coordination, and a small assortment of simple beats. I may blog more about that later.

I'm using this habit to bring back my habit calendar system, but I haven't begun tracking the habits yet. The habit calendar worked beautifully in 2009 and the first half of 2010, but fell apart like everything else in the fall of 2010. When I was on top of the world with my habit calendar, I had four different calendars tracking many different habits on both daily and weekly cycles. When people asked me how they could do the same thing, I advised them not to leap in with a system of that complexity, but instead to choose just one thing they could seriously commit to doing every day. I've been holding off on even starting my calendar system back up again at all, because I wanted to be sure that drumming could serve that purpose, but I'm satisfied now that it can.

This is, in fact, how I got started with the calendar system initially -- by using it to track my faithfulness to my goal of creating and tweeting one new mp3 every single day in 2009. I believe that also may come back, but my primary goal with the daily habits thing is to re-establish a bedrock daily habit which is firm enough to serve as the foundation for an entire habit calendar. I'm also likely to layer on an acting daily practice piece soon, but again, that's enough for an entire blog post (or series) of its own.

One more thing about the drums, though. Somewhere in a New Mexico storage unit, I have a dusty pair of drumsticks and a digital practice pad, which I used years ago to practice drum rudiments, e.g., paradiddles. Obviously, spending that time on the basics back then made it easier for me to pick up the drums these past few weeks. But I bought them for another reason. At the time, I had just read the book Flow, by Mihaly Csikszentmihalyi, which resulted from his research into happy people and what they have in common.

The basic lesson of Flow is that happiness is a nearly inevitable consequence when you frequently perform some action which requires intense concentration, and which rewards that concentration with gradual progress according to objective, measurable results. (It's one of the reasons TDD makes developers happy.) A very, very wide range of activities qualifies; I chose learning drum rudiments. I had in fact been wrestling with depression not long before this happened, and although that was basically over anyway when the drum rudiments thing began, I do believe I became a happier person afterwards.

This is why drumming becomes the bedrock habit. Not only is being a happy person a pretty logical goal in its own right, but when I look back on this acting class and the effect it appears to have had on me, it worries me a bit. Suffering for your art is lame, and in my case it doesn't even make sense. I can write code, I can make music, and I can DJ. I could have plenty of money and a very fun life without all this acting stuff, and when an art form consists, to some degree, of your own psychology -- which is certainly how this particular mode of acting worked -- you're looking at risks so intense that operating without a risk mitigation strategy would be ludicrous. In future, I plan to use different acting techniques, ones which minimize psychological risk and maximize the benefits of deliberate practice, but under the circumstances, in the context of the risks acting can involve, I think it's very wise to have a psychological insurance policy.

Perhaps even more importantly, the isolation factor I mentioned earlier -- working from home, on your own products, which you create and market single-handedly -- can have a tremendous negative effect on your discipline. It's just so easy to give yourself "another five minutes" to play video games. But being your own boss means you have to be disciplined.

It's even possible that this, and not the psychological risk-taking, was the real downside of that acting class I took. This acting coach permitted very lax discipline. At Ivana Chubbuck's studio, if you're five minutes late, you're locked out of the building. No kidding, no fucking around. You can finally get in when the class takes a break, but that might not be until a full hour after your five-minute-late arrival. This other class frequently started late, I think once as much as an hour late. I got away with not memorizing my lines at that class, which, at Chubbuck, would probably have gotten me disemboweled with a ninja sword.

Correlation is not causation, of course, but my troubles began about six months into the class and started resolving themselves about a month after I left it -- and both my main trouble spots derived from discipline fail. My first problem was lapsing in my extremely strict vegan diet, and my second problem was smoking weed on a Tuesday at 2pm when I should have been making new products, marketing the ones I already had, and automating as much of the business as possible. In either case, discipline fail.

I think acting coaches who forego discipline may not be doing their students any favors. Peer pressure effects are powerful; I was in there for 6 hours at a time, multiple days per week; and it's possible this environment cost me my business. Even if that isn't the case -- and it might not be -- discipline is crucial for performing artists of every stripe, and something I personally prefer in an acting coach and/or class.

Wherever the blame lies, being a solo entrepreneur requires discipline, so my options are basically cultivate much better discipline, go back to working for other people, or hire some disciplined employees. I would love to be in a position to hire employees someday, but I'm not right now, I hear they're not easy to find anyway, and I want to work for myself in 2012 like I did in 2010. Musical instruments are a terrific and time-honored way to cultivate discipline, so that's what I'm going to do.



Plus, drums are just awesome.

Four Books On Drumming

I got four books on drumming which I'm pretty excited about: two on fundamental skills and techniques, two on the specific types of music I'm most interested in. Stick Control seems to be a time-honored classic on snare drum rudiments, and Mastering The Tables Of Time had a terrific review:

the buzz is strong inside drum circles that this book is the "Stick Control" of the future, so I took the plunge and indeed, it was a revelation!

Meanwhile, Jungle/Drum & Bass For The Acoustic Drum Set addresses the specific rhythms of my favorite form of electronic music, and The Breakbeat Bible aims at a comprehensive overview of breakbeats, including hip-hop, soul, drum & bass, acid breaks, and even a chapter on dubstep. Both these books falter a little bit -- one of them calls Goldie "DJ Goldie" and the other calls him "Goldi" -- but both feature transcriptions of real, credible work from people like Caspa, Rusko, PFM and Origin Unknown.

Friday, December 2, 2011

Tech-Trance Track: Shifting Bells

I tweeted this when I first created it, on September 1st of this year, but I want to blog a few notes about it. A book by Mark Butler prompted me to put together an experiment in shifting grooves back and forth across the beat. The rest of the track formed around that experiment.

To explain, Butler's book (among others) explains how the juxtaposition of groove and meter forms a major element in techno. (In the precise sense of the term.) Say you have the same rhythm, which mechanically repeats a hundred times, but in some repetitions lands ahead of the beat, in some repetitions lands behind the beat, and in very few repetitions actually lands on the beat. Some techno works by taking repetitive elements like that, stacking them in layers, and then moving them back and forth across the beat at various speeds, so that although every groove repeats with inhuman mechanical precision, the aggregate groove composed of all the stacked layers never repeats itself exactly and the variations therein give the machine sounds an ultimately human feel.

Butler is a professor of music theory and his book's pretty deep. In this track, I actually only use that approach for one part, because I after I got started, I kind of got distracted and made something else out of it. I didn't achieve the textured forest of metric juxtapositions Butler describes in his book, but I like the way it sounds anyway. If you listen to the bells, they shift throughout the track both in terms of their texture and in terms of their timing.