PDA

View Full Version : Coding style opinion wanted



Zerothis
03-31-2017, 06:44 PM
This question is for developers only please. Please consider this only within the context of the BASIC language and not programming languages in general.

How would you rate the coding style of "Craps" from the classic 101 BASIC Computer Games (follow link below)?

http://www.atariarchives.org/basicgames/showpage.php?page=52

jb143
04-01-2017, 12:41 PM
Reminds me of pretty much every BASIC program entered from a magazine from back in the day. I'm pretty sure that "coding style" wasn't really a term back then.

ccovell
04-01-2017, 08:04 PM
The style is...Okay?

I think it was written in a way to teach beginners the structure of the program as they were thinking through the logic of the game. For example, variables are declared just before they are needed, rather than all at the start in an initialization subroutine.

There are a lot of comparisons in a row. I guess it's because different versions of BASIC didn't have the "ON x GOTO" shortcut, so they're trying to maintain compatibility.

The branches at the end are a little clumsy; the writer only needed to do 2 tests & jumps, allowing the final default condition to fall down. Instead, he did 3 tests and 3 jumps.