
Ask HN: What would alien code look like? - coryl
Hi fellers,<p>Disclaimer: Not a programmer, but semi-technical and know a little bit about engineering concepts.<p>That said, lets be imaginative for a bit and pretend we made contact with an advanced space travelling race of alien. We have the opportunity to look their technology and programming behind it.<p>What do you think would be significantly different from the way they write their code and ours? Would they have the same logic as us? Could they use logic gates that we don't have yet? Would their computers have to be based in binary? What could they use instead?<p>Fundamentally, could their programs be translated directly into human code, like C++, or would a difference in conceptual understanding be so different that human code could not express alien logic?<p>Feel free to let your mind run with this. Would love to hear some crazy thoughts. Thanks
======
mquander
" _Few of us have been to Mars. But science fiction has filled in many of the
gaps. We know that the Martian civilization is immensely old. Its software
technology, therefore, must be similarly antique. Obviously nothing like it
exists on earth - though those of us who remember VMS might be deceived...

...Since Earth code is fifty years old, and Martian code is fifty million
years old, Martian code has been evolving into a big ball of mud for a million
times longer than Earth software. (And two million times longer than
Windows...)

...There is only one thing to do with it: obliterate the trunk, fire the
developers, and hire a whole new fscking army of Martian code-monkeys to
rewrite the entire fscking thing.

This is such an obvious and essential response to the big ball of mud pattern
that, despite the fact that we know nothing about Mars, we can deduce that it
must have happened on Mars. Probably several times. Probably several hundred.
For each of these attempts but the last, of course, the result was either (a)
abject failure, (b) another big ball of mud, or (c) both.

But the last, by definition, succeeded. This is the crucial inference we can
draw about Mars: since the Martians had 50 million years to try, in the end
they must have succeeded. The result: Martian code, as we know it today. Not
enormous and horrible - tiny and diamond-perfect._"

No comment on what follows, but you might find it entertaining.

[http://moronlab.blogspot.com/2010/01/urbit-functional-
progra...](http://moronlab.blogspot.com/2010/01/urbit-functional-programming-
from.html)

~~~
barrkel
Warning for others following the link: that's an overly verbose post with too
much unfunny humour, describing a language whose implementation - on Google
code - is written in a language (Watt) the author defines in the previous
post. That language, in turn, doesn't appear to be much more than a more
obscure version of the lambda calculus, and about as readable.

~~~
ddewey
Counter-warning: I liked it :) but I tend to like more fanciful, meandering
approaches to CS topics, like Why the Lucky Stiff and Clifford Pickover. Or
Lewis Carroll, for that matter.

Notable concepts from the article: a "fixed-point" of language design, the
idea of working backward from an aesthetic (Martian) to a language, and Kelvin
versioning, in which "releases count down by integer degrees Kelvin. At
absolute zero, the system can no longer be changed."

It's true, though; I found the actual language the author's made (or is still
making?) to be pretty opaque.

------
ars
Logic gates are fundamental, and would be exactly the same. [1]

They don't have to be binary, but it's a lot easier, so it's a near certainty.
Plus true/false is also fundamental.

So I think at a low level it'll be pretty similar.

Math is usually considered to be universal, and computers are based on math,
so that will all be the same.

Memory access however could be totally different. Our machines are Von
Neumann, but aliens could use a totally different architecture.

[1] There is one gate for each combination of binary input and output. There
are three inputs: 0 0, 1 1, and 0 1 (1 0 is the same thing). For each input
there are two possible outputs, total 6. There are 6 gates: and, or, xor,
nand, nor, nxor (xnor)

Or put another way:

    
    
                                     xnor
                 nor  xor  nand and  nxor or
      -------------------------------------------
      1 1:  0    0    0    0    1    1    1    1
      0 1:  0    0    1    1    0    0    1    1
      0 0:  0    1    0    1    0    1    0    1
    

(A gate that always returns 0 or 1 is useless, so those two don't count.)

If you want logic gates that depend on position, then you have more options
(16 in total, compared to the 8 I listed), and you can see them here:
[http://en.wikipedia.org/wiki/Logical_connective#Table_of_bin...](http://en.wikipedia.org/wiki/Logical_connective#Table_of_binary_logical_connectives)

Our computers don't use them, I suppose alien ones could, but I doubt they
would.

~~~
jonsen
Maybe they also invented the memristor:

<http://news.ycombinator.com/item?id=397335>

The memristor is an imply gate:

    
    
      0 0 | 1
      0 1 | 1
      1 0 | 0
      1 1 | 1

------
gdl
I'm not even going to venture a guess on the lower-level similarities. It's
certainly easy to say that, of course they'd use binary, it's the obvious,
simple choice. But I'm not an alien and don't presume to know what they would
find obvious. Their "computers" might be built by wiring a bunch of alien cow
brains together until they get something that can navigate starships but can't
be trusted to add two numbers together reliably. Things are made from what's
handy and then grow from there, not necessarily from whatever is the most
elegant or mathematically pure.

One thing I would bet on is that they wouldn't code in anything resembling
C++. Even now, only a handful of decades into human computing, languages are
becoming increasingly high level and abstracted from the machines themselves.
Assuming that our alien friends have had a few centuries / millenia to improve
on things, I'd expect that they'd have progressed to much more intuitive, more
automated, and less detail-oriented methods. Especially if we assume that
they've developed reasonably strong AI, the very idea of "programming" could
be as strange to them as someone building their own computer from wire and
logic gates would be to us.

~~~
user24
actually I saw someone at the retro computer fair who'd done just that with a
ZX spectrum: <http://www.zxdesign.info/>

------
gojomo
They will use balanced ternary rather than binary at the lowest hardware
levels:

<http://en.wikipedia.org/wiki/Balanced_ternary>

I first learned of balanced ternary from this article:

[http://www.americanscientist.org/issues/id.3268,y.0,no.,cont...](http://www.americanscientist.org/issues/id.3268,y.0,no.,content.true,page.1,css.print/issue.aspx)

(Beware; the balanced-ternary example values there don't seem to be rendering
negative digits correctly.)

------
zephjc
That's a great question. I think any advanced space-faring civilization would
have no further use of programming languages as we know them, as any ship or
computer system would be sentient or even sapient by their builder
civilization's standards. Communicating with these artificial minds would be
as difficult as communicating with the aliens themselves.

We would have to overcome whatever language barriers we find before being able
to do the equivalent of "programming" - I don't think there would be any
language below whatever their equivalent of microcode though, nor do I think
any language could express everything necessary.

Well, maybe Lisp ;-)

~~~
coryl
So you think they could just describe what they need, and their awesome AI
computers could just whip up something just like that? If so, even the AI bots
would express alien logic birthed unto them (unless we're talking about a
species of AI that has evolved into its own race, but lets not go there :D).
So at some point, something or someone has to put code down into some
hardware.

~~~
zephjc
Well I think anything that was used to describe the AI programming would have
long since been lost to the ages, and the AI outgrown any known language which
can describe it.

------
jeb
If they are advanced enough to space travel, and they evolved from a survival
mode, it would imply that their thinking organs are not designed to deal with
infinite complexity. Just like us, their brains would have been evolved to
deal with some primary physical stuff (like falling rocks, fire, etc). So
programming will be as complex to them as it is to us.

The complexities would have to be abstracted away, and if they were space
travelling, the abstractions have to be reliable. So probably, by the time we
meet them, they have some type of black-box elementary code particulars for
many different functions that everyone needs to join together to produce
machines.

Probably, they would have developed some type of inform interface method,
where you can specify what you want in and out and the appropriate atomic
block gets delivered to you. They would have some type of global repository
that harnesses the power of many different individuals working on problems to
avoid any form of repetition.

Currently, we interface with code through typing. This is inefficient for us,
and we don't know how they will coummicate. However, for them to be capable of
abstract though, they will need to create pictures in their mind. It does not
seem farfetched to assume that they have much faster interfacing methods that
work directly on pictures they visualise. This allows them join the atomic
blocks much quicker.

In effect, they will try to eliminate the manual work entirely, and only do
the specifications part of things (tell it what you want), and let the
computer build the rest of the things.

On the other hand, perhaps they lack our sense of moral, and will work with
biological computers, and not metal-based.

------
Amnon
Imagine humans in prehistoric times thinking about making contact with aliens:
"Will their spearheads be made of stone or a more advanced material?" If
aliens will come we'll see that the questions you ask here are irrelevant, as
the terms programs and programming languages will not apply to their
technology -- it will be something completely different.

Admittedly, programming has mathematical foundations (algorithms) so it has a
good change to still be relevant.

If they do have programs, then the according to the Church-Turing thesis the
programs could be translated to human code, but not necessarily in a clear
way.

------
zhivago
Aliens exist in the same physical universe that we exist in.

However we only engage directly with a small subset of the universe and in
ways that have been evolutionarily useful.

Aliens might well have evolved to engage in a different subset.

We certainly have different subsets here on Earth -- consider colour vision
for example and the effects on colour coding interpretations between humans,
fish, birds, reptiles, bees, etc.

Communication requires being able to predict response to stimulation. The
degree of similarity with which we perceive a given stimulation will determine
how well we can communicate.

Computer programs can been seen as a kind of communication with a computer,
and it only makes sense for programs to be written in a convenient
communicative form.

While it might seem obvious that aliens would use digital computers it isn't
necessarily so.

Analog computers might make more sense for them -- the main reason we don't
use them much these days is that they're hard to reprogram -- but with
nanotech or biotech it might be far more trivial.

There are also quantum computers, and non-electrical computational systems.

People also assume numeracy, but consider aliens without recursion which deal
with numbers by subitization up to some large quantity rather than counting.

------
biotech
The hardware and software would not necessarily be as distinct as it is in our
technology. Alien technology might more closely resemble that of organic life,
where the decision making processes are built into the physical structure of
the system. Conceivably, these systems could also be designing through an
evolutionary-like process, instead of the human engineering process.

~~~
rwhitman
I agree.. I would think that a more highly advanced technology would start to
resemble organic life. I'm no engineer, but I'd say we're still a long way off
from this in most regards, am I correct?

------
rjprins
I think if we encountered aliens, they will not be "biological" but mechanical
and electronic. These have by far the more superior characteristics needed for
space travel.

The same holds for us, we are sending robots already and it will only be more
and more robots in the future.

Also, "artificial" AIs will be the ones doing the programming. They can be
extremely more complex than humans, because their electronic brains can
actually be scaled up, and new data can be much faster interpreted and shared.

The code they write will be machine code, because they can compile their own
abstract ideas themselves. On a low level the code will be extremely
optimized. Like how an expert human programmer would optimize his 100 lines of
assembly code in the 70s.

Resources will not be wasted, in fact they will have way more computing power
and use it very effectively at the same time.

So, how would the code look like? Sadly only ones and zeroes. We would have to
translate it to assembly ourselves and then extract more abstract concepts of
it, for us to understand it.

~~~
weavejester
_"The code they write will be machine code, because they can compile their own
abstract ideas themselves."_

This doesn't seem likely. Unless this alien species is isolationist to the
extreme, they'll need to communicate with others of their species. Therefore
they need a language that can communicate high-level concepts, something
assembly is not known to be good at doing.

Or to put it another way, even though we communicate with our bodies in a very
low-level way (sending neural impulses to contract or relax muscles), our
language is very high level. We don't say, "Fire neuron 10212, fire neuron
39232...", we say, "Come over here, please." We don't think in terms of firing
neuron either; that's a job for the low-level subconscious.

In a similar way, I'd expect any artificial life form to have a language to
express high level concepts, and "compile" with their subconscious.

~~~
rjprins
Yes, but we were talking about writing code, not communication.

~~~
weavejester
What's the difference?

------
TNO
What would alien code look like? Perhaps like Piet:
<http://www.dangermouse.net/esoteric/piet.html>
<http://www.dangermouse.net/esoteric/piet/samples.html>

------
rednum
As programming have mathematical foundations, I think it makes more sense to
ask what alien mathematic would look like. Would their mathetmatic be
isomorphic with ours? Would they have just their own versions of caluculs, set
theory, topology, differential geometry, etc. with just some minor
differences? As most of mathematics is based on few simple axioms (from which
more complex 'things' are derived[1]) this seems quite unlikely - but on the
other hand 'basic and simple' may mean something completely different to them;
for example classic geometry for creatures whose vision is not main sense
would kind of awkward, also they wouldn't probably think of some integrals as
an area.

[1] At least that is how I see mathematics right now as a math/cs student;
please correct me if I am mistaken.

------
jdale27
It's not exactly an answer to your question, but if you aren't familiar with
the Church-Turing thesis
(<http://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis>), you might find
it interesting.

------
geuis
Lets step back a little bit and look at the question of 'sentience'. So far,
just as we only have one example of a planet full of life, we also only have
ourselves (I am being inclusive of all life on Earth that has neuronal
structures we collectively call a 'brain') to draw our references from.

Whether we look at snails with 12 neurons for a brain, or a human or cetacean
that have the most complex brains on earth, the biochemistry behind how they
work is all rooted from the same evolutionary source.

We can _hypothesize_ that on a another planet where life arises using the same
kinds of naturally occurring elements (hydrogen, oxygen, carbon, nitrogen, etc
etc), and that this life lives in a similar environment (a warm, wet, ball of
rock) that we might see convergent evolution across many, many worlds that
share these properties.

DNA is what life here on Earth eventually settled on, but remember that the
latest theories of life's beginnings on our world is that RNA probably came
first. So its not 100% proof positive that DNA or its chemical equivalents are
the _only_ way to make a living, complex cell. Different replicative
mechanisms could create different biochemistry, even on a world that is nearly
identical to Earth.

The point of this is that even on a world with a different kind of replicative
biochemical system, complex life could evolve similar large-scale structures.
Fins for the water, legs for land, wings for air, eyes for seeing, etc, etc.

So, does this hypothetical situation also extend to things like brains? If
this alternate biosphere uses a chemical system very different from DNA, how
does that affect the chemistry of what makes a brain? Perhaps arsenic is like
seratonin or dopamine, for example.

Putting aside the chemistry for a moment, does a similar physical environment
that encourages things like legs, eyes, and skin encourage the development of
similar brain structures to control those systems? Or, are there vastly
different kinds of brain structures that can control the stuff that makes up a
body?

IBM has been working on simulating the neuronal columns that make up a cat
brain. Mice, cats, and humans all share some variation of these columns. It
makes sense because we all share common ancestors and we inherited these basic
structures from them. But would we necessarily expect to see these structures
in life coming from a different biochemical history?

So pulling this back to the original question, how much of our mathematics and
computing models correspond to how our form of intelligence has evolved?

Based on the universe we can see and test, we have developed a very large and
thorough mathematical knowledge-base of how the universe fits together. But it
does beg the question, if another kind of sentient life discovers the same
mathematics do they utilize that knowledge in the same ways that we have?

Binary logic is a very efficient way to do our kind of computing. But its not
the only way. Quantum computation is an easy example of a non-binary way to do
computation. We've also only been doing this for a little over a century, and
if we can take anything from the lessons of history its that we should never
assume what or how we do something now is going to be the best way for all
time.

I can't and shouldn't offer a definitive answer to the question. No one on
Earth can provide anything more than a strong hypothetical argument one way or
another. Remember, black swans and all.

What it would take to answer this would be to find that ever so elusive alien
tech and stick some probes in it and start studying it. Experimental evidence
is the only way to ever really prove something.

I will offer a hypothetical answer though, here at the end. From everything I
have learned in my life, its likely that math and physics work everywhere we
can see. And we can see a long, long way away. Even if some sentients on
another world with a vastly different arrangement of biochemistry and
thinking-stuff (aka brain analogues) invent their types of 'computers' that
work differently than ours, I think we can understand how they work.

As we are demonstrating that we can simulate the physics of the universe in
our Turing-complete machines (biology to nuclear explosions to air flow over a
race car body), when we figure out all the nitty-gritty of how our brains work
we'll simulate those too. Given the proper amount of knowledge of how a system
works, such as for alien brains and alien computers, we'll be able to load
them up and run them as well.

So, as long as the aliens we encounter are based on the same physics we are,
there shouldn't fundamentally be a problem to figuring out how their systems
work. There might be a high likely-hood that we find many, many similarities
at the root level of their computing technologies to our own.

------
derefr
Speaking as a sci-fi author, who thinks about this quite a bit: there will be
more _kinds_ of programming, but it'll all pretty much resemble what we
already have. It will be faster and easier, and use (or "waste", depending on
your perspective) lots more resources. It would be completely predicated on
the technology, not in "alien thinking"; if given a tutorial, humans could
easily program the alien computers the same way the aliens could, after
struggling with concepts that are about equivalently difficult to recursion or
pointer arithmetic.

The kind of programs we know today (encoding static text segments using a
tower of abstractions and compilers) would still continue to exist. What we
today call "programming" as a whole, will be what aliens call "embedded
programming"—the kind you do under severe resource-constraints, where every
gate must be secure, reliable, and could be hit with hard radiation at any
time. We'd easily be able to understand these programs, given an appropriate
disassembler. They would likely be written mostly by constraint-solving AIs,
however, not tediously by aliens, who have better things to do. Aliens would,
however, check them over out of paranoia/"defense-in-depth." They would be
intensely parallel: imagine how NASA shuttle software works, with several
independently-contracted codebases on independent hardware voting on each
decision—but multiply the scales a millionfold.

Most programs, however, would not be "embedded"; they could expect to rely on
a "silly" amount of resources. They would be inscrutable, mostly JIT-
genetically-evolved from small "goal scripts" (which themselves would still,
indeed, resemble human source code—clear and exact communication of rules and
intent within a business domain survives no matter the language used.) They
would rely on a "universal library" of "common sense", both in process
knowledge (algorithms, protocols) and semantic knowledge (datatypes, fixtures,
"facts" in the RDF sense) that would allow programmers to actually write "Do
What I Mean" programs as well as could ever be achieved.

There would only be a single "programming language", for the same reason that
we, today, have a Unicode character encoding. All programs would be
_internally_ stored in something resembling S-expressions (just a binary-
encoded tree), and represented, textually or graphically (or audially or
kinesthetically or experientially or somatically or telepathically...) through
a bijective transformation. Every identifier in a program would be a
universally-unique resource-locating ID (i.e. something that is both a UUID
and a URL) allowing for importing of live code from external (network)
libraries, cross-program optimization and symbolic unification, global API
versioning, and removal of all "name clashes."

Also, a bonus sociological perspective: there would be living software—like
with carbon-based life, we would classify software into "plants" (natural
resources that we care about mostly as an enabler), "animals" (feeling but
unthinking goal-directed objects that we think should have some, but not all,
the rights of sentients) and "people" (which would have just the same rights
bio-people do.) "Animal" software would have control systems that mimic (or
simply _are_ ) emotions; an alien Roomba would indeed be considered a pet. But
in the converse view, the aliens would consider genetically programming
carbon-based plants and animals to have symbiotic functions, just as we
currently live in symbiosis with robots and machines. They might all be ultra-
vegans, for the simple reason that any combination of flavor, texture, and
nutritional content could be turned into the fruit of a plant (a symbiotic
arrangement), and so would abhor the non-symbiosis with which we consume our
own environment.

~~~
gjm11
_after struggling with concepts that are about equivalently difficult to
recursion or pointer arithmetic_

I think that's a bit optimistic. Even within the realms of human programming
languages, competence may require struggling with concepts that are as
difficult as, say, monads or virtual destructors or Prolog cuts or abstract
factory factory factory factories or call-with-current-continuation. Those are
all at least one step up from recursion or pointers. I don't see any reason to
expect that alien languages would be nearer in conceptual difficulty to C than
to Haskell or C++ or Scheme or Prolog.

------
oakenshield
Their programming languages will be frighteningly similar to Javascript:
<http://www.flickr.com/photos/mendhak/2643251456/>

------
jplewicke
Their programs would be single real numbers:
<http://en.wikipedia.org/wiki/Real_computer> .

------
j_baker
There are those (myself included) that would say Perl looks like it was
created by aliens.

------
calibraxis
I think it's unclear. We have some ability to do math, but even our
specialists learn it with great difficulty. (We see something a bit similar
when we try to teach other primates language or math. They can learn enough to
fake some of it, with lots of difficult training.) If we want to see more
examples of human cognitive limits, I hear we can look to games like chess. We
play them because we're bad at them.

It's very possible that there's things we can't imagine how to begin answering
(even things we really care about) that another species finds trivial. Or
funnier, we could have roughly similar mental powers, but our thought
processes are so different that each species' insights seem entirely mystical
to the other.

I hear that psychologists (and following them, AI researchers) keep finding
that intelligence is buried in our visual and lingusitic systems. What if
these aliens have very different organs?
[http://www.youtube.com/watch?v=auXQtoAyCGA&feature=PlayL...](http://www.youtube.com/watch?v=auXQtoAyCGA&feature=PlayList&p=9F536001A3C605FC&playnext_from=PL)

And off-topic, might this explain "rubber-duck debugging," where we explain
our problems to a rubber duck? (Because using language clarifies our
thoughts.) And why we often write pictures on paper to better visualize
abstract problems? (To leverage our powerful visual apparatus.)

