archives

Reflection in Java: how are they getting with it?

We seem to discuss pretty specific issues lately, so I feel I can bring this one up.

For a PL in which dynamism is one of the selling points, Java has pretty bad support for reflection: reification/introspection/intercession trio.

Reification is crippled by fact that not all concepts have representation, accessible to programs - the one for bytecode (literally an array of bytes) is a joke. This can be helped by libraries, though, and indeed is.

Introspection is limited - for bytecode as well (a program cannot in general obtain a representation of bytecode for the object at hand). That's a more serious limitation, although there are ways around it if you are willing to make some assumptions.

Intercession has another twist - on a positive side, it's possible to obtain classes from bytes (though it was not possible the other way around - funny, eh?), but on a negative side, while introspection had structured representation for some concepts (like fields), intercession knows only byte arrays. Ugh.

I will skip my complaints to representation of invocations, call stacks and threads, as the post is already quite negative.

To drive this towards PL design: how did Java get there? Was it because in early years there was little use for reflection? Why wasn't it fixed? Is it a scientific problem, an engineering one, or maybe cultural? How can newly designed PLs avoid such a fate?

PS: For some users reflection and MOP may be something very esoteric and unpractical, but look at Java "enterprise" open source projects: most of them are just grown from one or other attempt to overcome these deficiencies of the language. Unfortunately, there is a limit on what libraries can do to a PL.

According to Allen Holub programming is now a liberal art. When did this happen?

Allen Holub has written an article explaining quite clearly why neither programming nor computer science is a science. He also does an excellent job of explaining why software engineering is an oxymoron. So far he's preaching to the choir.



However he concludes that if it isn't a science or engineering then it must be a 'liberal art.' Apparently the work we do has more in common with creative writing than with physics and consequently we should eliminate most of the mathematical aspects from undergraduate education in favour of English composition.



I find myself agreeing with many of his initial premises but violently disagreeing with his conclusions especially the notion that: "programming has changed from the study and implementation of algorithms to the study and creation of complex documents."



In my niche, highly complex custom applications for large companies, programming is often as much about solving problems for and with large numbers of people as sitting in a corner typing away. This leads me to believe that an undergraduate education should be focussed on:

  • teamwork
  • learning the sort of basic software development techniques outlined in books like Robert Glass's Facts & Fallacies of Software Engineering
  • discrete mathematics
  • algorithms
  • data-structures
  • building complex software
  • learning to comprehend and change large codebases built by other people with no documentation other than the code

In what ways would members of LtU change undergraduate curricula in what is now called computer science if you had the power?

Perl6 - PUGS

Well there doesn't seem to be a plethora of Perl fans here (I hear Python this and Ruby that...) but I thought I'd mention Pugs. Pugs is an implementation of Perl6, written in Haskell.

While, as mentioned in other recent articles some languages are moving away from powerful abstractions, Perl continues to suck them in. One of the more interesting things they are putting into Perl6 are junctions (which I like to think of as quantum superpositions). Things like that, along with formalization of the object system and other cleanups should make Perl6 a language which gets mentioned here much more often.

The Pugs implementation (in progress) is being written at breathtaking speed. Check it out and lets hear your thoughts!