-
Notifications
You must be signed in to change notification settings - Fork 0
Description
What's going on?
The Password
class is beginning to stink of bad design and thinly stretched code. The additions made during initial development went very quickly. And I think this may be the reason. Originally, Password
worked just fine for our use. As we add more features, the original base is stretched thin and tries doing too much at once.
What do we want?
Redesign the Password
class. There are definite spots for some good refactoring that I have noticed over the past few days considering this issue. The most likely candidate, I feel is going to be a strategy pattern for password generation. This would allow us to instantiate a Password
object, while specifying a PasswordStrategy
for it to use. The strategy would provide the implementation specific to generating that type of password.
Why is it necessary?
As pywrdgen
continues to grow, development and maintenance of the codebase is becoming more difficult. Things are in places they don't entirely make sense. There are hacky bits in some places. Features I can't implement without worsening the problem. The list goes on..
What else would this change?
This will create new source files, and classes. The implementation will also effect the way we interact with Password
objects from outside of the module. Files such as __main__.py
will need to be updated to match. Mostly, this means selecting the proper PasswordProvider
for now.
Anything else?
Should data files be loaded inside the Password.generate
method? That is the method implemented by the PasswordStrategy
so I'm not sure if it should be doing things like overriding __init__
to load a data file. It's probably perfectly fine for generate
to load it's own data file. Or delegate that to a helper function.