trigonometry has a badly designed interface

Imagine for a second that our trigonometric nomenclature doesn't exist as such, and you work for me, and you are writing an API for trigonometric functions.

You come to me and say:
sine!
cosine!
tangent!
arctangent!
atan2!
I say: 
Those words are meaningless.  You're fired.
Math language in general is really terrible about this; it forces the student to learn meaningless foreign names for concepts that, to mathemeticians, have become intuitive.

Which raises the question, what would you call those functions?
sine could be:
math.RightTriangle.height_of_opposite_side(angle)
or
math.UnitCircle.position_from_angle(angle).y

...I got nothing.

how we specify information

Online shopping currently sucks.*

Have you had this experience?  You're shopping for something outside your area of expertise, and you hit a wall of mediocre websites.  Each has too many products, each product described by 1 line of text and a janky 50x50 jpeg.  None is quite what you're looking for, though you're sure the product exists.  Eventually you find a site that has what you're looking for, but it's in German.  But then you start for searching for that specific nomenclature, and you can eventually find a site in your language that talks about what you want, but doesn't sell it.  They link to 3 online stores, 2 of which are broken links, and one of which is one of the janky sites you found in your first search.

It's like, the story of my life.

Now, go to http://www.mcmaster.com/ and try to find some piece of hardware, like say, a 3/8 hex nut.  The site isn't perfect, but I'm betting it gets you there, and teaches you something about hex nuts along the way.  The part I love is that if you search for a broad category, it lets you narrow down your search in a way that makes sense to you.  You build your own decision tree, instead of being channeled down theirs.  It is a very flexible process.

So, online shopping: who will fix it?  Who will make the process work when I don't already know what I want, or how to describe it, or how to search for it?  Who will let me buy something by teaching me what I want to buy?


*Amazon.com is OK, but not great.  It's mostly usable, which is enough to make it the world leader.  But it only covers a relatively small area of content.

what can you do

L and I have been working on a crash bug in a flash game.  He was finally able to fix it.  Here is what he said.
L: so you know what the problem was?
  the composition

me: the
  what
  as in, how the movie clips were grouped?
L: yeah!
  i just went into the fla
me: Nice.
L: went thru most of the symbols, and ungrouped, broke apart, and flattened stuff

me: once again I find myself flabbergasted.

L: it was pretty crazy... the art was imported from illustrator, but sometimes, there were 10+ layers of groupings inside of groupings, and some symbols had 100+ groups inside of groups
me: huh, yeah.
  I guess I'll try to keep an eye on that in the future.
Forget everything you know, or think you know.  All that you require is your intuition.  Or, when a person works with a complex system long enough, they develop an intuition about how the system behaves, that is parallel to and sometimes contradictory to how they know system is supposed to behave.  This intuition can be valuable, but it's not the kind of thing you can talk about in polite* company.  See: mysticism.  


*where by polite I mean rigorous.  Reading Neal Stephenson's Anathem has been been good and bad for me.

also, a blast from the past

Babies everywhere.

Congratulations to everyone I know who just had a baby, or is just about to.  :-D

on Flash

My friend Jared sometimes links these articles:

It’s not a secret: I don’t like Flash.

I don’t like Flash because it is responsible for the overwhelming majority of my browser crashes. I don’t like it because it consumes memory and (especially) CPU resources on my computer for almost the sole purpose of showing me advertisements, which also translates directly to reduced battery life on my laptop.

Furthermore, I resent the way that Flash rose to new heights of popularity by providing a terrible video playback mechanism that (although it largely solved the problem of video codec ubiquity) can’t reliably perform the most basic of media playback functions, such as accurately seeking within the stream, even after it’s fully downloaded.

You might think that I feel conflicted here, because I earn my living by working with Adobe products.  The fact is though, that I hate flash as much as the next guy.  Well, unless the next guy is Steven Frank, in which case I hate it slightly less.  But I wanted to offer my perspective on why Flash is so ubiquitous.

In my view, Flash beat out its main competitor, Java, by racing to the bottom.  What I mean is, while Java was busy trying to teach content creators the beauty of strongly typed object-oriented programming, Flash was busy letting them put shapes on a timeline and tween them around.  

The calling card of Flash is that it fails silently.  Unless you have a debug version of flash player installed, you will never see a Flash error box pop up in your browser.  In its early years, it was pretty stable, too.  Java on the other hand likes to tell you about its problems.  Now, a programmer might tell you, of course I want to know when I've made a mistake, that forces me to fix it.  But we're talking about racing to the bottom right now: Flash never concerned itself with pleasing programmers, in the early days.  It wasn't for us.  

When you're a performer, a singer say, and you're on stage in front of a real audience, the worst thing you can do is show weakness.  If you sing the wrong note, if you start singing the wrong song, you just roll with it, and you never admit it to your audience.  Performers and artists know this.  Now, shouldn't the public face of your website be the same way?  The genius of failing silently is that no-one will ever now how incompetent you are, they will just think they don't know how to use your website, or that there's not much interesting going on.  They will never figure out that you tried to access a null pointer.  As a brand manager, which would you pick?

So, in the same way that HTML flourished by allowing anyone to make a website, Flash flourished by dramatically lowering the barrier to creating dynamic content.  In the process it became an engine for commerce.  That is a legacy that I support, either because I am a big soft-headed populist, or because I am a big hard-headed pragmatist.

What really steams my beans lately, is that Adboe seems to have changed course with Flash, and is steering hard, away from designer-land and towards programmer-land--which is fine--but now they're stuck in the middle in a bad way.

Their designer-oriented tool (Flash CS4) is not fully inter-operable with their programmer-oriented tool (Flex).  Designers feel betrayed by the shift away from their specialty, and programmers are not yet satisfied, because of the bad performance and outmoded language. The flash player crashes.  A lot, for no good reason.  So they've lost the never-let-them-see-you-bleed mystique.

I know why Flash became popular, and I can see the logic behind where it's gone since, and yet I hate it, and Adobe, for 

A, not having the vision to lead the industry they've built
B, not having the technical acumen or leadership to do a good job with any of the tools they make
C, shoving it down our throats and making us pay for it, anyway

As a game designer for browser games, I almost literally don't have a choice, I am forced to use flash.  And I resent the hell out of it.

Let me be clear:  All of the tools Adobe ships for working with its flagship web technology are crap.  Utter crap.  The virtual machine itself fails at what should be its main goal: invisibility.  The Flash empire is Goliath waiting to meet David, but David never shows up.

In this day and age we have an expectation of positive progress, and when we're opressed by bad technology it seems every bit as urgent as if a foreign army were living off our land.  When it doesn't get better over the course of 5 years, it feels like the gods have abandonded us.  Where's your messiah now, Moses*?  Oh Adobe, who will play the Google to your Microsoft?


*Uh, you don't have to actually listen to it, I just wanted to find it for my own edification.

Flash As3 2d physics engines

I'm poking around trying to find a good physics engine to use.  Here are some resources I've found useful.

A possibly biased comparison chart.
blog post on the subject.
See also: *drawlogic for pretty comprehensive coverage of the field.

The gist of it seems to be that, if you want a fully featured engine, go with something derived from box2d, which is the fully featrured open source 2d physics engine for c++.  You have a few choices here.  Box2DAS3 is the official port, which stays very close to the c++ API and implementation. Motor2 and Physaxe are both forks which are optimized for AS3 performance.  But Physaxe is acutally written in HaXe, which is interoperable with AS3.  APE is an older, action-script only alternative, but active development seems to have died some time ago.

Hm.  My main requirements are that it have a community of users, and be under active development*.  For this game in particular I'm less concerned about raw performance, since I don't anticipate handling more than 10-20 items at a time.  So I will go with Box2dAS3.  Perhaps for my own (speculative) titles I'll move towards Physaxe, though.


*This is the best quality filter I know of for open source projects.

merchandise

Annie is selling shirts. The designs are from her blog. Mostly just awesome/cute drawings, with few words.

open source +1

I'm not sure what I expected, but I'm pretty sure I didn't expect to be able to download source code and compile it straight away with no errors. So good work, Scintilla and SciTE guys.

actually pretty simple

code editor feature:

In programming, {braces}, [brackets], (parentheses), "quotes", etc., are always only created and destroyed in pairs.

In the same way that a word processor would not create a <b> tag without creating a matching </b> tag, a code editor should not allow blocks to be unbalanced.  So, in the same way that you make text bold by pressing ctrl-B, you should make code into a block by typing {.  And when you delete one bracket, it's the same as deleting them both, because it doesn't make sense to have one without the other.

Making the editor smart enough to do this correctly when you don't have anything selected is a bit of a trick, but I think it should be solvable.

So, perhaps my short term personal goal shall be to download scintilla and SciTE source code, and to see if I can hack it up to act this way.  Eventually the goal is to take the job of managing blocks and whitespace away from the programmer entirely.*


*Currently there are lots of editors that will tell you, "hey, your blocks are unbalanced here", but I think that's lazy and insufficient.  Software tools should never be lazy, they should let their users be lazy.  Whenever a program tells me that I have a problem and how I should fix it, I look for the button on the dialog that reads "fix it yourself if you're so smart."  I never find it.

a programmer's nomadic life

I don't have a home language; I hate them all.  I'll use whichever one is least annoying for the task at hand.

Is there a better option than C++ for writing a performance oriented text editor with no extraneous requirements?

learning from debuggers and word processors

Continuing on the subject of a code editor.  I'm calling it "ned," for Nate Edit.  What?

When debugging code in a modern debugger, there's a window called a watch window that shows you the state of various relevant variables.  You can use this to visually inspect the state of the program as it runs.  Is there a place in the Ned UI for a similar collection of symbols?  In many editors this information is exposed through autocomplete, and I think that's a good feature, but is it quitting early?

  • Maybe things that are in tooltips or autocomplete windows now, should have permanent real-estate in ned.

On the topic of debuggers, and what we can learn from them: many editors, notably eclipse (which I hate for unrelated reasons), continually compile your code as you work, so that it's ready to run at a moment's notice, and so that errors are highlighted on the fly.  Is this quitting early?  

  • Maybe instead of just constantly compiling the code, we should be constantly executing it in a sandbox, and putting breakpoints at the cursor so that you can see the state of execution as you code.*

I don't like managing white space, brackets, and navigation; I hate getting lost in a project.  The editor should do as much of this as possible by itself.  Many editors have automatic beautification, white-space removal, and browser controls, but the programmer is still in charge of managing the tags, the text, the markup.  This is quitting early.

  • Maybe we can apply some of the lessons of WYSIWYG html editors to writing code; the markup that creates the logical structure is not important; visualising the logical structure is.

*OK so, this sounds totally implausible at first, but hear me out... what if when the program is executed in the debugger, we capture and remember the most recent program state and parameters that were passed in to each function.  Then, when I'm coding that function, we automatically compile and run just that function, in the context of the saved state.  It might not always work, but I think most of the time it would give you more insight into what's going on as you work on the code.

a code editor that isn't

We had a discussion at work today about the process of programming, and programming tools. Mike made the observation that many times instead of coding you end up typing. That is, just spending time entering text. We agreed that the ideal code editor would eliminate the task of typing, and would allow you to work at a level of abstraction higher than the literal lines of code that make up your program. We want a code editor that is not simply a smart text editor.

See, today we look back at the state of programming 40 years ago and say, how could they use punchcards.  40 years from now we will say, how could they use text files?

So I've got a bug in me now to write (or at least design (or at least talk about)) the next generation of programming tools.  A lot of it won't be groundbreaking things; a lot of this stuff exists today in various different programs, but what I've never seen, and I'm convinced doesn't yet exist, is a unifying vision that is strong and grand enough to sweep up our collective imaginations and change the way we think about how we work.

great news everyone

We have a name for the house now, it's Frontier Town.

It fits, I like it.  All this talk about the economy has got me thinking about the mindset of the people that grew up in the Great Depression.  They had different virtues.  Thrift and self-reliance were emphasized.  In many ways those virtues became obstacles when times were better, but I think they're interesting, if we're to be heading into a rough few years.

Will we see another generation that never throws anything away, that plants gardens and repairs their own cars, and complains about the wasteful attitude of their children?  People are funny, and I mean that in the best way.

asterisk

INTP FTW

relief

I'm really relieved to be done with all of the Christmas gift stuff, at long last.  It got hectic, and I felt like I wasn't able to give everyone the attention they deserved... but I guess that's just how it goes.  I blame my Meyers-Briggs  type.  Looking forward, I'm excited about putting some of my gifts to work; the crock pot, the skillet, and the miter saw specifically!  I can't think of a project that uses all three though.  Maybe an outdoor kitchen*.

I'm working on some self improvement things; getting more exercise, feeling less rushed or hurried, thinking ahead more, that kind of boring stuff.  Ouch, am I really that disinterested?  Apparently.  Actually, I'm writing a time-management game at work now, which gives me a good opportunity to meditate on a lot of these issues.

It occurred to me the other day that I have a lot of hobbies that take up less than 1 percent of my time, even less than 1 percent of my free time.  Things like welding, sewing, woodworking, making jigsaw puzzles, baking bread, making candles, selling tshirts, etc..  Lately even programming (for fun) is under 1%.  This seems weird to me, but maybe it isn't...?  I bounce around a lot, but I like to think that there's an over-arching theme to it.  (The theme is awesomeness ;-)  

I guess what *actually* ties it together is the concept of the castle.   The castle is really just an environment that enables a lot of these dumb hobbies, because in my conception of the castle I can participate vicariously in everyone else's crazy hobbies.  It's an environment for shared exploration of active creative lifestyles.  If that makes any sense.  The shape doesn't really matter, but the shape of a castle seems to inspire the kind of people I'd like to attract.

ok back to work.


*This is what you get today on my blog: stream of consciousness.

so angry

Right now I make my living by using Adobe products, specifically Flash and Flex.  So it's unfortunate that I can't stand Adobe products.  Flash CS4 is almost completely unusable.  Its performance when editing medium to large flash files is unforgiveable; when I click to select an object, or to edit a symbol, I can wait 10 seconds for the interface to respond.  Not acceptable.

What am I gonna do about it?  Probably nothing.  I only mention it here to record my displeasure, so that I don't forget it, start coping, and forget to be angry about it...that would mean losing a part of my soul--the part that cares about good interface.

correction

Actually, if you've let the wick of your candle be sucked down into the wax as it cools, you can get it out again, if you have a soldering iron.

cs theory question - wrapping inheritance

non-programmers may skip.

I'm curious; is there a language that allows you to extend a class by wrapping it?

That is, a language that lets me type:
class ExtraFunctionality wraps BaseSystemObject
{
  ExtraFunctionality(BaseSystemObject wrapped_object)
  {
    wrap(wrapped_object)
  }

  //override
  void do_an_awesome_thing()
  {
    super.do_an_awesome_thing();
    do_extra_things_too();
  }
  
  void do_extra_things_to()
  {
    //...
  }

  void do_a_lot_of_things()
  {
    super.do_easy_thing(1);
    super.do_easy_thing(2);
    super.do_easy_thing(3);
  }
}
So that I can then write 
ExtraFunctionality my_obj = new ExtraFunctionality(api.get_base_system_object());
my_obj. do_an_awesome_thing();
my_obj.do_a_lot_of_things();
my_obj.another_base_class_method();
api.use_base_system_object(my_obj);
I can't simply extend the class because I'm not constructing it myself, I'm getting it from the system, so it won't cast.  If I wrap it using a conventional class, then I either have to override everything myself, or else expose the wrapped object and let the caller decide how to deal with it, which is ugly.  Either way though, I can't pass it back into the system, because it's not the right type.

So, I want to inherit the type in the form of a lightweight, easy to write wrapper.  I think this case is getting more relevant these days as APIs and SDKs are coming to dominate the coding landscape, as opposed to working mostly within code you control yourself.  Comments?

obnoxiousness

1. chipotle hummus bread with sesame seeds
2. honey pecan whole wheat bread with sunflower seeds
3. purple 'vineyard' scented candles poured into red wine glasses
4. coffee scented candles poured into glass mugs
5. thousands of dead zombies

That's what I did with my day off.  Some of you may get homemade candles as belated xmas gifts.  The chipotle bread came out a bit parbaked, (I took it out early 'cause the crust looked done--this is why I am terrible baker), but it tastes great, so I won't complain.  I haven't opened the other bread yet, but I think it'll be more done.

I've been slightly appalled at my burn rate for money; I really need to cut back, so I'm going to stop eating out for a while, and try to get into the habit of making lunches and saving leftovers and so forth.  Life skills, you know?  Oof.  It's not really that I have expensive tastes or hobbies, it's more that I just don't ever try to save money; if I've got it I tend to spend it, on this or that.  So my resolution, if you care to call it that, is to learn the ways of thrift.  It's all a part of the larger plan...

Ohio was great, even though we didn't get snow.  I felt right at home.  Too, I really, really needed the down time, and I feel a lot better now than when we left.  Time to get back on top of my life, instead of being dragged along beneath it, is how I always think about.  I think I feel a few schemes coming on.

So candles.  I thought, oh, I'll make some holiday candles, it'll be easy and fun and make a great gift.  Mostly true I think, but wow wax is funny stuff.  When it cools from a liquid to a solid it shrinks quite a bit, and so the centers of the candles sink in.  If you've removed the support for the wick already, the wick is pulled down as the wax sinks, and you can't get it back up again without reheating the whole thing so... don't remove the support for the wick!  You need to wait at least like, 6 hours for the wax to cool, and then fill the sinkhole with more wax, and then wait again, and then fill one more time, and then wait again.  Then you can remove the support.

Lesson learned I guess?  I'm sure I could have gotten that advice from somewhere, but I probably would not have listened, that's just how I roll.  Not proud, just sayin.

the (zombie) hookup

Is anyone playing Left 4 Dead on 360?  I've actually acquired some competence at this game, and I'd love to play with friends.

By way of game review slash encouragement:

This game doesn't do a lot of new things, but it is executed *perfectly.* (in this sense it's the opposite of Dwarf Fortress.)  The sound work is amazing, the graphics are cinematic, and the pacing and level design are flawless.

This is a game that rewards teamwork and severely punishes going it alone.  What I love best about the game is the effortless multiplayer communication.  Your in-game characters talk to eachother, and it's always relevant.  Stuff like, "I'm reloading," or "hey guys I need to heal" or "there's a pipe bomb over here."  Also, "why are you shooting me?"  I don't have a headset microphone for my 360, and I find that with this game I don't miss it.  The team notifications, and being able to see where your teammates are even when they're behind walls, means that a whole layer of basic communication is handled automatically, and well.  

Aside from enjoying the genre, there's something about the co-op experience that I find really addictive.  The only other co-op game I've played that hooked me this well was Natural Selection.  I think what the two games have in common is a focus on co-op interface design; NS does it with the commander and hive sight, and L4D does it with frequent in-character voice cues.  Both succeed because the tools allow you to create great little stories, over and over again, that the whole team participates in.

There's something about being a part of a well functioning team that we humans love (and the social tools we use can make or break the experience).  Some people get this team experience from sports, or from a game like Counterstrike or what-have-you, but I think that what Valve have done with Left 4 Dead is lower the barrier to entry.  Now you can have that team experience without having to have first mastered the game, and without having to ACTUALLY TALK TO ANYONE.  That is impressive.