For bigger projects, all your code shouldn't be in the same file.
Instead you can segment or split bigger codes into separate file, mostly based on functionality. Like bricks forming a wall.
Hope this helped. Since this is a theoretical question, posting no codes.