Skip to content

No more ragging on C++’s “memory model”

A common complaint about C++ is that it’s “not garbage collected” or that it “requires explicit memory management.”  These statements are untrue; C++ doesn’t have a restrictive memory model for objects, it has no memory model for objects.  Each object, by default, allocates space by using cstdlib’s malloc() and free(), but these are just defaults.  You can totally override them, or better yet, template how you override them.  E.g.:

// for java lovers:

template <typename T> class Managed : public T {

/* override new and delete */

};

template <typename T> class ManagedRef {

private:

  Managed<T> *pManagedObject;

/* override pointer operators, assignment, and destructor */

};

// at runtime:

InitializeGarbageCollector();

ManagedRef<CMonster> pMonster = new Managed<CMonster>();

pMonster->roarAtTheVillagers(); 

Best of all, in this system you can restrict garbage-collection to the top-level application objects, but still optimize the shit out of your base system.  Freedom!

Social Contracts for Programmers

Lately for work I’ve been diving more deeply into Win32, .Net, Carbon, and Cocoa, as well as some more traditional web stuff, and I submit for your vehement disagreement a mapping between programming platforms and forms of government.

Win32: Libertarianism

Setting aside the legacy albatrosses in the Win32 API, it’s a pretty lean and straightforward API.  Windows programmers want to do it themselves, so it doesn’t try to do anything for you.  You allocate your own memory and never surrender control of execution; you are at liberty to do whatever you want, as long as it doesn’t hurt other processes right to do whatever they want.  I think that’s why using Windows XP sort of feels like stepping into the Scottish Highlands: everything’s a little out of date and the locals are stubborn and crotchity.

Java/.Net/Managed Platforms: Big Brother Bureaucracy

Managed Platforms accept as read that application programmers will leak memory and waste processor cycles if left on their own, so The Committee has stepped in to review everything.  Does your program have a structure which implies a natural and effective memory model?  Does your algorithm fit nicely inside the processor cache?  Too bad - if it’s not good enough for everybody, than it’s not good enough for anybody.  No, you cannot preprocess your code or overload operators; everyone must stick to the Approved Words.  Every time a Swing Applet takes five minutes to launch, I feel like I’m queueing at the DMV.

Objective-C: Socialism

Apple’s route has been to give you total access, but subsidize certain patterns of behavior.  Let me see here, you managed to normalize a set of data across several different views, and handle all the edge cases to keep their independent representations of the application state in sync?  Good for you!  You know, though, if you’d just named your methods a little more… Cocoaishly… we would have done that glue code for you.  And made it scriptable.  And plugin-extensible.  And gorgeous-looking.  But you know, the choice is up to you.  Your overseas competitors already get subsidies, so, y’know, think it over.

Aside: I’m serious about fricken Europeans.  Why is it that every piece of software I want is always expensive just because the price is in pounds or euros.  Argh!

Web Programming: The United Nations

It seems like you can’t do anything non-trivial in JavaScript without taking a side in an overblown political battle.  It progresses less by adding new features, and more by adding new names and titles for features it should already have.  To be productive you have to use weird framesworks like GWT which feel like expensive international attorneys who speak seven languages.  You watch them perform a simple HTTP GET, and then they give themselves a Nobel Peace Prize.

Python/Ruby/Dynamic Languages: Free-Sex Cult

No comment.

A poignant moment in Megaman 2; the game presents an arbitrary choice.

once you’re out of practice, figure drawing is really haaard

most aimless doodling… don’t know where I’m going with any of this…

draw what you know

cleverness

I watched Alan Moore interview himself, and he said something that struck me, along the lines of “unless you’re actually immersed in the ideas or experiencing the feelings that you’re representing, then you can’t expect your audience to take that away from your story.”  I was taken back to my portfolio review when the panel asked why I pretty much quit illustration half-way into the program and switched to interactive art and animation, and my answer was “that’s the first work I did that people responded to.”  By Alan’s metric, it’s simple.  My artistic goal has only ever been Cleverness.  Based on my limited drawing skill, but highly-exercised analytical skills, it was only natural that programming, as a medium, would enable me to actually be clever with my work.  My audience responded.

I’m not entirely sure I want to be clever anymore.  I don’t think I have anything to add to the overarching social dialog.  It’s basically just self-congratulation.  After all, cleverness doesn’t seem to be the guiding theme in my life right now.  If I had to be totally honest… it’s loneliness, isolation, and impotence.  Sometimes I feel… like being clever is this parlor trick that I’m hoping will spontaneously make me intriguing, and like an elixir or vaudevillian cure-all, take away all my doubt and actualize me as an adult.  Other times I feel like it’s a distraction for me to not have to deal with the fact that my loneliness is the cause of my social anxiety, not an effect of it.

Hrmm.  I thought this post would be more speculative and less personal when I started it.  I guess I had to unload.  Sorry, kids :\

everyone’s lonely tonight

my foil

comickaze sketch

Not really sure what I want to do with this old comic. I think I need to take it back to the original concept - playing with comic formalisms, with a whiff of story to keep it interesting.
the superiority of the spirit is immediately recognizable by its luminous intensity