Each logical component of your program should be divided into its own function. Functions that are related to particular data should be combined with that data into a class. Your selection of classes and functions 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 an if clause and an else clause when possible is more elegant than using two separate if statements.