|
Monday, December 16, 2002 |
ok, now that i've finished reposting my favorite notes, it's time to resume normal operations.
2:41:03 AM
|
|
REPOST
J2EE vs. NET, Java vs. C#:
Since there's been plenty of discussion on these topics, I thought I'd write down my own views on these matters. For the record, just in case someone questions my experience in languages and libraries, I was one of the first adopters of Smalltalk, C++, and Java, taught all three professionally for several years, taught programming languages at UT Dallas, wrote an ORB in Smalltalk, wrote the first portable STL toolkit for C++, wrote the ObjectSpace Systems<ToolKit> cross-platform systems libraries, wrote the JGL generic collections library and the multi-protocol ObjectSpace Voyager Java ORB. And of course, I wrote a good deal of the TME Electric XML toolkit and GLUE web services platform for Java. Sorry for the long-winded introduction, but establishing a strong background in these areas helps to establish a basis for my opinions, and throws out any claims that I am some kind of Java-hater!
Historically, languages build on each other, borrowing the best ideas and then throwing in some new ones. Some languages evolve, some stagnate, and some die. C -> C++ -> C# is a good example of an evolution, and Smalltalk is an example of a language that I loved but is pretty much dead.
C# was designed by Anders Hejlsberg, a long-time hero of mine, the force behind Turbo Pascal and Delphi, and a guy with an obvious talent for language design and implemention. In C#, he's taken a lot of the best ideas from previous languages, integrated some new ones of his own, and come up with a natural evolution of where Java was heading. For example, the ability to associate attributes with any element supports declarative programming in an elegant and powerful way. C# makes iteration simpler and more natural for developers, and auto-boxing simplifies manipulating collections of primitives. There are many other nice features of C# that are covered in several articles I've read.
It's also significant to note that several new C# features have already been proposed and will be implemented soon, making C# one of the freshest and quickly evolving languages on the market.
The Java language, on the other hand, had a strong initial start and then essentially stagnated after Java 1.1. The only new thing in the last 6 years has been the assert keyword, which is not much to write home about. I'm definitely don't like languages that include an entire kitchen sink of features, but C# shows the kinds of features that could easily have been added to Java.
For a while, Sun was sitting in the cat bird's seat with a great lead in the languages and libraries space. Microsoft didn't want to adopt a strategic language that it could not improve upon, so it decided to create its own language that could be evolved at a reasonable pace. Now that C# has gone beyond Java, Sun has got to quickly evolve Java or watch it slowly fade away. I think that IBM realizes this, and I hope that it's working hard behind the scenes to rectify the situation.
It's frustrating but understandable that James Gosling holds disdain for C#. Gosling keeps going on about how C# is a clone of Java, but it's not - it borrows the best from Java and then adds improvements of its own, just like Java improved upon previous languages. That's the way it works, regardless of which company is involved!
Another thing about C# that seems misunderstood by much of the Java community is the concept of "unsafe" code. The idea behind "unsafe" code is that a programmer should be able to access low-level programming constructs without having to clumsily drop into a different language. In Java, you have to use JNI to link with libraries written in a language like C to get at low-level constructs. In C#, you can use the C# language to get at low-level constructs, and code which does this is marked specially so that the executing environment is aware of it and can prevent code flagged in this way from executing. This seems an elegant way of providing the full range of expressive power within a single language, less error prone, and easier to manage.
All that being said, I write my code in Java these days because of its portability.
Enough of Java and C#. What about J2EE and .NET?
The great thing about Java when it arrived was its simplicity and portability. Over time, the J2EE libraries have become pretty complex IMHO. For example, there have been many conversations on various news groups complaining about the learning curve and performance associated with EJB. .NET is definitely simpler than EJB for building server-side components, and so Java badly needs a new and simpler way to build portable and scalable server-side components. This of course is the reason that TME launched GLUE and has been working on its rapid evolution.
The main advantage that J2EE has over .NET is portability. Whether this advantage remains is primarily a business decision for Microsoft. There is no technical reason why the core .NET framework can't be made cross-platform, and several groups are already working on doing this. Heck, CLR was designed from the ground-up to support this! So J2EE is an uneasy situation in which a simple snap of Bill Gate's fingers results in its primarily advantage being neutralized.
The best defense for Java/J2EE is fairly straightforward:
- standarize Java and allow some of the language wizards at IBM and other companies to evolve the language at a similar pace to C#.
- come up with a far simpler server-side programming alternative to EJB
Time is running out......
2:39:09 AM
|
|
REPOST
How do i write books? I was asked this via email a couple of days ago, and rather than just post the reply via email, I thought i'd reply to my weblog instead.
Writing a book is a lot like writing a computer program.
I start by creating a big list of all the information nuggets I want to include in the book. These nuggets can be low level like "what does SOAP stand for?" or high level like "include an example of .NET to J2EE interoperability". This list is usually several pages long.
Then I figure out the most natural presentation order for these nuggets, with companion examples, anecdotes, analogies and exercises to keep the reader entertained. I prefer presenting information in the way that it would normally and naturally be encountered. For example, although I might present a high-level overview of UDDI at the start of a book on web services, I would defer presenting UDDI code samples until towards the end of the book, since most developers rarely encounter the need for UDDI these days.
The chapter sequence for the book usually falls our fairly easily from the nugget sequence. In addition, I like to open a book with a personal anecdote, and end with a chapter with advanced/visionary material, because it ends the book on a thought-provoking note.
I really like small, focused examples instead of multi-page code listings. I personally find long examples that introduce more than one new concept embedded within a morass of irrelevant other code really confusing. For example, some web services books show web services being invoked from inside an applet, and the example code is 95% applet code and 5% related to web services.
My writing style is "relaxed first person", as if I was just chatting with the reader over a cup of coffee.
Before starting to type a chapter, I spend several hours in a coffee shop designing the chapter, figuring out its high level structure, sequencing its information nuggets, and sketching out the examples. This way I know how the chapter will flow and that it covers the right material. Then I write the code for the examples and make sure they include all the necessary points. Finally, I sit down at my computer and start typing.
I find the first few paragraphs are the hardest, because they set the scene for the rest of the chapter and tend to require more careful wording. The rest of the chapter tends to be more mechanical, presenting bits of information with accompanying code samples and dialog. Of course, I always find bugs in the chapter design as I'm typing, and correct them on the fly.
Every hour or so, I print out the current state of the chapter and mark it up with a pen. This is also how I write software - I am very dependent on printers and marking up software listings to accomplish a high quality end result. For some reason, I can't see the big picture efficiently on a computer screen.
I always start with chapter one of a book, which is the toughest. Once the first chapter is under way, the others come easier. I don't write the rest of the chapters in sequence. Many times I write them based on what happens to keep my interest on a particular day.
A typical chapter takes me 3 or 4 days to write, including the source code for the examples, which I think is pretty fast. In addition, the high level book structure takes about a day.
I send volunteers drafts every week or so to get feedback. Don't expect to keep everyone happy, because each person has their own preferred way of receiving technical information!
My first book attempts took much longer than my most recent. I rewrote my UNIX book three times before I was happy with it, and almost gave up in the process due to burn-out. In the end, it got good reviews, was adopted by lots of universities, and made me around $250K, so it was well worth it. My current book on web services has helped to spread our GLUE product into loads of companies, which is also very valuable to me.
I hope this information was useful to someone!
2:38:52 AM
|
|
REPOST
why do animals sleep? this is a question that i pondered about 15 years ago and came up with an answer that i've never bothered to document until today. it's based on a simple premise that i seem to remember reading a while back, but have never really cross-checked. the premise is that individual neurons accumulate waste products during normal operation that they need to "dump" during a resting period in order to continue to function properly. the more waste that's accumulated, the more abnormal the cell operation becomes and the longer it takes to dump. averaged over time, a cell might spend 2/3 of its time working within tolerance and spend 1/3 of its time dumping waste products.
OK, let's say that you buy this premise. how does this lead to sleep and dreams?
well, if every individual neuron independently decided when it would go from normal mode into rest mode, then at any one point in time, 2/3 of your brain cells would be operational and 1/3 would be at rest. now let's assume that a particular cell is more likely to stay in its operational mode if adjacent cells are also in operational mode. this would make evolutionary sense, because if you're focused on a task and 1/3 of your cells are asleep, it would presumably make the task harder. since there is less stimulus at nighttime and typically less tasks to accomplish, a brain would quickly enter into an emergent rhythm in which during the daytime, *most* cells would probablistically be awake and at nighttime *most* cells would be at rest, dumping waste. note that these are only probabilities, and there's still a finite chance that during the daytime portions of your brain would be at rest, and a finite chance that during the night some portions of your brain will awake. in addition, the probability of portions waking up during the night rises as the cells dump their waste products and increase their chance of entering waking mode.
as the majority of cells enter the saturation phase of waste, you'd expect to see a fairly rapid collapse into sleep mode, since when a cell goes into rest phase, it stops stimulating its neighbors and makes it more likely that they'll also go into rest phase.
during the night, most cells would initially go into rest phase, dumping waste products. but as the night progresses and cells being to "lighten their load", the probability that cells will transition into operational mode begins to rise. mathematically, there's a good chance that various subsets of a brain will spontaneously go from sleep mode to operational mode and back again throughout the night, with the probablility of the entire brain going into operation mode by the morning rising to one.
when one or more subsets of your neurons go into operational mode during the night, they form a mind which is missing the parts that are still sleeping. a dream is the thoughts and memories experienced by this subset of your mind, and its content will vary based on which bits are awake.
for example, say you are partially awake and you hear an alarm clock. an awake portion of your mind might associate the alarm with a police siren, and another awake portion of your mind might extrapolate this to the possibility that you are in a car chase. the bit of your brain that would normally suppress this possiblility with the higher likelyhood that it's simply your alarm clock happens to be asleep, and so the waking part of your brain rightly operates with the highest probability deduction that is available to its parts, and you dream of being in a car chase.
dreams are many times abstractions of an underlying concrete concept/problem in ones life. this makes sense, because if a set of, say, 10 parts of your brain represent and constrain a complete concept under normal operation, and then you send 3 parts to sleep, the remaining 7 parts would tend to represent an abstraction of the original concept (as you remove constraints one by one). for example, the concept of a chair might be represented by a simultaneous contraining of the mini-facts: 1) 4 legs, 2) has a back, 3) wooden, 4) on the floor, 5) seat, 6) 5 letters, 7) begins with "C". if you remove the constraint (3), then you might also end up with a camel. if you remove constraint (3), (6) and (7) then you could also end up with a table or elephant. in general, the higher the ratio of asleep-bits to awake-bits, the more abstract your dreams should be.
2:38:36 AM
|
|
REPOST
here's a little monologue entitled: "the future of humanity, and how i'd spent my money if i was as rich as bill gates".
one of humankind's top priorities should be to colonize other planets. why? well, besides being an incredible interesting and challenging thing to do for all involved, it's about basic survival. viewed from space, it's apparent that life on earth lives in a tiny little ecosystem that forms a super-thin layer around the planet; a layer that could easily be obliterated by a variety of causes such as a stray meteor, virulent biological weapons, world war iii, etc. it would be a shame if billions of years of evolution went down the toilet because of a single catestrophic event.
one obvious defense against this unpleasant end is to colonize other planets (followed of course by interstellar travel, but that's another story). this costs lots of money given the current state of technology. one day, breakthroughs in rocket motors and other related technologies will make space travel affordable in the same way that cars were initially expensive but then became much cheaper. in the meantime, earth relies on nasa to provide the leadership to move into space.
i think it would be great if the top 100 rich people in the world got together and decided to fund their own independent space initiative, independent of nasa, and hire the best people to create and implement a plan to colonize mars. not only would these people have a blast (literally) being part of such a grand plan, but they would go down in history as founding fathers of the first non-earth colony. and i bet with the resources and drive that such people would have, they'd do a far better job than nasa ever could.
my bet is that someone like bill gates would find a deep and profound satisfaction in being part of such a grand plan, and that a founding father of mars would be remembered in the history books far longer than a founder of microsoft.
wouldn't it be great to watch such a daring schema in action?
come on bill, go for it! ;-)
2:38:08 AM
|
|
REPOST
one of my favorite topics is the future of humanity, especially over, say, then next million years. it's interesting that most science-fiction movies have humans meeting other animals that look similar to us, usually living on planets, flying around in space ships.
in many ways, i think this is unlikely.
frankly, biological life forms are the least suited for space exploration and long term existance. why? because they're fragile, have short life spans, and are limited in their physical and mental capacity. assuming that it's possible to figure out the essence of intelligence and then create it in a more advanced substrate (such as an electronic medium), it should be possible to create a lifeform that could live for a very long time, duplicate itself and/or its knowledge over large distances via electromagnetic waves. in addition, you could create all kinds of custom senses that would be natively integrated with the organism, going way beyond our basic complement of ears, eyes, nose, mouth and skin.
another bonus would be that it wouldn't have any particular constraint live on a planet. if you think about it, living on a planet is probably one of the most restricting and pointless thing to do. planets are gravity wells that require loads of energy to do simple things, they're blocked from direct access to stuff like solar energy, and they have a pre-configured trajectory. living natively in space would seem like a better thing to do.
one way to live in space would be to seed it with an outward-expanding, self-replicating shell of probes that would move close to the speed of light. the probes would act like a passive substrate, with transceivers for sending and receiving electromagnetic life forms. the life forms themselves would then move between the probes via electricmagnetic waves (such as lasers, radio, etc.) at the speed of light. the lifeform would thus expand into the universe at about the speed of light.
you can view the probes as neurons and the lifeforms as pulses between them. sending the probes out is like building the brain, and sending the lifeforms out is like discharges between the neurons.
2:37:02 AM
|
|
i reinstalled radio without copying across the files, and my old content is now hosted in the cloud but not available from my home page. this sucks. i definitely think there should be a simple way to reinstall radio and then resync with whatever's currently in the cloud. anyhow, i'm going to repost a couple of my favorite notes so that they're available from my new blog.
2:33:10 AM
|
|
it looks like the european union is about to expand and absorb another 10 countries. it's somewhat like the formation of the US - a patchwork of individual entities united through common policies. i wonder what's going to happen to Russia? will they remain alone, or join EU in the end? another bizarre but thought-provoking twist would be if they joined the US instead!
2:27:25 AM
|
|
just got back from a 3 day trip to D.C. and Boston. brrrrr! i was planning a xmas trip to see my brother blair who is a naturalized australian citizen living in sydney, but the cheapest economy airfare i could find was $8,000. so it looks like it's going to be a hacking xmas in dallas instead. shame, because i was also hoping to drop in and say hi to the atlassian guys who brought us JIRA.
2:22:34 AM
|
|
currently porting the GAIA P2P active data store to .NET, accompanied by the music of ABBA, Jean-Michele Jarre, and OMD. having a single source base that simultaneously supports every version of the JDK as well as the .NET/CLR is a great exercise in decoupling!
2:19:52 AM
|
|
© Copyright 2003 graham glass.
|
|
|
|
|
|
December 2002 |
Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
|
|
|
|
Nov Jan |
|
|
|
|
|
|