Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use proper methods for getting and setting variables #59

Open
NanoSector opened this issue Jan 5, 2015 · 0 comments
Open

Use proper methods for getting and setting variables #59

NanoSector opened this issue Jan 5, 2015 · 0 comments

Comments

@NanoSector
Copy link
Contributor

Right now we're getting things like $this->arguments without using proper methods like getArguments.

This is, AFAIK, violating the OOP structure and makes it more difficult to fix bugs.

Consider the following (not a real situation):
A security flaw is found in the way commands handle arguments. This is because arguments are passed without any verification.

Without proper methods: fix every command one by one and hope third party commands will follow sooner or later.
With proper methods: modify getArguments and fix all included and third party commands in one go.

It may seem like a lot of work and at first it is, but I think in the end it will pay off with easier maintenance of the codebase.
Things like $this->bot don't really need this, but couldn't really hurt either.

Interesting read: http://php.net/manual/en/language.oop5.overloading.php
Though I'd personally prefer having a method for each variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant