Got talked into looking at PHP rather than Python.

I really like it: it’s got a lot of the lovely features of the unix shell (heredocument and `), you can have nice structures like

if ( cond ) :

So you can block your code properly. I have always hated the C and Java thing about the closing brace not telling you what’s being closed; this can be a source of bugs that only becomes apparent when you run the code through a formatter. Of course, it also supports the annoying {} as well, which makes it nice and flexible and easy for the Java/C heads to get into. I know you can do stuff like

if ( cond )
// 20 pages of “stuff” (Should only be about 20 lines if you structure it properly)
} // If

I hate this though. Just looks ugly and you have to remember to do it or enforce some really annoying coding standards that people will ignore because they think you’re being too pedantic. By the way, I always place the opening brace under the if so that if you have a mountain of conditions in the if statement you can see where the executable expressions begin. In PL/SQL I do this for the same reason

if cond – no brackets, irritiating things; why do a lot of modern languages pretend to be C?
end if ;

I’m skim reading the tutorials at the moment to get a feel of the language’s capabilities.

I am going to rearchitect my system away from Struts and the like: I think I can just get a move on and get the thing finished quckly in PHP. Like Paul Graham says: the power of the abstractions of a language help you to get the job done and think PHP is ideal for what I need. And there are tons of exellent tools and large well-written projects to look at. There are also lots of nice free editors (including my all-time favourite VIM).

My plan currently is to redo the XML parsing I’ve been doing in PHP (a good learning exercise). Then I will create some self-describing objects that will define how the site is put together. Then PHP will be used to deliver these objects up to the end user. Make a change, regenerate (or maybe just change the XML descriptors), site stays up. That has always been the goal. I plan to use Open LDAP and suchlike for user and resorce management.

It looks loads less hassle than Struts for a small project like mine. I’ve been trying off and on for weeks just to get an HTML form that allows me to update some data, haven’t even got to the XML rewrite capabilities yet. Time to change to more powerful tools that can help me build the tools I need before I die of old age.

Postgres vs MySQL

I prefer Postgres as a platform, even to Oracle, because it is a purer implementation of the relational model. Particularly the ability to create domains, which is central to relational theory, but Oracle doesn’t do it. Types in Oracle don’t cut it, sorry, too fiddly and hard to insert and retrieve out again. Besides, they answer a different problem about composite data types. Problem is I need to run PG inside Cygwin on my XP machine and it hasn’t worked for a while, I discoverd that I need to run something called cygserver but it won’t play. There is now a native Windows version (have a look on the site here) but I need some time to investigate it. I’ve downladed MySQL as a temporary stopgap but don’t like it. Transactions and other stuff you need are relatively new: Postgres and Oracle have had them for as long as I can remember. MySQL is (I believe) mostly in-memory which makes it fast, but what happens when things fall over? Maybe it’s just my old-fashoined, data-centric training making me want stronger medicine than MySQL, I know it works very well for lots of people. I just want something stronger that suits my purist leanings, describe a table and you can see that a given column has a type of ID or Adress_line, you know what it’s for; what use is integer or varchar2(256), where are the semantics? Also change the domain and you know all of the related tables are OK. That is the way it should be done, not by relying on a tool like Designer or some external XML document that is used to generate scripts to align domain-related columns – rubbish, a waste of time and energy.


Whacked 25 old computing books up on Amazon, I’ll give them a couple of months to sell and then bin them. I was holding on to a load of old Unix, Prolog, C programming, Smalltalk, Forth (from 1985!). I also inherited my mother’s poetry collection, which I will sell on too, but suspect that a ruck of paperback poetry won’t sell.

Ah well, off to bed. G’night all.

PS – I suspect I’ll be lookng at Python too, maybe to replace Awk as my text-processing “quickie” tool. Not sure yet.