Posts filed under 'Tech'
After spending a lot of time designing software, you get a sense of where your data and functionality lie within a system. Hopefully, you’ve encapsulated the right data in the right classes or its time to start refactoring! You know when you’ve got it right, because there is a balance between the size of the class, its openness and its flexibility.
I call this elegance, and I think its a property that extends to people systems as well as software systems.
One of the central ideas in software design is the principle of least privilege, which says that you only allow code as much authority and resources as are necessary to complete its task. Even Microsoft knows this (although some might say they learned a little late). This happens at the operating system level (though user permissions, inter-process protection, hardware abstraction) to keep processes from interfering with eachother. This happens at the object level, too: class interfaces exist to encapsulate data and functionality, this time its to protect objects from becoming corrupted from improper use.
When you have too much privilege over data or functionality (a large class, the root user, etc…) the principle is broken, and the system is prone to instability or attack. When too much responsibility rests with one component this exacerbates the smallest problem with its implementation (i.e: a bug in important code is much worse than one elsewhere). On the other hand, when there is too little privilege, the system becomes brittle and inflexible, difficult to extend. When the balance is right you have flexibility, robustness and elegance. Elegant code is almost always concise code, which means less wasted resources.
I think the same applies (with slightly different terms of reference, of course) to systems of people, i.e: government. Apparently, John Locke wrote about the principle of least authority over three hundred years ago, and informed the writers of the American constitution (and I just thought he was a character in a TV show
). And I think the same conclusions apply.
When a single person or small group of people have too much authority over people or money or services, they become a liability for abuse or attack (like ID fraud). Of course, its possible to have such a system run smoothly, but people, like code, have flaws (bugs). And flaws in important people (or people in important systems) are more damaging than flaws elsewhere. This is inefficient because the government invests a lot of time and effort into maintaining its own power (by spying on the citizenry, for example). To go to the opposite extreme, too little authority in the government would prevent it from safeguarding our rights, collapsing into randomness, possibly anarchy. Then “government” would have to be carried out inefficiently at the individual or local level (vigilantes).
To carry the analogy to its logical conclusion: for elegant, efficient government the balance of privilege / authority has to be right. Everyone must have the authority and resource to do their job, but no more. Unfortunately, as I blogged earlier, I think we’re already off-balance.
Forgive me for looking at this in terms of software, but, as the saying goes, when you have a hammer, every problem starts to look like a nail. And maybe thats the problem – our PM has a legislature, so every problem starts to need a new law.
March 29th, 2006
Just upgraded this blog to WordPress 2.0.2, which is cool. At least I didn’t have to throw away my theme like I did when I upgraded to 1.5. I like this blix-based theme anyway.
Yeah, yeah. I should be in work, but I overslept because I thought it was an hour earlier, or later, charmed, strange, whatever. BST always has this effect on me…
March 27th, 2006
The Dream Multimedia DM-7025 is possibly the coolest thing ever. Notwithstanding my previous post about the desirability of the Humax 9200T, the DM-7025 is far, far cooler. Let me give you the highlights:
- PowerPC processor
- Linux
- Ethernet port
- 2 DVB-T tuners
- HDD
So it would seem that it is the perfect platform – you could probably reflash it and put a web interface on it to set the record function over the net. Very, very cool.
The downsides to all this (because there have to be some, obviously) are that the DVB-T version doesn’t seem to be available yet and the DVB-S version costs about £400. Given that you could buy a whole computer and outfit it with dual cheap DVB-T cards (these apparently work in Linux) and a 300Gb HDD for about £360, it doesn’t seem worth it…
March 20th, 2006
Last weekend I went for an eye test, proving that I’ve become blinder in the past few years… (Yeah, I know. I should have an eye test every year…) So this weekend I went to get new glasses. Now I am poor.
I understand that glasses cost quite a bit of money, and I’m not complaining – after all; I prefer to be able to see than not. But there’s nothing like spending the better part of a grand to make you feel simultaneously excited and guilty.
I was going to blog about the new laptop I was deciding to get, but it’ll have to wait now. Which is probably a good thing, as the new Intel Core Duo laptops look very good – they’re breaking the 5 hour battery life mark with twice the processing power of previous laptops. The Averatec 1050 looks very nice, if it weren’t for the horrible burgundy colour lid (it isn’t dual-core, though). So, while I save up again, I’ll have plenty of time to decide which, if any, of the new Intel-based laptops are good.
Mind you, I did get some prescription sunglasses. They’re always very expensive, but I’ll look so cool
February 26th, 2006
Literate Programming, or LP for short, is this wonderful idea that instead of writing computer programs with embedded comments, we write documents with embedded programs. This seems like a great idea and it is, but it seems to be universally poorly executed.
First there is the original CWEB, the LP system invented by Knuth to write TeX. The idea is to embed C/C++/Java fragments into the main TeX body of the article or report. This is nice because (almost) everyone agrees that (La)TeX is the nicest thing to write technical documents. And its revision-control friendly as well. However, trying to read a CWEB document is quite painful and mainly seems to consist of lots of `@’ symbols.
Then someone simplified and came up with noweb, but it seems to suffer from the same sort of `@’-itis.
Various people seem to have tried, at one time or other, to define LP schemes based on XML, but they end up looking even worse than CWEB.
Why is this nice concept so hard to translate into practice? Certainly one reason is editor support – the code fragments need to be highlighted and indented the same way as it would be if I wasn’t using LP. Currently with the emacs CWEB support this isn’t the case. Another reason is the evolution of code: I want to be able to write a report for each change set I make to the code. That doesn’t mean I want a report for each commit, but for each consistent set of changes, explaining the functions of new classes and files, but also the changes to old ones. This means my LP system needs to handle partial files and documentation as well.
Perhaps it would be better to include the documentation within the comments within the source, similarly to JavaDoc/Doxygen. The LP system would then have to be aware of the language, recognising documentation before classes and functions as different from that within the code body.
Maybe LP is entirely unnecessary if we all just commented a bit better?
PS: Happy Christmas!
December 25th, 2005
I’ve been doing quite a bit of XML over the past month and learning a number of things that are, perhaps, too arcane to ever be useful. Not to say that XML isn’t powerful, because it can be an extremely good tool in the right circumstances. Take, for example, XSLT, a markup for describing how to turn some XML into differently arranged XML, which seems quite benign and useful. Maybe its just my paranoia, but does it have to be Turing complete? Will XML become self-aware and take over the world?
Will we be able to type </skynet> ?
December 24th, 2005
The Humax 9200T PVR is available from Dabs for £210. Not only is it a good digital TV PVR with two tuners and a 160Gb HDD, but it might be able to support Linux as well. Here is some information that I’ve been able to scrape together from various sites on the net.
The CPU appears to be a uPD61120 “EMMA2″ MIPS-based processor with integrated MPEG decoder. It also seems to have a Philips ISP1581 device USB controller. And a JTAG port, but I’m not sure if you’d have to wire it up manually. This information is visible in string data sections of the Humax firmware, but if anyone could confirm it and find out what other chips are in the box..?
It seems ripe for a Linux port with MythTV or Freevo. This might be difficult, but the possibility is there: linux-mips has support for VR4111-type chips, MythTV and Freevo provide the user-land control software. This assumes that the two tuners in the 9200T are in the many supported by LinuxTV, the Linux DVB tuner drivers project.
Seeing as Christmas is coming, I could be tempted
November 26th, 2005
Rachel announced that she’d like to use LaTeX for her thesis, which (in my humble opinion) is a very good idea. So, given that the whole “typing commands” interface is a bit overwhelming, I thought that LyX would be a much better option.
I’ve been using LaTeX for years for all kinds of stuff and I find its much better than Word for doing stuff like equations, formatting, bringing together several documents (possibly by several authors) into a cohesive whole. LyX attempts to give a more Word-like interface to LaTeX and, in my experience, is a very nice bit of software. But I’ve only ever used it on Linux, where “apt-get install lyx” is all that is necessary to get it working.
Its significantly harder to get it working on Windows and Mac OS X.
Possibly, a lot of this is not due to LyX itself, but to do with the necessary prerequisites: a working TeX installation. The Mac OS X installation, gwTeX, was a breeze to install as it is based on the i-Installer.app stuff. LyX installed nicely on top of that, but the PDF support was a little lacking. To get nice fonts in Acrobat you have to install the CM-Super package as well and re-run updmap. That took me a while to figure out! Even then, you can’t use pdflatex, as any graphics in the document are defined as EPS by LyX… You can use dvipdfm, but then you don’t get the nice hyperlinking and document structure.
On Windows it seems that the installation is even harder, possibly as Windows doesn’t have many useful packages installed by default, e.g: Python, a shell, etc… So the installation of LyX bombs at the last stage. Mind you, MikTeX seems to be quite easy…
Now, I could probably figure this out, fix the installs, get it working. But wasn’t the point of LyX supposed to be that it is easier to use than plain LaTeX?
October 25th, 2005
It seems that e-ink have actually produced a product… But after so much time things have moved on a bit. And $3000 plus tax is a bit steep for my wallet.
I actually don’t care about colour that much, its the low power consumption and high resolution that are the exciting things.
For most common computing tasks (reading email, browsing the web) there is no need for animated, full colour displays. I’d prefer a computer with a 12″ screen and full QWERTY (or Dvorak) keyboard that folds up to fit in my pocket, with a wireless card and a Li-Ion battery that lasts a week every charge.
And it should be cheap
October 2nd, 2005
Next Posts