News for hackers. Stuff that matters.
Re:Should you split that file? by jbenoit on Friday December 01, 2023 @02:22PM (#38490997)
> You put it into a getters file and import it into the parent class. Almost every language has features for this

Wait, what?

So you can do this in C/C++ for sure. #include is not just for imports. But Java? C#? How!

Re:Should you split that file? by tgittos on Friday December 01, 2023 @04:28PM (#38492692)
C# at least supports the notion of partial classes that can have their definition spread over multiple files: https://learn.microsoft.com/en-us/dotnet/csharp/programming-...

Ruby has mixins and Python supports multiple inheritance. Go encourages composition over deep nested hierarchies.

Many main stream languages support this kind of functionality.

Re:Should you split that file? by jaggederest on Friday December 01, 2023 @02:26PM (#38491045)
Superclasses, interfaces, or module import. I'm no Java or C# expert but you have to lean into the conventions the language provides. I would probably have a separate small POJO that stores the configuration for the class if it had so many getters/setters I wanted to split them out.