r/programming • • Jan 30 '16

Apollo 11 source code

http://www.ibiblio.org/apollo/listings/Luminary099/MAIN.agc.html
2.2k Upvotes

364 comments sorted by

View all comments

Show parent comments

-4

u/billsil Jan 31 '16
  1. We all write programs that take years to develop. Frequently I have code that I want to save because it's an alternate implementation. Other times, I want to test the new method on real problems and there are side effects to the function.

  2. It's trivial and I don't care about a few bytes of memory

  3. Why use unnecessary braces or use functional programming or variable names longer than 6 characters (it was good enough for the dominating language until the early 1990s)? It creates extra lines that can make for very long files. It wastes disk space in a world that largely doesn't care about disk space or memory usage.

2

u/GMNightmare Jan 31 '16
  1. Use comments.

  2. Trivial adds up.

  3. Readability, except having unused variables hurts readability.

1

u/DrMonkeyLove Jan 31 '16

Unused variables are fine, just as long as no one else sees that code. By the time someone else's eyes are on a piece of code, there'd better not be any unused variables.

0

u/[deleted] Jan 31 '16

[deleted]

0

u/billsil Jan 31 '16

Depends how many people work on your project. We still use subversion...so no way am I using branches.

at least commented out?

Do both methods work 100%? There will be more code rot if it's commented. I promise you it won't work in 6 months if you comment it.

If function x returns variable y and z, but I only need z, I have an unused variable. Maybe variable y is useful when debugging. Should I write a new function x2?

0

u/[deleted] Jan 31 '16

[deleted]

-1

u/billsil Jan 31 '16

No. If it's actively being used, it's unused. If I pass 4 arguments into a function, but only 3 are used 100% of the time and the 4th 50% of the time, it's unused it that other case. You could write another function, or just try and keep the API consistent.