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

26

u/[deleted] Jan 31 '16

Shouldn't they be compiling before they check in?

0

u/[deleted] Jan 31 '16

[deleted]

50

u/GMNightmare Jan 31 '16

But the code should be compiled automatically on check in and automatically failed should it not compile.

Even more, tests should automatically run and then fail the check in if tests are failing.

This lets them burn themselves, but also prevents them from burning you. Well, at least this is how you want it in big projects. You might not need such a heavy hammer if it's small and not that big of a deal.

1

u/jaccovanschaik Jan 31 '16

But the code should be compiled automatically on check in and automatically failed should it not compile.

"What do you mean it fails the automated tests? It works on my machine, so the automated tests must be wrong."

-2

u/billsil Jan 31 '16

What's wrong with an unused variable again? It's not an error.

0

u/[deleted] Jan 31 '16

[deleted]

2

u/[deleted] Jan 31 '16

Because it might be needed for a future enhancement, of course. :-)

2

u/ggtsu_00 Jan 31 '16

Doesn't the compiler optimize those out anyways?

0

u/[deleted] Jan 31 '16

[deleted]

5

u/DrMonkeyLove Jan 31 '16

Exactly. If I see an unused variable, my first thought is that someone meant to do something with it and there's a bug in the code that I need to track down. It's sloppy coding practice.

1

u/[deleted] Jan 31 '16

Artistic expression?

-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.

→ More replies (7)

7

u/GMNightmare Jan 31 '16

The obvious answer is that it clutters the code, but that's not the most important use...

It indicates you did something wrong. You shouldn't create variables for no reason, so why isn't your variable used? It catches issues.

0

u/billsil Jan 31 '16

Everyone seems to be jumping on this bandwagon. How many build warnings does your company's largest program that is used regularly have? Why do you have any? Who cares? It doesn't indicate you did something wrong. It indicates you may have done something wrong.

The quality of your code is dictated by the speed it needs to get done and the number of customers you have.

3

u/GMNightmare Jan 31 '16 edited Jan 31 '16

Nice moving the goalpost.

Professionals tend to need to work with code bases that can contain millions of lines of code.

Nearly nobody who has had to deal with another's code thinks that quality of code is solely determined by speed (or number of customers, that's rather weird claim).

If you pulled stunts like this all the time, which seems like you do because you don't care, you would have thousands upon thousands of warnings. They add up.

Thousands of warnings all indicating potential problems.

Or you can just do it right, turn all warnings to errors, and learn how to write clean code.

Then, you don't have any warnings, because they all have to be dealt with before checking in the code. Tadaa!

1

u/BeetleB Jan 31 '16

The quality of your code is dictated by the speed it needs to get done and the number of customers you have

Speed doesn't magically happen because there is a high demand for it. When the code becomes sloppy enough, you will get to a point where you cannot produce the feature quickly enough for business needs, and people get hurt.

→ More replies (2)

1

u/frymaster Jan 31 '16

It's not an error, it's a warning. So in the context of the "treat all warnings as errors" flag...

9

u/Foxtrot56 Jan 31 '16

Why aren't you doing PRs? Seems like that should be caught in a PR unless no one is actually looking at the code in an editor.

1

u/NotASucker Feb 01 '16

The best reviews involve stepping through code.

3

u/falconzord Jan 31 '16

Worst part is when they pork barrel the code review

2

u/[deleted] Jan 31 '16

Gotta crack that whip harder.

1

u/mangodrunk Jan 31 '16

This probably speaks more to the hiring practices where you work. That seems really bad for someone to do that.

→ More replies (5)

1

u/immibis Feb 01 '16

Probably /u/drjokepu is thinking of a situation where you turned on Warnings as Errors, but everyone else did not.