Supersonic Man

March 27, 2019

what makes one programming language better than another?

Filed under: Hobbyism and Nerdry,technology — Supersonic Man @ 3:26 pm

Every programmer who knows more than one language has opinions about which languages are better than which other languages. I’m no different from anyone in that aspect, but I realize now that I’ve never taken the time to clearly think through what criteria to use in such a comparison. Of course there are times when different language features and styles are suitable for different tasks, but some generalities are pretty universal, and I think different situations mostly just change the emphasis and priority between them.

What got me to take a closer look was hearing someone state the opinion that the measure of the better language is simply the one which forces you to write less repetitive boilerplate. That turns out to be a surprisingly valid and comprehensive metric, despite how plodding and un-abstract it sounds, and I had never thought in those specific terms before.

So, what are some useful criteria for distinguishing a good language from a bad language? Here’s what comes to mind for me:

1. Efficiency. In general, the language should not penalize you for using it by producing a slow-running program, nor should it waste your time during the writing process. Typing a lot of boilerplate is definitely a loss of efficiency.

Supporting good execution performance implies that the language should include some capability to manually optimize the most performance-sensitive parts of the code — the little inner loops in which nanoseconds count because they might go through billions of repetitions. This in turn also implies that there needs to be some access to low-level primitive data types such as bytes. The performance criterion generally favors strongly typed compiled languages over loosely typed scripted ones.

2. Clarity. Simple and commonplace actions should be expressed simply, and complex innovative actions should be expressible as clearly and elegantly as possible, without being forced to translate the basic idea into some other idiom which doesn’t fit it. The language should support writing for ease of reading, as well as for effectiveness of execution.

Sometimes clarity comes a bit into conflict with writing efficiency: a more verbose language can be more readable than a terse one. And sometimes having to type more boilerplate makes the resulting code easier to follow, because the structure is easier to see. There are exceptions to this correlation, but languages that are famed for their brevity are often the same ones with a reputation for unreadability.

For clarity, language features which some consider overkill, or ripe for abuse, can be quite beneficial overall. Capabilities such as redefining what the “+” operator means, or using a novel definition of how iteration works in some new context, are beneficial in that they allow what may be complex inner behaviors to be used and combined in a very readable way.

3. Expressive power and convenience. If a language helps the writer express in one statement what might otherwise have to be broken down into several, that’s beneficial. This aids both writing and reading, and also improves code quality: research shows that the number of bugs introduced is proportional to the number of distinct statements written by the coder, not to the total complexity of the resulting program. When the language empowers the coder to use complex tools in a simple way, the software they produce can be more advanced and powerful for the same effort, and with the same quality.

It is beneficial to support templates with type parameters, so that it’s possible to support a substantial library of collection and iterable types which can be used flexibly and easily. To include features that ease common operations such as “for each distinct” or “first matching” or “all for which” on such collections is also of value — perhaps more value than is commonly appreciated. This is one of the most important factors for avoiding boilerplate: not just avoiding empty verbiage, but making sure the coder does not have to write their own version of a well-known standard operation.

Property getters and setters also help here. They were ideologically controversial at first because of the potential for misuse, but are popular for good reason. So is the fluent pattern — chaining consecutive method calls.

4. Nonrepetitiveness. DRY — don’t repeat yourself — is a rule to help coders produce quality work, and the language should follow it too. The code should let you express a fact once, rather than making you say the same thing twice. Repetition counts as boilerplate, but beyond that, there should be a single authoritative source for each piece of information, with no ambiguity.

This can be a surprisingly challenging goal once you start bringing in “glue” for APIs and data that exist outside of the language. Even within a language, mirroring the same data in different formats can lead to confusion over which version is the one that matters. When this occurs, the development environment needs to be very clear about which one is the original and which one is a conversion byproduct — a rule that is frustratingly ignored by popular systems such as Microsoft Visual Stupido.

“Glue” should be simplified as much as possible; if interfacing with something external which needs wrappers or something, try to either find a way to express the interface compactly without requiring manual coding of a translation, or provide a tool to completely automate the translation process. This particularly applies to ORM classes which wrap database tables. Expressing all this with fewer and more general language features is better than having to memorize a larger number of specific features or idioms of narrower use.

Another aspect of nonprepetitiveness is that arbitrary restrictions which make the coder jump through hoops, in the name of enforcing safety and best practices, should be kept relatively minimal, or offer only a low hurdle if some inconvenience is necessary. This favors weak, dynamic, or “duck” typing over strong static typing, but there is also a solid argument the other way, as such approaches can sometimes make mistakes more difficult to find, thereby wasting coders’ time.

Some commonplace language features to be avoided if possible because they are repetitive include:

  • forward or import declarations, especially in separate header files, or anything similar which requires you to re-specify an interface that’s already declared elsewhere
  • writing multiple overloads of a function just to give it optional parameters
  • having to spell out something’s type both when declaring it and when initializing it, particularly when generic parameters are involved
  • having to put the same modifiers onto many consecutive similar declarations
  • glue which has to be manually updated to be kept in sync with outside changes

5. Locality. All of the material which describes a given code or data entity should be readable in one place, not divided up into different sections or different files. For instance, if a piece of code represents a component of a web page, you should ideally have the markup, the styles used by it, the clientside script, and the serverside logic all packaged together. This is a goal of web framework systems such as Angular.

ORM in particular should strive to come as close as possible to seeing the database definition and the business logic spelled out in very nearby locations, even if normally they would have to be expressed in completely separate unrelated languages.

Exception handlers reduce locality; inline error handling may be better, though it has its own downsides in terms of clarity, as exception handlers let you express clearly how the algorithm is supposed to work when everything is as expected. I guess which is better depends on whether the errors in question are considered part of the normal flow (such as validating user input), or something rare and unexpected (like a disk failure).

Note that locality conflicts with the traditional teaching that code and classes should be broken up into many small units. Breaking things up adds clarity if the behavior that’s extracted can be fully described in a short phrase — otherwise, it impedes clarity.

6. Separation of concerns, and scalability in general. The language should aid teams of coders in dividing work, and minimize the need for people working in different areas to have to communicate and coordinate details. This sometimes makes locality more difficult, but there are major productivity costs when coders start working in large cooperative teams, and clear separations keep those costs to a minimum. The best thing you can do for one coder in a group, or one group in a larger team, is minimize the amount that they have to pay attention to what everyone else is doing.

Conflicts with the goal of locality can be mitigated by having exports and glues and such be automatically generated quietly and behind the scenes, so that depending on your context, you either never have to look at the glue file or never have to look at the original. Language features that are good by this metric include namespaces, packages, automatic dependencies, and automatically generated documentation. Also important here is the clear separation of public from private knowledge; you should be able to present your code, even if it has high locality, as an exported API that the reader doesn’t need to ask about the internals of.

* * * * * * * * * * * * * * * * *

So having set out some criteria, how do I feel some languages stack up by these metrics?

Javascript — the most widely used language in the world:
Efficiency is rather low, as it’s interpreted and lacks primitive type access, but this mitigated by aggressive optimizations that competing interpreters one-up each other with. Clarity and convenience of expression are medium, but suffer from strange workarounds and unwieldy syntax for common cases, such as using closures as class constructors (pre-ES6). Locality and nonrepetitiveness are good. Scalability and separation are a struggle, but improving as the ECMAScript 6 standard gains support. Overall avoidance of boilerplate is decent, given the necessarily rather small size of the language. Given its mandatory ubiquity, we could do a lot worse. (The TypeScript dialect improves expressive convenience and scalability, but is much more limited in where you can use it, and may raise the boilerplate level.)

Java — the inspiration of both JavaScript and .Net:
Efficiency is nothing special. Clarity and expressive convenience are definitely lacking compared to its contemporary competitors. Locality is fairly good, and so is scalability. But the boilerplate factor is frustratingly high, even before something like ORM gets involved.

C — the classic that many of today’s popular choices are descended from:
Efficiency is exceptionally high, but clarity and convenience are way behind the times. Locality is not very good, and scalability is not either. The boilerplate factor is pretty bad when it comes to the actual algorithms you’re coding, unless you have an extensively updated library to mitigate this, but then readability suffers.

C++, a halfway modernized version of C:
Efficiency is not as high as C but is certainly competitive. Clarity and convenience are greatly improved in some areas but backward in others. Locality is possibly worse than C, despite extensive updating. Scalability is pretty good. Overall boilerplate factor is still not very good. This language is the last strong survivor from premodern times and is widely seen as the default for heavy-duty development.

C# and related .Net languages:
Efficiency is pretty fair. Clarity and convenience are dramatically further improved over C++, but at a cost in complexity and feature-creep. Locality is pretty good — of course it falls down if you get ORM and glue involved, but that’s no different from its predecessors. Scalability is a strong point. Overall boilerplate factor is low-medium and has improved with language revisions.

PHP — the new default first language for noob web developers:
Efficiency sucks, clarity sucks, expressive convenience sucks, and scalability sucks. The only bright spot is locality. Boilerplate factor is moderate. This language fully deserves its bad reputation.

SQL dialects with coding extensions, such as PL/SQL and Transact-SQL:
Efficiency can’t be measured like other languages. Clarity and expressive convenience are a struggle, even in the specialized niche uses for which these languages primarily exist, which is where they’re at their strongest. Locality and repetitiveness are poor. Scalability is an area which remains awkward despite a lot of effort. Boilerplate factor is on the high side.

. . .

And now, let’s try forming some baseless opinions about some additional languages which I have not actually learned, going just by what I’ve picked up about them through idle curiosity:

Python — a popular scripting language which supersedes the likes of Perl:
Efficiency is not going to be a strong suit. Clarity is probably pretty good, but it sounds like expressive convenience is nothing to brag about. I’m not aware of any bad issues with locality or avoiding repetitiveness. Scalability sounds like it’s not too bad. Boilerplate factor is… I don’t know, kind of medium?

Ruby — a competitor to Python:
Efficiency is again probably nothing to brag about. Clarity is, I suspect, frequently on the challenging side, depending very much on the coder. Expressive convenience is apparently a strong suit; this is its selling point against Python. Again, I’m not aware of any bad issues with locality or avoiding repetitiveness. Scalability sounds like it’s probably not bad. Boilerplate factor might be pretty low, but I don’t know. This language is now dropping in popularity.

Go — the Google language:
Efficiency is said to be fairly poor. Clarity may be decent, but expressive convenience is not a strong suit. Again, I’m not aware of any bad issues with locality or avoiding repetitiveness. Scalability is… I have no idea, but it can’t be too bad. Boilerplate factor appears to be mild, as far as I can tell.

Rust — the competitor to Go from the Mozilla Foundation:
Efficiency is said to be much better than Go. Clarity looks decent. Expressive convenience is by all accounts higher than that of Go, at the cost of a tougher learning curve, but it’s still more of a detail-oriented language than Python or Ruby, being meant for systems work. It makes much heavier demands on the coder to adopt a novel idiom and jump through hoops in the name of safety. I’m not aware of any bad issues with locality, but there may be more repetitiveness than in Go. Boilerplate factor might be higher than in Go — maybe the difference is minor, but I suspect it might be substantial. This language is aggressively innovative in some areas, and we’ll need time to see whether its concepts move us forward or lead to a dead end. It’s starting to look trendy, but if it catches on I bet someone else will find an easier way to express similar ideas.

Swift — Apple’s language:
I really don’t know enough about this one to have any idea. What little I’ve glimpsed of it make it seem quite middle-of-the-road, with nothing exceptional about it.

Some other languages I know too little about but are probably worth mentioning include R, Haskell, Clojure, Erlang, OCaml, and Scala. Some of these languages are of interest because they are outside of the mainstream and have intriguingly unusual approaches such as functional programming, not because they are widely used. (Actually, Erlang just made codementor.io’s list of the top five languages to not bother learning.) I will say in general that the paradigm of functional programming, to me, is not ideal for clarity unless the problem being solved is of a mathematical nature, as it forces commonplace concepts into a new idiom — one which doesn’t fit well with interacting with live users.

* * * * * * * * * * * * * * * * *

My overall takeaways:

First: modern languages good, old languages bad. There are lots of languages people used to use thirty years ago which I have experience in and could elucidate above, but which I don’t consider to be worth listing because there are so few bright spots. For instance, many people are nostalgic about BASIC, but I consign it to the same trashcan as PHP. Just take it as read that even the ones I liked at the time, such as Pascal, generally suck.

Second, I feel pretty okay about sticking with C# and JavaScript as my default languages. Nothing else out there is giving me all that much grounds for envy. Been thinking about looking deeper at Python or Ruby or Rust, but both have aspects that make me doubt whether the effort is worthwhile. Rust might be the most important one to look at.

Third, if someone can come up with a really practical way to move beyond SQL, they’ll get free drinks for life.

Advertisements

January 29, 2019

how it works

Filed under: Rantation and Politicizing,science! — Supersonic Man @ 1:19 pm

Step 1. The water in the northern Pacific Ocean reaches excessively warm temperatures, peaking in La Niña years.

2. This creates a high pressure zone as the warming air above it tries to expand.

3. As it rises, the expanding air pushes back against the jet stream.

4. Because of the coriolis forces that make storms rotate, this high pressure air starts turning clockwise as it spreads outward.  This deflects the jet stream to the north.

5. As a result, clouds that would normally bring rain to California also turn north.  They get pushed up toward the arctic circle, bringing heat up to polar latitudes.

6. The jet stream and storms strike the polar vortex, distorting it.  It deflects them south again, now chilled.

7. The winds and moisture which were supposed to water California crops now dump excessive cold snow across the Great Lakes and down the east coast.

8. Politicians bring snowballs into the Capitol building and deny global warming, at the same time that large parts of Alaska have no snow.

November 6, 2018

ads

Filed under: Hobbyism and Nerdry,life,Rantation and Politicizing — Supersonic Man @ 10:38 pm

Dang it, when writing this blog, I rarely see how bad the ads are when someone else is reading it. I just got a reminder. I’ve never liked this platform much, and now I’m thinking I should move this content elsewhere. Which would be a pain.

[Later update] And now some of the platform’s other problems, which for a while had seemed to be gradually improving, are getting worse again… the hamhanded destruction of careful formatting and layout, the shitty app which can’t even keep up with one-finger typing on longer posts, the utter failure to connect with a wider audience compared to either social media or my ancient personal website… I need an alternative.

All I ask of a blog platform is, just let me write. And don’t fuck it up after I do. This one fails to meet that requirement. Why can’t the market leader do this simple job as well as LiveJounal did fifteen or twenty years ago?

Time to take a look at Medium, and blogger.com if that’s still a thing. The only reason I ever used this was because other people I knew did, but the social interconnection value coming from that has been negligible.

…Hey, it turns out they both support exporting content through json, which would enable embedding it in my own site with my own styling.

September 6, 2018

the last SLR holdout

Filed under: Hobbyism and Nerdry,Photo,technology,the future! — Supersonic Man @ 10:41 am

Mirrorless cameras are officially taking over; everybody wants the slim camera bodies and short lens registry distances that are made possible by electronic viewfinders.  Nikon has come out with a new Z mount and almost simultaneously, Canon has come out with a new RF mount (which looks to me like it will be a real “RF” of people who bought into their smaller and older EOS-M system, as it is not at all compatible, and it might not even be possible to make an adapter to mate them).  Meanwhile, in the medium-format world, Hasselblad also came out with a mirrorless camera sporting a new short-flange lens mount a while ago — I think they call it XCD — and Phase One put together a mirrorless bodge setup branded as Alpa, which must have something that counts as a lens mount.  This means that almost every camera company that didn’t already have a short mirrorless lens mount (Sony, Fujifilm, Olympus, Panasonic, Leica, and formerly Samsung) has now added one to their product line.  As far as I can see, there is only one holdout which still offers only a long-flange lens mount and traditional SLR cameras: Pentax.  As it happens, I’ve got Pentax.

Does this mean that Pentax needs to do a me-too and come up with their own short mount, to keep up?  It does not.  There are lots of reasons why it might make perfect sense to offer a mirrorless camera without changing the mount.  They’ve already updated their existing mount so it can operate in a fully electronic fashion with no legacy mechanical linkages.  Lenses made for mirrorless use can still have their back end close to the sensor; they’ll just have the mounting flange further forward, with some of the glass hiding inside the body of the camera.  This will create a pancake-like appearance for lenses that are not actually thin.  Another possibility is that filters can be placed into the gap.  Or the protruding barrel can be a place to mount a control ring.  I think it’s a perfectly viable way to do mirrorless, though for some it won’t win aesthetic points.

(more…)

August 3, 2018

ethnicity of presidential names

Filed under: Hobbyism and Nerdry,Rantation and Politicizing — Supersonic Man @ 3:24 pm

For a country which is built on immigration and (usually) welcomes exceptional ethnic diversity, the United States of America has tended to be very narrow about what sort of ethnicity it looks for when electing a President, even beyond the fact that all but one of our presidents are white males.  For most of its history, America chose people whose last names originated either in the British Isles or in Holland, or failing that, had been well assimilated into a British-sounding form.  The first president to break that pattern was Dwight Eisenhower, and Barack Obama was only the second.  Even within that group, names from England were heavily favored over those from neighboring countries.

There have been 44 presidents, with 39 distinct last names.  (If you think there were 45, you counted Grover Cleveland twice.)  The high number of repeats counts as a statistical anomaly in itself.  Let’s tote up their ethnicities:

ENGLISH:  Washington, Adams (2), Jefferson, Madison, Jackson, Harrison (2), Tyler, Taylor, Fillmore, Pierce, Lincoln, Johnson (2), Grant (could be Scottish), Garfield, Arthur, Cleveland, Taft, Wilson, Harding, Coolidge, Truman, Nixon, Ford, Carter, Bush (2), Clinton.  That’s 26 names — two thirds of the total.

SCOTTISH:  Monroe, Polk, Buchanan (Scots-Irish), McKinley (Scots-Irish).

IRISH:  Hayes (anglicized), Kennedy, Reagan.

DUTCH:  Van Buren, Roosevelt (2).

GERMAN:  Hoover (anglicized), Eisenhower, Trump (anglicized).

KENYAN:  Obama.

Some other statistical biases we notice by looking at the list of presidents: most are taller than average, and very few regularly wore eyeglasses (just Bush the elder, Truman, and Teddy Roosevelt when he wasn’t avoiding them purely for vanity).  And as has been noted elsewhere, nowadays it seems like about half of presidents are southpaws.  In fact, we recently had three in a row: Reagan, Bush the elder, and Clinton were all left-handed.  So were Hoover, Truman, Ford, and Obama; that brings the total since 1929 up to 7 out of 15.  But before then, only a single leftie is known: James Garfield.

But the most important statistical anomaly may be the frequency and clustering of cases where the electoral college managed to reverse the outcome of the popular vote.  It has now happened four times (not counting the four-way election of 1824, which was decided by the House of Representatives): 1876, 1888, 2000, and 2016.  In all four cases a Democrat convinced more voters but a Republican won the electoral vote.

In the first case the result was the end of Reconstruction and the start of the Jim Crow era in the south (a price demanded by southern Democrats in exchange for conceding).  In the third case it was the invasion of Iraq, and arguably the September 11th attack preceding it.  In the fourth case it’s been a nationwide revival of nativism and fascism, with additional horrors no doubt to come.  The second case, though, turned out well: Benjamin Harrison admitted new western states, created national forests, modernized the Navy, passed the Sherman antitrust act, fought for education and voting rights for minorities, and raised a budget surplus.  Oddly, it was the latter point which led his party to defeat in the following elections: raising and spending a lot of money was unpopular, even though the means by which the new revenue was raised, namely protectionist tariffs which were denounced by his opponent, was exactly what had convinced people to vote for Harrison in the first place.

June 21, 2018

hydrogen economy? how about methane instead?

Filed under: Hobbyism and Nerdry,science!,technology,the future! — Supersonic Man @ 4:52 pm

Ever since the seventies, there’s been an idea floating around that someday, in order to replace fossil fuels, we’d start using hydrogen as our main chemical fuel.  We’d have hydrogen tanks instead of gasoline tanks, and hydrogen pipelines instead of natural gas pipes.  The hydrogen would be produced from water with either renewable or nuclear energy sources, and then whenever we needed a chemical fuel, we’d use hydrogen.  And wherever we needed a portable source of electric power, we’d use hydrogen fuel cells.  Our cars might be fuel cell powered, for instance.

Since then, fuel cell cars have advanced pretty well, and building a fleet of electric cars which get their power from hydrogen fuel cells looks fairly doable.  There are even some demo filling stations which allow you to fill up a fuel cell car with hydrogen, if you have one of the test vehicles.

So that part is doable, though nobody’s sure if there’ll be any need for it.  Cars might do just as well by simply using batteries, and plugging in to charge, as many people do today.  Making a new network for delivering hydrogen to cars might be an unnecessary expense.

But what about all the other things we use fossil fuel for, besides transportation?  What about heating our houses, and fueling our stoves and ovens?  Could we, for instance, substitute hydrogen for natural gas?

I think the answer is that we could, but maybe we shouldn’t, because there’s a better idea.  An approach which lets us keep using the natural gas infrastructure that we already have.  Switching to hydrogen would entail replacing most of it, because a pipe or a valve that safely contains natural gas can easily fail at containing hydrogen.  Since it is the lightest of all gases, one of its properties is that it can find its way through leaks which, to any ordinary gas, aren’t leaks at all.  Every piece of every pipe, and every valve in every appliance, would have to be either carefully tested, or replaced.  Also, the pipes would either have to be expanded for a larger volume, or operated at higher pressure.

We can avoid all that with one simple step: taking the hydrogen we produce and converting it into methane.  Natural gas is 95% methane, and if we make it artificially, it could be used as a direct replacement for gas.  And the way we’d do that is with a process called the Sabatier reaction.  In this process, hydrogen is combined with carbon dioxide by means of a metallic catalyst.  The oxygen is stripped off of the carbon atoms and hydrogen takes its place.  The result is methane, plus leftover oxygen.

The best part is where we get the carbon dioxide: out of the atmosphere.  At first, we could take it directly from the smokestacks of industries which still burn fossil fuel.  (Steelmaking, for instance, might have a hard time using anything but coal.)  Later, as the scale increases, we could just separate it out of regular air.  This makes your home’s existing stove and furnace and water heater carbon neutral.  And even your car, because existing piston engines can be modified to run on methane, which might help ease the transition to the time when we all go electric.

With some further chemical processes we could probably convert the methane into longer chain hydrocarbons, producing oils and so on — substitutes for things like butane or kerosene or diesel or gear oil or candle wax… or even gasoline for classic car enthusiasts.

Between battery cars and methane conversion, maybe there wouldn’t be all that big a market for straight pure hydrogen.  It would definitely have some uses, but I don’t think all that big a part of our energy supply would be used in hydrogen form.  We might, however, use hydrogen to store solar energy from midday for use at night.  Such hydrogen might be produced directly by vats of algae, then fed to stationary fuel cells as the sun sets.

If a big methane convertor works, we should of course encourage its use.  We’ll have tax credits for making carbon-neutral methane, and penalties for fossil fuels.  The rival approach of getting gas by fracking might even be banned outright, because of its harmful side effects.  This assumes, of course, that at some point we overcome the reactionary political forces who want to prop up the oil and coal industries, and would let all the profitable advances in renewables be done overseas.

One cool thing is that methane making machines are being developed right now, as part of the space program.  Not NASA’s space program, but SpaceX’s private program.  They’re building it for future Martian explorers and colonists, so they’ll be able to make their own rocket fuel for flights back to Earth.  Who knows, maybe at some point they’ll use the machine to fuel rockets here as well, so they can say they have carbon neutral satellite launchers.  Both of the major reusable rocket companies, plus several small up-and-comers, say methane is the fuel they want to use.  There’s no denying that a lot of older rockets are terrible polluters… compared to some of the chemicals that get used in the rocket business, even kerosene looks very green.

Of course, some other rockets will keep on using hydrogen, which when practical is still the cleanest option.  But liquid methane is the second cleanest, and it has nine times the density of liquid hydrogen and therefore requires a far smaller tank to hold it, and less insulation as well, which may save more weight than is lost by using a heavier fuel.

Perhaps the most ideal would be some kind of blend of the two… but then again, one of the big advantages of hydrogen is its very high specific impulse, which is achieved in part by burning a very fuel-rich mixture so that a substantial portion of the exhaust is unburned hydrogen gas.  Densifying the fuel by dissolving some methane into it might save weight by making it require a far smaller tank, but it would lose some of that very high exhaust velocity.

June 3, 2018

Trends in rocketry

Filed under: Hobbyism and Nerdry,technology — Supersonic Man @ 11:07 am

I’ve been taking an interest in the space industry and orbital rockets — a field which is evolving very rapidly nowadays.  So far this year we’ve seen the debut orbital flights of the Electron, the Falcon Heavy and Falcon 9 Block 5, and seen a new record set for the smallest rocket to put up a working satellite.  In the remaining months, we’re expecting the maiden flights of the LauncherOne, the Kuaizhou 11, the Vector R, and the Starliner and Dragon 2 crew capsules.  We just might see one of those capsules take live astronauts to the Space Station by the end of the year.  And the next couple of years will have plenty of action too, with several lunar landers being sent up by different countries, and more new vehicles making their debut: the SLS, the Vulcan, the New Glenn, the Dream Chaser, and more.

With so much short-term activity, it may be hard to spot the longer term trends, but I think I can lay out a few here: (more…)

May 10, 2018

if the solar system fit in a stadium…

Filed under: Hobbyism and Nerdry,science! — Supersonic Man @ 12:00 pm

(I wrote a post about this a few years ago somewhere else, but now I can’t find it, so I am redoing it here, and expanding it.)

How big is the Solar System?

Let’s start by assuming that we have some general idea of how big the Earth is.  If we fly from coast to coast in the United States, we’ve gone one eighth of the way around it.  A long day of driving in a car, say 500 miles, goes about one fiftieth of the way around.  So the Earth is very large compared to your local town or neighborhood, but it’s of a scale that can be grasped and managed with common means of travel, such as cars and planes.  Even preagricultural people sometimes traveled and traded over distances of a thousand miles or more, and that’s not tiny compared to the size of the Earth.

The Moon is a good deal smaller than the Earth, but quite far away from it.  It takes well over one second for a beam of light to travel from the Moon to the Earth.  The distance to the Moon is enough to wrap around the Earth nine or ten times (the Moon’s distance varies over that range during each month).  It’s the sort of distance that a junky old car might accumulate on its odometer after twenty or thirty years of driving — over a quarter million miles when the moon is furthest out.  People are capable of traveling such distances over many years, or in just a few days with our most powerful rockets.

To appreciate the scale of the rest of the solar system in comparison to this, let’s imagine a scale model, sized to fit into a big football stadium.  The scale of this model will be 1/100,000,000,000 of life size.

Let’s look at how each part of the solar system would appear at this scale.  The Sun, which hangs over the middle of the fifty yard line, is a bit over half an inch across — about 14 millimeters, to be more exact.  It’s the size of an olive.  Mercury, the innermost planet, has an eccentric elliptical orbit around it which is eighteen inches (46 cm) from the sun at its closest, and twenty-seven and a half inches (70 cm) at its furthest.  The planet itself is a practically invisible speck, only one five hundredth of an inch across, or a twentieth of a millimeter.  Venus, the second planet, circles our olive-sized sun at a distance of about three and a half feet (108 cm), so its orbit crosses the 49 yard line on each side. The size of the planet is about 1/200 inch, or an eighth of a millimeter, a speck which is probably big enough to see if you get close enough.

The Earth’s orbit is found at a distance of a bit under five feet (150 cm) from the sun.  And the orbit of the Moon makes a little circle around the Earth.  The distance from the Moon to the Earth, which in real life is up to a quarter million miles, and is the farthest distance that any human being has ever voyaged, is only about 5/32 of an inch, or 3.9 mm, in this scale model.  The entire circle traveled by the Moon around the Earth is barely half as big across as the Sun is.  It would fit inside a pea.  The distance to the Sun is almost four hundred times as large.  The diameter of the Earth itself in this model is about 1/200 of an inch, the same as Venus, and likewise would be a barely visible speck.  The Moon, being smaller than Mercury, would be very difficult to see.

Mars circles seven and a half feet out (2.3 meters), and is about 1/400 inch or 1/16 of a millimeter across — a dust speck.  The asteroid belt spreads in a hollow disk around the sun, with the bulk of it starting about ten feet out, and then it thins out at a distance of around eighteen feet (3 to 5.5 meters).  None of the individual asteroids are big enough to see.

Jupiter, the largest planet, sits a little over 25 feet (7.8 meters) out from the Sun.  Its orbit crosses past the 42 yard line on each side of midfield.  The planet itself is plenty big enough to be more than a speck: it’s 1.4 millimeters in diameter, or somewhat under one sixteenth of an inch — the diameter of the head of a pin.  If the Sun is an olive, Jupiter might be a large poppyseed, or a small millet grain.  It has a number of moons, the four large ones being Io, Europa, Ganymede, and Callisto.  The orbit of Io sits about 5/32 inch (4 mm) from Jupiter, and the orbit of Callisto is about 3/4 inch (18 mm) out.

Saturn is 46 feet (14 meters) from the sun.  Its orbit crosses the 35 yard line.  It’s smaller than Jupiter, but if you include its rings, it looks bigger.  You might model it with a small flat sesame seed.  Its major moon Titan sits half an inch (12 mm) out from the planet.  Uranus is much further out, 98 feet (30 meters) from the Sun, so it nearly reaches the 17 yard line, and on the sides it spills over the out-of-bounds line into the sidelines.  Its diameter is half a millimeter, so you might represent it with a grain of fine sand.

In this model, the orbit of Neptune, the most remote true planet, has a span that just about reaches the one yard line, but can’t quite reach the goal lines, orbiting 148 feet (45 meters) from the sun.  Its size is about the same as sand-grain Uranus.

From this you can see that the Solar System is very empty.  Besides the olive-sized sun, everything else on the field is just some specks which, all added together, wouldn’t amount to a grain of wheat.

Now the Sun and all the planets pretty much fit onto the playing field, but that’s not the whole Solar System.  Beyond all the planets are a number of icy bodies, large and small.  They constitute a sort of second asteroid belt.  It’s called the Kuyper belt.  Pluto is one of these icy bodies, and it isn’t even the biggest one.  As far as we presently know, it’s the second biggest.

In our scale model, the Kuyper belt fills the rest of the stadium, beyond the playing field.  Pluto is down in a good low seat right near the sidelines, and some of the others are way up in the cheap seats, hundreds of feet from the field.

The light of the Sun doesn’t reach up there very well.  It casts a good bright illumination in midfield, but the goalposts are pretty dim, and in the top row of the seats you can’t see much when you look away from the sun.  If I have this figured correctly, at this scale, it puts out about five thousand watts of light.  But don’t compare that to a 5000 watt lightbulb — your ordinary traditional bulb puts out mostly heat, so the 100 watt lamp in your living room is only emitting about ten watts of actual light, and if you use a modern bulb such as a compact fluorescent, it will say “100 watts” on the box while only actually using about 25 watts.  The Sun puts out at least three quarters of its energy as visible light.  Think of it more as a 5000 watt welder’s arc than a 5000 watt lamp.

One thing this idea of an arc lamp in a football stadium fails to convey is how slow the light is.  You have to remember that the light from our tiny Sun takes minutes to reach Earth just five feet away, hours to reach Neptune, and most of a day to reach the upper seats.  If there were a snail crawling around on the grass, it might well be moving at several times the speed of light.  And the fastest rockets never approach even a thousandth of that speed.  (The fastest moving objects we’ve ever launched into space, or will launch soon, are solar probes that drop inside the orbit of Mercury.  That inward fall can give them a speed dozens of times faster than, say, the Apollo moon rocket.)

There’s more stuff beyond the Kuyper belt, also consisting mainly of icy bodies.  But I don’t really count this as part of the solar system.  This is where long period comets come from (short comets, such as Halley’s, come from the Kuyper belt).  This zone is called the Oort Cloud.  It’s found out in the stadium’s parking lot, and some thin parts of it probably extend out into the surrounding city, perhaps miles from the stadium.  While the Kuyper belt is similar to the asteroid belt in that it mainly lies in the same plane as the orbits of the planets and rotates in the same direction that they do, the Oort cloud is spread in all directions, and appears to have no net orbital direction shared in common among the various objects.  For all we know this spread of icy bodies may extend throughout the space between the stars, and not constitute a part of our own solar system at all, except to the extent that the Sun’s gravity causes a thickening in nearby parts of it.

Speaking of other stars, how far away is the nearest other solar system?  It would be about 250 miles away at this scale… about the distance you might find between your hometown football stadium and that of a rival team in the next state.  For instance, the distance between Cleveland and Cincinnati, or Green Bay and Minneapolis, or Chicago and Detroit.

As an afterthought…  What if we changed scales in the opposite direction?  What if we magnified everything so that a football stadium engulfed the solar system?  How big would individual atoms be then?

As big as a house, it turns out — unbound hydrogen atoms would be around twelve meters across, carbon atoms about seventeen meters…  Counterintuitively, heavy metals aren’t much bigger than light elements: uranium is just a bit bigger than carbon, and gold is actually smaller.  The stronger the positive charge of the nucleus, the more densely the electrons pull in around it, so the overall size has remarkably little variation.

Green light would have a wavelength of fifty kilometers.  One of your intestinal bacteria would stretch from Columbus to Pittsburgh.  A red blood cell would sprawl over several midwestern states.  If you have a good thick head of hair, your individual hairs might be as big around as the Earth.  A flea would reach halfway to the Moon.  And if you stood on the Sun, your head might reach past the orbit of Earth.

August 25, 2017

ten percent of our brains

Filed under: Hobbyism and Nerdry,science!,thoughtful handwaving — Supersonic Man @ 9:40 am

If it were really true that we use only ten percent of our brains, then being granted the ability to use all one hundred percent wouldn’t really make a dramatic difference. It would be like comparing a desktop computer from 2017 with one from about 2005. Sure, the new one is better, but definitely not as much better as you’d hope it would be. They still both do basically the same things, and they’re both still probably hampered by running Windows.

I think there’s some metaphorical truth to the idea for a lot of people, though, because if they don’t get a good strong educational start, the majority of people don’t really have any chance of developing the intellectual side of their innate capabilities. I’m pretty convinced that most of the differences we see between people in “intelligence” have nothing to do with one person being born with a better brain than another. If you’re going to develop into a brainiac, you need to start very early and you need support for it, and most people around the world simply never get that opportunity. It’s only when drawing comparisons between people who have had those advantages, and are already part of a privileged minority, that you can even start looking at innate differences in talent.

May 10, 2017

no Apollo

Filed under: Hobbyism and Nerdry,technology,thoughtful handwaving — Supersonic Man @ 9:21 am

If NASA had not been hurried into building the Apollo mission by the “space race” against the USSR, how might we have arrived at the Moon? Space development might have proceeded a good deal more slowly and less expensively, building on the X-15 rocket plane experiments. I think that program would eventually have arrived at something fairly close to the Space Shuttle. If you solve all the problems of the X-15 one by one to make it orbit-worthy, it would have had to be much larger and blunter, because any adequate heat shield is going to be around four inches thick, and that doesn’t scale down for something skinny or pointy. That sounds a lot like the shuttle to me.

So let’s say we were trying to send a mission to the moon using space shuttles. The shuttle itself can’t go there even in you fill the cargo bay with fuel, and that would be wasteful anyway, as you don’t need most of its bulk. So I think the bits that actually go to the moon would be much as they historically were in Apollo: a lunar module, command module, and service module. Why not just stick those into a shuttle bay?

The shuttle’s cargo bay is 60 feet long and 15 feet across, though for a cylindrical cargo the cross section needs to be a bit smaller, as the space isn’t fully round. The mass limit for a flight to low orbit is a hair over 30 English tons, or 27.5 metric tons. (I don’t think any real flight ever exceeded 83% of that capacity.) What can we work out based on these limits?

You can’t fit all three modules into one shuttle-load, but they’ll go in two loads, if you make the lander a bit less broad and gangly. One would be the command module and lunar module, and the service module would be the other. And we might have to trim a bit of weight from the service module, like maybe take out the heavy batteries and put them in the other load. This means the service module would have to be mounted to the command module by shuttle astronauts in space suits, which would be inconvenient, but doable. Alternately, you might cram the three modules into one flight all preassembled, if their fuel were in another. This would mean at least six operations of astronauts pumping dangerous fluids into various tanks spread throughout the modules. It might also mean assembling the lander’s legs from some inconveniently compact from.

Now you need a rocket to send the set toward the moon — one rather like the S-IVB third stage of Apollo, which used the majority of its fuel to lift the three modules out of low orbit and fling them toward the moon. This rocket was a bit too large to fit into a shuttle bay, but we can reduce its size by at least 25%. Its weight is no problem, if it’s empty. But the fuel would take three additional shuttle loads. Historically this rocket weighed 10 metric tons empty, and pushed a 45 ton payload. The required delta-V is 3.1 km/s. It burned around 75 tons of hydrogen and oxygen to accomplish this. It used about 30 tons more to finish lifting Apollo into low orbit around Earth during launch, which would not be needed in this case.

So the mission would require six shuttle launches, starting with one to put up the booster with maybe the first splash of fuel in it, and three more to fill it up. Then the service module would be brought up, and attached to the booster. The command and lunar modules would come up last, along with the astronauts who will ride in them. That last shuttle could stay in orbit for a couple of weeks to await their return.

It might be better to bring the fuel up in the tanks that will be used instead of needing to pump it from one tank to another, so maybe the booster would just be a framework that fuel tanks would be bolted into. Such a framework might be folded smaller for transport. This would require additional assembly in space, possibly employing double digit numbers of shuttle astronauts over several flights. But if everything were prepared well on the ground, the task should not be difficult or dangerous. And if the orbits were well planned, the booster stage could be recovered into Earth orbit, and either refueled for another mission, or if necessary flown back down for refurbishment. As SpaceX has demonstrated with their Falcon landings, once a booster is detached from its payload and has mostly empty tanks, a small amount of remaining fuel can accomplish quite a lot of maneuvering, so I don’t think it’s implausible that its engine could return it to low orbit with the last of its fuel, especially if it discards some dead weight such as empty tanks.

The command module might not need to splash down into the ocean. But it might still need a heat shield, just to brake in Earth’s atmosphere enough to slow down into an Earth orbit, so a shuttle can pick it up. Or, this somewhat risky air-braking might be avoidable by making the service module larger and giving it more fuel. (Perhaps it also could use bolt-in tanks. Add at least one more fuel-hauling flight to the schedule in this case.) An ocean splashdown might be the emergency backup option if the rendezvous fails.

I’m sure this sounds a lot more awkward and inconvenient than the Apollo’s comparatively simple process of just launching one big rocket, but it would have been vastly less expensive. Most of the parts would be reusable instead of disposable. The only part that absolutely could not be reused is the bottom stage of the lunar module. Apollo cost us at least $20 billion per landing, in today’s money; this would cost perhaps a quarter of that — and I’m sure if we made this a continuing operation, we would have found ways to lower the costs further. Instead of just six trips to the moon, we might have continued doing dozens. We might never have stopped.

However, I do worry that this process might have exposed astronauts to greater risks. Lots of opportunities for something to go wrong up in orbit, and lots more shuttle flights. As we have seen, those shuttles were not the safest things to fly in.

Anyway, the shuttle is now long gone. What modern alternative could you use instead? The obvious answer is the Falcon Heavy, which with full reuse of boosters has a lift capacity quite close to that of the shuttle in both mass and volume. The mission plan outlined above would be quite doable with it, though the third stage would need a custom fairing. And this option would further lower the costs. You might get away with five launches instead of six.

Once the New Glenn comes online, you would need at most four launches and might get it down to three. This would probably leave the overall cost roughly similar to what it would be with the Falcon.

But if they get the BFR / Starship to work, it would only need two launches, and would not need any separate modules: with an orbital refueling, the entire ship could land on the lunar surface. SpaceX has stated that they have plans to perform such a mission within the coming decade.

Next Page »

Blog at WordPress.com.