Each logical component of your program should be divided into its own method. Methods that are related to each other and to particular data should be combined encapsulated into a class. Your selection of classes and methods will determine your score for modularity. In this class clarity is more important than minimizing the amount of code. See elegance for further discussion.
Clarity also includes appropriate selection of variable and function names.
The names you choose for your variables and functions should be as descriptive as possible without being too long. An elegant solution uses the proper programming construct for the problem and uses it in an efficient manner. Therefore, elegance also embodies efficiency. Inefficient code is not elegant. Using a for loop with index running from 1 to 10 then inside the loop subtracting 1 from the index each time it is used is not elegant.