« November 2004 | Main | January 2005 »
December 26, 2004
Merry Christmas vs Happy Holidays vs Saturnalia
This Christmas I noticed for the first time the use of the term "Happy Holidays". I cannot find who created this term. It is closely related to the term "Happy New Year", so I suspect it came from that. Ideas often take some time to make it to Australia. It seems this trend started in the US in the 1990s. So as not to offend non Roman Catholic derived faiths, the religious aspect is evacuated from all references to the holiday.The history of the Christmas Holidays
The reason I say Roman Catholic is, that it was brought to my attention in the Sunday service at St John's Anglican Cathedral (which welcomes all denominations and faiths) that Christmas fits into the ancient Roman festive season of Saturnalia. This festival started as a celebration of the winter solstice and then expanded to the latter part of December. Romans would give good-luck gifts and place trees with candles in their halls.5 January Anyone?
Orthodox and Eastern-rite Christians don't celebrate Christmas on 25 December, but rather the 5 January. Why? They still follow the Julian calendar. In their calendar our 5 January is their 25 December. The history of calendars is itself fascinating. In my blog entry The metric system: a case study in technical standard setting I discuss how hard it is to change standards once they are in. The Gregorian Calendar standard still has it's holdouts.Enter Multiculturalism
The western liberal democracies enshrine in their constitutions freedom of religion. Christians should be able to publicly say Merry Christmas to each other. As should others with of Ramadan, Sarvasham Eakadashi and so on. Secularists can say "Happy Hoidays".Secularism
A key idea behind western liberal democracies is the separation of church and state. Religion and governance should be completely separate. Where the water gets muddied is when there is a majority of one religion in a democracy. Then the flavour of that democracy follows from that religion. Contrast India with Australia, or Malaysia with USA. Perhaps the problem is that in a secular system, there should be no holidays for religious festivals at all.The politically correct thing
What seems to be getting played out in Australia is the systematic banning of all Christian symbols from our schools and public life. Santa Claus is banned from our local play group and school. Christmas becomes Happy Holidays and so on. The French have come under attack for banning headscarves in schools. However they actually banned all religious symbols, whether they be Christian, Islamic, Jewish or others. They are motivated by a desire to integrate their various cultures and faiths into a peaceful country. So, I think either all religious symbols and references should be barred from public life, or I am going to keep saying "Merry Christmas".Posted by gluck at 06:27 AM | Comments (1)
December 20, 2004
6 Kg of Vegemite
The Luck family are off to the United States for a year. I am doing an exchange with my company. There is a lot more involved in going to a place for a year than in passing through as a tourist. We have relatives who have gone over on a defense exchange. They shared their horror stories and we are thus prepared. Perhaps the best advise I can offer is to talk with someone who has just done it. An example. You cannot get car insurance unless you have a driving history. We have gone to the Queensland Department of Transport and gotten official extracts of our driving history. This is an example of a requirement difficult to predict in advance. In a nutshell, there is little distinction made between you, resident legally under a Visa, or an illegal immigrant. From the point of view of most companies you are an alien without any US domestic history. Leasing a house, obtaining insurance, and many other things that are trivial in your home country are major issues. More on this once I get there. We are being defensive about this. In particular we are concerned about Vegemite. For those of you (the whole world outside Australia) who have not discovered the joy of Vegemite, click [here](http://www.vegemite.com.au/). We worked out our consumption was 500 grams per month; therefore we need 6 KG to last the year. Fortunately, the supersize jar of Vegemite is 1 KG, so we only need 6 jars. We also need to consider the few weeks we are travelling. We have a special 250 gram tube of Vegemite to get us through.Posted by gluck at 06:14 PM | Comments (4)
December 06, 2004
The BileBlog, without the Bile
The last week I have been corresponding with Hani, the writer of the BileBlog, without realising it was him. The BileBlogger seemed to know a lot of people that I know so I thought:- a) he must be based in Europe, or travel to Europe a lot and
- b) would in turn be known to my European contacts.
Issue 1: Developers Vs English - or why documentation is important
I agree with this blog. Code is about precise communication with a machine. Documentation should be the same, but with your users. Who are your users? For a business application, like I get paid to write by day, it is the business employees. They are generally communicated with via training. For a web app to be used by the public, your communication needs to be done via Usability. We have a Usability Engineer who conducts usability research. It is so they can use the web app without needing documentation. The interface must be extremely intuitive. With a Java library, like for example ehcache, the users are other developers. Communication with them can happen in the following ways:- The code itself, which should be eminently readable. A tool like checkstyle can help with that
- The sample code, or tests, if it comes with these. These demonstrate how to use it.
- The JavaDoc. The quick view CTRL-Q in IntelliJ will explain just what a method is about.
- The documentation.
Issue 2: Tending to Mediocrity - or why open source quality is generally low
The thesis here is that a low quality open source project comes about as follows:- There is a low barrier to entry to create the project in the first place
- Democratic management of the project leads to a jumble of voices
- Patches and suggestions get accepted far too readily
- The result is a low quality mish mash
Issue 3: JUnit bible thumpers - or why the dogma?
Hani's point is that before JUnit and XP, quite a few projects got done. Successfully. An industry existed that knew how to build quality software. They used testers, or QA Engineers. Look at my open source projects, and you will see that each comes with a comprehensive JUnit test suite. I think it is a useful approach. My problem is with the JUnit zealots out there. I think that often they don't understand testing at all. We have a tester at work who has just gone through training. He has a wall chart which defines about 100 different types of test. A Unit, or Component test is just one of these. But most JUnit developers use the term loosely; they really mean a Unit Isolation test. Any other type of test, such as a Unit Integration Test, is anathema to them. Because it is hard to do Unit Isolation tests in J2EE, they say, let's get rid of J2EE. Don't use any frameworks that get in the way. To me, that is throwing the baby, and the bathtub, out with the water. I was trained in statistics and auditing. Testers are after a similar thing to auditors or statisticians. Trying to prove assertions based on a sample size less than 100% of the population of phenomena. In the case of testing, it is the lack of flaws, of many different types, in the system. The tester today talked about doing an Installation test. That is where we do a dry run release, including all the database scripts, to see if there are any release problems. Makes sense, right? But it is not a JUnit Isolation test, so to JUnit zealots it is meaningless. I am quite frustrated with the dogmatic responses I get to this type of argument. I am currently refusing to debate testing, including Unit testing, unless those involved have read a testing textbook. I have a great one on hand, Lessons Learned in Software Testing: A Context Driven Approach by Brett Pettichord. Incidentally, I have met Brett. Brett's book, and Brett, are a welcome breath of fresh air. We should be trying to produce quality software for a reasonable cost. So that the client gets maximum Net Present Value. (Yes, NPV is a Business Finance term, but it models very well how business's think and what they value). So, in testing, Unit Isolation White Box testing, is one of about 100 tools in our arsenal. Treating it as the only tool is wrong. As the saying goes: "When all you have is a hammer, every problem looks like a nail". A comment in defense of JUnit. A suite of automatic regression tests, with high coverage, support safe refactoring of the code base. This benefit is less about testing in the sense of producing a high quality output, than in enabling developers to make changes without fear. In this sense tools like JUnit are very valuable. I am also likewise concerned about the state of JUnit. JUnit has been inactive for 2 years. A few months ago I got together a coalition of about ten developers willing to work through the reported bugs and patch list to bring JUnit up to date. I volunteered to take over maintenance of the project, along with the team. Eric Gamma, Kent Beck and Eric Meade considered this, but in the end decided they could continue to commit energy to the project. A look at JUnit CVS shows that they have been busy working on release 3.8.2 for the last few months. Great news! Update:Some people asked where the estimate of 100 testing types came from. Have a look at these two testing glossaries. Looking through one of them I counted 68 different types of testing, one of which was Unit Isolation Testing. Thanks to Jules Barnes, our lead tester, for these links.In Summary
- Documentation is vital and should be treated seriously
- Most Open Source projects are of low quality.
- JUnit is a tool for Unit Isolation White Box testing, one of many testing techniques which can all produce quality software. It does have a special role supporting refactoring though.
Posted by gluck at 08:33 PM | Comments (3)
December 05, 2004
The metric system: a case study in technical standard setting
I have just finished reading The Measure of All Things : The Seven-Year Odyssey and Hidden Error That Transformed the World. It is a fascinating case study in how international standards are set. As of 2004, the only countries in the world whose official system of measures is not the metric system are Myanmar (formerly Burma), Liberia and the USA. It is a fantastically successful international standard. In the US, Congress passed the Metric Conversion Act of 1975, calling for voluntary conversion. Amendments to the Act in 1988 designated the metric system as the "preferred system of weights and measures for United States trade and commerce." In the US it is legal to use but not mandatory. Before France's revolution, its' academy, very much an analogue of England's Royal Society gained prominence. It was the age of rationalism and the scientists were pushing for measures which simplified scientific calculation. Think of them as the geeks. At the same time the King was worried about unrest due to lack of grain. Think of him as the suit. France had a babylon of local measures. Each city had measures morticed into the town hall walls. There would be one for a barrel, one for measuring grain, one for measuring cloth and so on. There were hundreds of measures for each item, totalling thousands of measures across France. It was very difficult to create contracts or conduct trade. As each market had its own measures, it made it difficult to compare prices between markets. The local aristocracy charged a fee to use the local measures. As a result each market was a monopoly. The King was interested in a uniform standard. Nothing more. The idea of a completely arbitrary standard was anathema to the Academy, who thought that it should be based on an invariant, like 1/10000000 the length of the meridian from the North Pole to the Equator. Why this? They already knew this would give a measure very close to a length measure already used in Paris. The King reluctantly agreed and a surveying mission to measure the meridian from Dunkerque to Barcelona. The idea was to measure part of the meridian and then extrapolate the result, based on the idea of the Earth as a regular ovoid. The two chief surveyors were Delambre and Mechain. In the seven years it took to complete the survey, revolution and counter revolution took place. At the end Napoleon was in charge. Though there were changes of government, each government wanted to advance trade. The new idea of nation engendered by the French Revolution needed means of defining the nation. Indeed the metric system has often been adopted when countries have become independent (e.g. India and Chine). Ultimately it was found that:- The Earth is not a regular ovoid, so the extrapolation was impossible
- That plus Mechain's fudging of his data, caused the metre to not be 1/10000000 of the quarter meridian.
- The metre turns out to be an arbitrary standard afterall.
- The standard should appear to have technical merit and appeal to geeks, even if it secretly doesn't
- The standard will need an economic rationale for adoption
- The standard should appear to be neutral and not favour any one party
- A meeting representing all should be held to agree on. Those not represented will inevitably resist it.
- The standard needs an exact specification. The metre has been revised three times and its specification tightened.
- The standard needs a standards body.
- The standard needs easy availability of implementations. (The French produced millions of metre rulers each year)
- Compliance needs to be audited and enforced.
- Once the network effect kicks in the standard becomes viral and achieves dominance
- The old standards, though rarer, will persist for a long time
- A standard that works well enough is very hard to replace. E.g. the US imperial system
Posted by gluck at 06:45 PM | Comments (4)
December 04, 2004
SimonSays: A stretch reminder program to cure those stiff necks
I finished the first Java version of a program recently which reminds programmers and other continuous computer users to stop and stretch. Versions are available for Mac OS X, Linux and Windows. It is the Java reincarnation of a commercial program I wrote years ago and sold quite a few copies of.
It took me three years of part-time effort to complete the new Java version. It was started on JDK 1.1 and finished on JDK 1.4.2. Over that time Java has matured enormously, and made it a lot easier to create a smooth desktop application. Simon has been developed primarily on Mac OS X and Linux. Mac OS X has also matured as a Java platform and I finished the application on IntelliJ.
If you supervise people there is a problem getting them to stretch regularly. On our project we now have four people who have their own chairs and regularly see physiotherapists. Yet a better approach is to develop healthy habits. These include posture, particularly seating position, and regular stretching.
Simon Says pops up at predetermined time intervals. Simon, our cartoon character then guides you through an animated series of stretching exercises . It logs your exercises, so when you get that stiff neck you can go back and check whether you have been streching, or not. When the exercise program is completed it sleeps for a set time after which it will pop up again with another program to run.
There are more than 100 exercises which exercise most parts of the body organised into programs. For example, stretches can be selected for cervical spine, arms and wrists, thoracic spine, lumbar spine etc.
All exercises were designed by a sports physiotherapist. They comply with modern ideas on stretching taken from phsiotherapy and pilates. If you have a phsiotherapist no doubt they have already recommended regular exercises. You can find these in SimonSays and get it to run them for you.
The configurability extends to running speed, frequency of pop-up, whether to get audible beeps and the times you want it to run.
There are four program types:
- Preventative Stretching - for general prevention
- Parts of the Body - for stretching a specific part of the body
- Custom - any combination and frequency of the more than 100 exercises in SimonSays
New in the Java version is:
- Preventative Stretching- injury prevention exercises for the workplace
- Create custom exercises
- Allow multiple users to each run Simon Says on the same computer
- Creates a log of exercises for future reference
- Now includes more than a hundred exercises
- Comprehensive Guide to Common Conditions and injuries
- Added the following platforms: Mac OS X, Linux and XP
SimonSays is commercial software. It took me thousands of hours and I would like some return for that effort. The price is USD40 or AUD60 with volume discounts.
You can get a 30 day demo here.
For more on SimonSays see simonsayssoftware.com.au.
Posted by gluck at 03:33 PM | Comments (1)
December 01, 2004
Threads as a metric of the scalability of Java Virtual Machines - by Operating System
The scalability of a JVM depends on: - maximum memory - maximum number of threads - garbage collection - a host of miscellaneous factors. In this survey I look at the maximum number of threads. It shows that Linux is by far the superior Java platform followed distantly by Windows and then Mac OS X. The test is included along with JVM and OS settings so you can confirm the numbers. I focus on threads because it is one of the hardest things to pin down. It is also important because: - it tells you how many threads your app can support - you can predict how long your app can run if it has thread leaks Thread leaks are not as rare as they sound. Sun's JMX Remoting library, which is now standard in JDK1.5 has a slow one, for example. A Test ==== Download the attached thread-test.jar. Standalone --------- This will tell you what you JVM can do if it is not doing anything else. To run the test standalone: java -jar thread-test.jarEnables a thread-local allocation buffer. Using the buffer allows for more scalable allocation for heavily threaded applications, greatly increasing allocation performance. It is on by default on multiprocessor computers and in Mac OS X Server.It seems to have no effect on my dual cpu PowerMac. There is also a setting
-XX:ThreadStackSize=size in KB which changes the thread stack size from the operating system’s default size. Once again this has no effect.
Windows XP Professional
---------------------
7200 threads.
The JVM -Xss stack size entry permits larger stack sizes than the default 256k, but not smaller ones. Therefore 7200 was the default and maximum.
Linux (Redhat 9 or Fedora, 2.4 kernel, NPTL)
-------------------------------------
java -cp thread-test.jar com.wotif.jaguar.threading.ThreadManualTest 20000
gives 3042 threads
java -Xss100k -cp thread-test.jar com.wotif.jaguar.threading.ThreadManualTest 20000
gives 16359 threads
The default stack size in Linux is 512kb, thus the 3042 threads by default. The stack size can be set lower. We run in production with the 100kb settings which works fine. It gives a maximum of 16359
64 bit Linux 2.6 (Fedora Core 2) JDK1.5.0 64 bit
----------------------------------------
java -client -Xss100k -Xms800m -Xmx4000m -jar thread-test.jar 100000.
The machine has 4GB of RAM.
32236 threads can be created. The limiting factor is memory, as each thread was set to use 100kb.
Analysis By Operating System
==================
Mac OS X
--------
Mac OS X has a current JVM (1.4.2) which seems to work very well. They do not however include the server hotspot VMs in their offering and do not provide as many tuning features. The smaller number of threads seems to indicate a default stack size of 768kb. It is not clear how Mac OS X would go as a J2EE server platform.
Linux Analysis
------------
The JVM for Linux is very tunable as is the OS itself.
To produce the maximum number of threads: Use -Xss100k. Increase the user process limit. e.g. ulimit -u 20000 Increase the kernel threads-max setting e.g. echo 20000 > /proc/sys/kernel/threads-max
The 64 bit JDK1.5.0 on 64 bit Linux is scalable limited only to memory in the testing I did.
Linux is clearly the superior OS :) The Meta Group released a report in February predicting Linux would be the dominant J2EE OS by 2006. Its superior stability and superior scalability and tunability are all reasons why this is happening.
Windows
-------
Windows performs ok. It would be interesting to find out if it is tunable to run larger numbers of threads.
Likely In-Application Results
=================
While I was able to get 16359 threads running the thread-test.jar on its own, when I ran it from within a loaded J2EE app I work on, the maximum it could create was about 1100. Together with the application's 300 odd threads this have a total of about 1400.
Exceeding Your Application's Maximum Thread Count
---------------------------------------------
If you exceed the maximum thread count for your application, the JVM will terminate with an OutOfMemory Exception.
Why? Well, when the JVM goes to create more threads, it first sees if it can allocate the memory for them. That's why an exception which should be someting like "CannotCreateAnyMoreThreads" Exception is an OutOfMemory Exception.
Predicting the Maximum Number of Threads
-------------------------------------
The formula is: available JVM memory / Stack Size.
Available memory is total memory less the heap less a list of other things (which seems to be around 500MB).
As you app grows and consumes more memory you are able to support fewer threads.
Get the thread test here: Download file
Posted by gluck at 08:00 PM | Comments (3)
