I was reading this summary of a talk that Dr. Gerard Holzmann held at USENIX Hot Topics in System Dependability mini-conf on 7 Oct 2012 in Hollywood, California. In it there is a link to what the people in the JPL decided to use as the core of the coding standard: The Power of 10. Yeah, it sounds like a self-help system for addicts, but in fact it is a very smart idea. You see, when you code for the JPL you are talking about code that you will design and test on Earth, then run in space, often years after first developed. It needs to be robust, it needs to be as safe as possible and to make easy detecting problems early on. They tried with a style coding standard, but they failed, mostly because people were not being able to follow all the rules they decided on. Here comes the brilliant idea of taking the most risk alleviating ten coding rules and make it a kind of core of their development style. A form of software ten commandments, if you will.

Some of the rules there are quite counterintuitive. You may check them in link format here and in PDF format here. I was particularly interested in rules 2 and 3: allocate everything you need before you run the program (so eliminate things like more memory allocation or garbage collection) and giving all loops an upper bound (so make sure there will never be an infinite loop). The others are either common sense or already implemented in modern programming languages.

If I were to implement this, I would try to encapsulate the idea of finite loops, so instead of foreach/for loops I would use a class with Foreach/For methods (akin to Parallel). The memory allocation thing is trickier in .NET. The idea of garbage collector is already built into the system. The third rule in P10 says "Memory allocators, such as malloc, and garbage collectors often have unpredictable behavior that can significantly impact performance". I wonder if there is any way to quantify the performance losses coming from the framework memory allocation and garbage collection. As for disabling this behavior, I doubt it is even possible. What I could do is instantiate all classes used for data storage (all data models, basically) I will ever need at some initialization stage, then eliminating any usage of new or declaring any new objects and variables of that sort. It kind of goes against the tenets of OOP (and against P10's rule number 6, BTW), but it could be interesting to experiment with.

What do you think? Anyway, feel free to ignore my post, but read the document. People at JPL are not stupid! I loved this minimalist idea they used: just reduce all coding rules to the more important ten.

and has 0 comments
In January 2016 SpaceX made history by landing the first stage of a rocket that they have just launched. I know, Blue Origin did it first, but SpaceX rockets are designed for GEO orbits, while Bezos' reusable rocket is for LEO, so different animals. However, they have tried doing the same three times, last time just yesterday, only landing on a special barge at sea. Each time this have failed. But let's watch the three attempts, see what's going on.

First time, a year ago, January 2015, you can see that something was wrong with the way the stage came down, it was already angled and the horizontal speeds were really high.


Second time, three months later in April 2015, it almost got it right:


Third time, yesterday, 18 December 2016, it actually landed, then a landing leg gave out:


But what happened? Each time the stage reached the landing spot, each time in a vertical position and with low vertical speeds. Every time the engine exploded it did when the stage tried to stop and fell over. Wouldn't a specialized grabbing mechanism have prevented some of these accidents? Maybe even the first one!

Now, I understand that the purpose of SpaceX is to have a first stage that can land anywhere, and so they must rely on their device only, assuming nothing of the landing site, but once they go through the engineering issues, just catch it in a net, intersect three metal cables to support the upper part of the stage, do something. Look of those things, slowly falling down: you want to jump and catch them, like you would a drunken friend. Make your rocket understand it's not alone, Elon, that it's got our support! :)

Seriously now, I can't even imagine what would happen if the wind started blowing harder while the rocket tried to land on the barge. Since you have a specialized landing vehicle, make it better. The rocketry is fine, it is time to work on the support infrastructure with just as much aplomb and creativity.

and has 0 comments
This is how reality stands right now: even if the danger of an asteroid hit is great, the risk of one hitting is small. That means that they hit (very) far apart and cause a lot of damage. Now, all governments in the world are run by politicians, who are by their very nature bureaucrats. They are reactive, not proactive, and they have insulated themselves from responsibility by manipulating laws and creating committees and departments that they can behead at any time, as they keep their fat asses on their chairs of power. This is not a rant, it's just the ugly truth, evolving, but never really changing since we were barely smarter than monkeys.

The logical conclusion of these facts is that politicians will not do anything about asteroids until we are hit by one. Even worse, since the probability that a really big one will hit without us knowing in advance has been reduced by space advances, the asteroid that will hit us will probably be small. The Tunguska and the Chelyabinsk events, real things that happened, changed nothing. The one that is going to change anything will be when something similar happens on top of a city.

This is not a doomsday prophecy, either. The probability that this will happen is extremely small. First of all the asteroid has to be small enough and/or fast enough so that we don't detect it in time. Then it has to hit at a certain angle to not be deflected by the atmosphere. Then it has to reach a populated area, which one would think is simple, since we can't seem to be able to fart without someone smelling it, but in truth, with the oceans and the human propensity of congregating for no good reason, it is less probable. However, with enough time, even a small probability becomes certainty.

So, the scenario goes like this: we all pretend to care, but we don't. We want less taxes, not asteroid protection. Politicians use our shortsightedness and our greed to enhance their own and do nothing. Then an asteroid hits, causing massive damage, death and loss of property. This is the moment when something happens. They implement new laws, launch asteroid defense programs, create new departments and committees. But, since the probability that an asteroid hits is small, the hype will fade, the budgets with it, politicians will rotate, people will forget. By the time the next asteroid hits, no one will be prepared for it any more than for the previous one.

In the end, the only things that ever made a dent in the probability that something will hurt us as a species or even as a larger group were technological. Not technology per se, just its price. Just more scientists with cheaper tech getting more done. When space launches become cheaper, satellites smaller, we can do more with them at the same relative price. That is why now we are discovering millions of asteroids in the Solar System, not because of some sort of scientific awakening. It's cheaper, probably as cheap as it was for amateur astronomers to buy telescopes in 1801, when Giuseppe Piazzi discovered the first asteroid, Ceres. I just hope this all gets cheap enough fast enough so we can do something by the time the big asteroid is coming. Well, if we don't destroy ourselves in some other way by then.

I know I'm a month late, but Happy Asteroid Day!

BBC's show The Sky at Night did a coverage of the Rosetta mission, called How to Catch a Comet. It is the standard popular science show, with a lot of fake enthusiasm from the reporters and simple language and explanations, but for people who read this blog entry and wonder what the hell Rosetta is, it does the job. The fat black reporter is really annoying, and not because she's black, but because she feels completely fake whenever she says anything. Other than that the show is decent.

You get to learn about comet 67P, the Rosetta probe features and mission, walk around ESA, talk to scientists and even see a how-to about photographing comets - it was funny to see a shooting star in the night sky while the guy was preparing his camera and talking in the video. Of course, for me the show stopped just when it was getting interesting. I know you can't do much in 29 minutes, but still. I hope they do follow-up shows on Rosetta and I can't wait for November when the lander module will try to grapple the comet and land.

Just in case I've stirred your interest, here are some links that can cover the subject in a lot more detail:
ESA Euronews: Comet Hunters: Rosetta's race to map 67P - 8 minutes and a half of Euronews report from 11 August.
ESAHangout: How do we journey to a comet? - Google Hangout from ESA explaining the mission. It's one hour long and it dates from the 26th of June. Many other videos about Rosetta can be found on the ESA channel.
A playlist about Rosetta from Mars Underground. The most interesting is this video, published on 11 Aug 2014. It lasts an hour and a half and shows the first mission images and science results.
Comets - A wonder to Behold, A continuing Stream of Surprises - The Beauty and the Danger, not about Rosetta, but one hour and a half about comets. The documentary is trying to justify a controversial theory about the electric nature of comets. It is well done with a lot of proof, but I know too little about the theory so I can't recommend it. Interesting, though.