I code plugins for the popular Bukkit API for Minecraft.
Basically, at this point, my coding is just one class with a ton of methods and public variables. How can I neatly organize this code into classes?
In coding terms, how would I go about doing this? Would I import each class?
I noticed when accessing variables from another class, I have to do: ClassName.variable every time, and that’s a bit of a drag. Is there a way around this?
I’m no fan of Java, but this problem isn’t about being a Java n00b. It’s about being new to object-oriented design (you’d run into this problem with large programs in any language if you organize them well).
You’ll generally want to follow the “Single Responsibility Principle”. In a nutshell, it means that your classes should probably be smaller than they are now, and that each of them should be in charge of handling a small enough task that it’s easy to tell whether it’s correct. This is easier said than done, but that’s why programming is hard: organizing your ideas is hard.