Monday, November 24, 2008

Java's Still Great (but where is it?)

To all the Java naysayers: Java isn't dead, unless Mozilla was dead before Firefox. That is, the story's not yet written. I don't know what will happen.

Compared to C++ development, Java is a breeze (except for checked exceptions and no RAII nor operator overloading). Talk about reinventing the wheel 50 times if you want to go C++. And with Java open source, you can even simplify deployment, if you really want.

So, now I'd like to download OpenJDK 7 for my PowerPC Mac Mini running Mac OS 10.4.

Um, I meant, OpenJDK 6. Um, maybe Java 6? Or, well, I guess I'll just stick to Java 5.

Maybe I'm just a beggar and not a helper. But, I'm the sort that would like to do things with Java. I haven't planned the luxury to spend time developing Java itself. And maybe I'm just asking too much? Why ask for support for a computer that's a few years old?

Well, I can download Firefox 3, Flash 10, or Mono 2, and they all seem to work. Looking at all 4 of these players, which one of them is not like the others?

Friday, November 21, 2008

Capitalism as a Local Optimizer?

I remember learning in economics that some folks got a Nobel Prize about 50 years ago for a proof that free markets lead to optimal policies. I wonder if anyone has investigated the assumptions in the proof in the sense that I wonder if it's really just a local optimizer (finding the nearest peak) rather than finding the best global solution (the real top of the mountain).

All proofs about the real world, of necessity, rely on assumptions and approximations. Just wondering what they are here.

I also wonder, because it seems to me like capitalism works well but is short-sighted. I'd be curious if this intuitive feel could be worked out mathematically.

Note: I'm not an economics expert, so I don't know what's been researched on this subject before.

Wednesday, November 19, 2008

Wow, C++ for Flash

Looks like Adobe beats Sun to C++ support, at least in preview release form. They've got Vorbis ported already. ODE, anyone?

Seems like I was thinking about this subject just recently.

Monday, November 17, 2008

How to Supercharge Java

I think certain changes in strategic direction by Java could help it compete far better with .NET, Flash, and browsers. Here are my recommendations:
  • Drop JavaFX and Swing (though I like Swing a lot in certain ways). Move to SWT.
  • Drop NetBeans (despite the nice progress they've made). Centralize on Eclipse.
  • Provide a C/C++ to JVM compiler and perhaps so2jar and dll2jar tools.
  • Provide jar2swf and swf2jar tools, and contribute to an existing or new open-source Flash player (now that the spec is open, right?).
  • Also support GWT big time.

I know enough to understand that many folks inside and outside of Sun would scream a lot if some of these directions were taken. I also don't know what's best for Sun as a company, but gradually losing mind share for Java probably doesn't help them any. Not that I know the stats.

Just some thoughts here, and I could be wrong.

Friday, November 14, 2008

Wiki Math and Language Consequences

I was thinking how cool it would be to have a Wikipedia but with actual usable algorithms instead of human-oriented text. As I thought about it, it dawned on me that MATLAB's one-function-per-file and 'this'-passed-as-first-param notions (generalized in other languages to full multimethods) are just the kinds of things you'd want in such a system.

Also, the idea of generic mathematical concepts (via interface implementation, duck typing, or static C++ templates) leads to wanting fewer versions of the same function, so namespacing issues might matter a bit less.

Still, I think namespacing matters some. Maybe the ability to apply multiple tags to functions would be nice instead of the draconian namespacing of common programming languages. But could you never have two versions of the same function with the same tag? Maybe just multiple matches based on specified desired tags would result in an error. Hmm.

And I was also thinking about how you could imply templates just by not specifying the types of the parameters (again, the static variation on duck typing).

In the end allow translation to C/C++/Java/C#/whatever based on conventions that work well for that language.

I think the math language itself in the wiki would need to look somewhat like MATLAB (and/or Python). And of course, rendering to nice typeset equations online (image or MathML or LaTeX) would be sweet.

If only I had a ton of additional time on my hands.

C++ Templates as Duck Typing

Just remembered the relationship between duck typing and C++ compile-time templates. Writing it here as a note for future reference.

Thursday, November 13, 2008

Enough with Java Ports

Or rather, enough with requiring Java ports. Though I guess the encouragement of genetic diversity has its pros.

I also applaud Jython, JRuby, JBullet, and many more. I was once working on an ImageMagick and RMagick port for Java/JRuby. I didn't expend the time to make enough progress, though I believe it could work out well.

My concern is that the "Java apartheid" coupled with lack of direct support for running C/C++/DLLs directly on the JVM leads to too much wasted effort. And I get the point of how much easier it is to pick up and use a jar (wherever you are) vs. picking up and using native libraries.

There are some (HUGE!) gotchas, but I think it should be possible to run native code directly in Java. Two techniques:
  1. Use JPC as a base for running x86 DLLs (or Linux so files or whatever) as if they were JVM bytecode, or
  2. Compile C and C++ (and others in GCC) directly to JVM bytecode so that structs, classes, namespaces, and so on all map nicely and are directly available from other JVM languages (like Java even).

I'm don't plan to work on this myself, but I think it's a right thing to be done. And meanwhile, I'm tempted to get back into coding C++. (Been a while.)

Actually, I double-dog-dare anyone to make a C++ to JavaScript compiler.

Wednesday, November 12, 2008

Evil MATLAB Copy-On-Assign

Saying this kind of thing is really annoying:

item = items{i};
item.whatever = 'something';
items{i} = item; % <-- The evil requirement.

Maybe I just need to learn the right idioms, but this kind of thing taken to much more complicated software is just killing me right now.

Tuesday, November 11, 2008

Favorite Programming Language Qualities

Here are my favorite qualities of programming languages:
  • Consistent (orthogonal feature set)
  • Expressive
  • Convenient
  • Small (core language features and API)
  • Extensible
  • Safe (encouraging quality code)
  • Familiar (for newcomers)
  • Easy reading for people (for newcomers and experts)
  • Easy reading for computers (toolable, optimizable)

I think some of these tend to work against each other, and some support each other.

Looking at present times, small core APIs (microkernel-ish) sure aren't in vogue. Rather people tend towards "batteries included". Note that a small core should make cross-platform easier to do.

I also wonder if the current trend towards optimizing and tooling dynamic languages will eventually overcome static languages. I think it will be a while yet, but things seem to be moving that direction.

Wednesday, November 5, 2008

TeXlipse - Sweet

Finally remembered to search for "LaTeX Eclipse", and it sure found something. I just got started with TeXlipse (as in, just now), so I might not know all the down sides, but it seems really useful at first glance (autocompletion, highlighting references, BibTex support, ...).

Monday, November 3, 2008

Performance Basics

From my experience, it seems like these are the basics of achieving good performance:

  • Cache.

  • Index.

  • Parallelize.

  • Profile.

  • Simplify/Shrink (without changing external behavior).

If you move to a fuzzier world, these become additional techniques:

  • Approximate.

  • Simplify/Shrink (by changing requirements).

I don't emphasize algorithms, because picking up ready-made algorithms from a third party is so common these days. (Does that mean we actually make progress? I think so.) However, some folks still have to provide said algorithms, so it might apply to you. The same kind of issue applies to being hardware-friendly, I think.

Anything else I'm missing that doesn't fall into these categories?

More Research Bullet Points

Also wanting to track other things on my sometimes-too-subconscious radar, here are additional bullet points to follow up my research mission statement:

  • Good enough now is better than perfect later. Related to performance profiles and satisficing.

  • Multiple strategies at all levels simultaneously, including alternate algorithms. Different kinds of feature spaces in use. Parallel computation to let bests bubble up on different paths. (More on this and the next bullet discussed in my later "prioritized reduction engine" post.)

  • Metathinking. How to decide what to think about. CPU cycles are scarce resources.

  • Software built to be usable by third parties, not just for experiments. Open source where possible.

  • Multiclass assignment ("tagging" in modern netspeak) and fuzzy class membership.

  • Graph structure matching (analogies). Relationship to traditional predicate logic?

  • Ensemble of simple behaviors often better than single complex ones.

  • Allow compromise between behaviors. I might want to rest an injured leg, and I might want to walk somewhere. One doesn't have to rule out the other. I might just walk slowly, more carefully, or less often.

  • Automatic splitting of problem space into different behaviors. (Learning basis functions.)

  • Behavior activation/deactivation based on applicability and thinking resource limitations.

  • Behaviors as semi-peers rather than specific layers. The kinds of controlled actions or perhaps group activation/deactivation might imply layers still.

  • Root behaviors live independently. Some behaviors could spawn others which might be short-lived. Longer-lived behaviors might attach themselves as roots.

  • Hmm. Almost sounds like a hurd of interfaces representing depth of Unix-replacing daemons of interfaces representing depth ... I mean, like a multitasking operating system. No, I've sadly never used GNU Hurd.

  • Simulation is nice, but real world rules.

  • Most things shouldn't require huge hardware. If it doesn't go fast enough, find better algorithms.

  • Be willing to be inspired by biology, but don't get too committed to the idea.

  • Dynamic dimensionality. If sensors or actuators (or intermediate computation results) come or go, the show should go on. Algorithms shouldn't need recoded to deal with extra dimensions.

I've been warned some about watching ideas closer so other people don't steal them and publish first, but I think my chances of being seen by a potential idea thief are low. Until I get super famous (cough, cough) of course. And most people prefer to pursue their own ideas more than those of others.

And finally, I can't do everything anyway. If someone gets cool ideas from me, I guess I'll just have to hope it's something I wouldn't have gotten to.

Finally, this stuff here is still pretty high level. Not exactly a how-to manual. Need to figure out all the how-tos myself first, anyway, if I even get to focus on any of this.

So, um, steal away or something.

Saturday, November 1, 2008

Simple Research Mission Statement

Here's a stab at summarizing a research mission. Focus is hard for me, so this seemed like a good exercise. I'd like to focus on these things:

  • Everyday, general-purpose robots.

  • Real-time, multi-objective, very high (10s, 100s, 1000s?) degree-of-freedom decision making in dynamic environments.

  • Preference to automatic learning over hard-coded engineering. Also, parameter elimination.

  • Extract research from practical application rather than hoping theory will be practical. In other words, how do I know I'm asking the right questions?

Maybe I can refer back to this or post updates (like these bullets) as needed.