Making a huge class readable?

by Mister R.U.B.I   Last Updated April 15, 2019 21:05 PM

For example, generation. Think of Minecraft; it generates the terrain, the trees, the dungeons, and so on. Now pretend it's 2D.

All the generation works with just one data; a tilemap. The generation class has high cohesion, all it's steps (trees, dungeons) uses common methods, but, still, it's a huge ass class, and navigating through it takes ages. How to make it more readable? If you separate each step into a class, how would that work? Would you use it like a method?

void GenerateAll() {
   TileMap tm = new TileMap(20, 20);
   tm = new TerrainStep(tilemap).ToTileMap();
   tm = new TreeStep(tilemap).ToTileMap();

While this is a certainly better read, that's not the purpose of a class. But doing it like this we lose access to previously common methods, there'll be duplication. You could also make these steps static classes. However, you would always lose the ability to use methods already written by other steps, and I see no alternative. Any ideas?

Related Questions

Updated July 18, 2015 13:02 PM

Updated May 11, 2018 20:05 PM

Updated November 23, 2017 17:05 PM

Updated March 19, 2017 07:05 AM

Updated June 29, 2017 06:05 AM