STFinancial / Minecraft

0 stars 0 forks source link

STF Minecraft Plugin Conventions #18

Open Boxxy opened 10 years ago

Boxxy commented 10 years ago

Class Layout, variable names, method order and other conventions will need to be finalized for STF minecraft projects for readability and collaboration.

qsik commented 10 years ago

Classes should have a defined single function Classes need to have dependencies and structure added to minimize referencing and allow for flexibility Variables should be named such that one always understands what it represents (e.g. always use UUID id or Player player) Method order not too terribly important Spaces are important: "if (test = test2) { } else { }"

STFinancial commented 10 years ago

I like to have functions listed in alphabetical order, or at least listed according to relevance. I can go in an attempt to refactor some of it.

STFinancial commented 10 years ago

Generally if you want to have clean and loosely coupled code, you need to define what you want each class to do before you make it. If you say "hey we want this feature, where should we put it?" over and over, things are bound to get messy. Every class should have a clearly designed role and purpose. For example, "dataManager" is not really all that clear of a title. There's some other stuff like that.

STFinancial commented 10 years ago

Like it's not clear from the naming whether "QueueManager" or "MatchManager" would take care of assigning which arena a person is given. I don't even know if these classes should be separate in the first place. I honestly don't even think FileManager should exist. I think there needs to be some methods in one of the classes (probably main) that spit back and take in what you need. Right now, we ignore (and have very few) abstraction barriers so it makes things interdependent and harder to debug.

Boxxy commented 10 years ago

Queue since a player is given an arena on queue. I would imagine atleast, matchManager would contain a list of games in progress while queue manager would focus on players trying to find a match. I agree file manager is meh but think any class that loads from file should just do it in their constructor. The problem with abstraction barriers is there is not much to abstract the program is much more procedural* than object oriented.

On Tue, Aug 5, 2014 at 2:16 PM, STFinancial notifications@github.com wrote:

Like it's not clear from the naming whether "QueueManager" or "MatchManager" would take care of assigning which arena a person is given. I don't even know if these classes should be separate in the first place. I honestly don't even think FileManager should exist. I think there needs to be some methods in one of the classes (probably main) that spit back and take in what you need. Right now, we ignore (and have very few) abstraction barriers so it makes things interdependent and harder to debug.

— Reply to this email directly or view it on GitHub https://github.com/STFinancial/Minecraft/issues/18#issuecomment-51245542 .

qsik commented 10 years ago

I have begun working on cleaning up the classes. Check out stuff under the qsik package

STFinancial commented 10 years ago

I resynced the files and a ton of shit is broken. Are you sure you fixed it all? And can we not have two packages or an Arena class inside of both packages, it's ambiguous as hell.

Boxxy commented 10 years ago

Probably should fork for future

On Wed, Aug 6, 2014 at 4:53 PM, STFinancial notifications@github.com wrote:

I resynced the files and a ton of shit is broken. Are you sure you fixed it all? And can we not have two packages or an Arena class inside of both packages, it's ambiguous as hell.

— Reply to this email directly or view it on GitHub https://github.com/STFinancial/Minecraft/issues/18#issuecomment-51402877 .

qsik commented 10 years ago

Apologies. Was at work, moving over to my own branch now

STFinancial commented 10 years ago

Well I just don't really know what you're doing with it. If it's just code you're working on and are going to migrate over later, that's fine.

qsik commented 10 years ago

it's out. you can repull

Boxxy commented 10 years ago

How I see it should be/is Offline Data: Maps, Teams, History, Player backup Online Only Data: ArenaPlayer, Queue, Match

ArenaPlayer is a class that tracks the status of an online player related to the arena plugin and can save in game state (save items before arena starts) Maps are just coordinates/door material Teams are just UUIDs of players with ratings History is just table of damage done and who won Queue is a runnable that contains teams (added from commands) and exports them to a Match A Match is two teams and a map