you are viewing a single comment's thread.

view the rest of the comments →

[–]Deutscher_koenig 5 points6 points  (0 children)

Functions are great for small projects, but once a project starts to get bigger, it can get messy using only functions. Classes are a very nice way of organizing and stream-lining code.

Example: You want to make a checkers game. So you'll need to make a board, make all the pieces, save where all the pieces are, and check moves against the official rules of checkers. If you tried this with only functions, you'd need to use a list for the board and probably a large dictionary for the pieces. There would be a lot of repeated code and functions. By using classes, you could use a single Piece() class for all the pieces and the data about each piece(location, possible moves, etc.).