Star Wars and the dark side of the code

Taking advantage of the release of the new Star Wars movie, we review some references we find

A new Star Wars movie was released and we review some references we find in our day to day as programmers. Take a look on the dark side of the code.

Death star

If we develop mobile applications for Android and use the accelerometer to gather information on the movements of the device, we will see that gravity is very important for calculating this data. There is a constant located in the class SensorManager called GRAVITY_EARTH. But we can also see that there are also values for GRAVITY_PLUTO, GRAVITY_SATURN, etc. Strangely enough, GRAVITY_DEATH_STAR_I is also a constant, as described in the documentation:

Gravity (estimate) on the first Death Star in Empire units (m/s^2)
Constant Value: 3.5303614E-7

So if we want to use our cellphone on Death Star, we have the necessary data available. Also, note that it is expressed in Empire units (Empire units, not be confused with Imperial units), which happen to coincide with the metric system.

There is also a reference to Star Trek, but we are not going to name it here.

Yoda conditions

According to Wikipedia, the conditions are expressed contrary to what one would normally think, for example:

The advantages are: avoiding assignment errors:

And null pointer exceptions:

Aurebesh

Google Translate added Aurebesh as language. So now we will be able to translate some film references, such as:

Star Wars and the dark side of the code

There is no mobile application yet. But we can use the font in our web applications: http://www.dafont.com/aurebesh.font

Star Wars API

Are you making an application and need to consume data from Star Wars? SWAPI is a public REST API which give you information about people, vehicles, planets, species and more! For example: http://swapi.co/api/people/13/

Star Wars in ASCII

Doing a telnet to towel.blinkenlights.nl we can see the ASCII version of Episode IV:

Star Wars and the dark side of the code

(Han shot first)

Share this articleShare on LinkedInTweet about this on TwitterShare on FacebookShare on Google+Email this to someone
Go Back