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

obfuscate should be a regular function #24

Open
timoxley opened this issue Sep 24, 2012 · 0 comments
Open

obfuscate should be a regular function #24

timoxley opened this issue Sep 24, 2012 · 0 comments

Comments

@timoxley
Copy link

The way obfuscate is used with setters/getters is rather unusual. It should probably just be a obfuscate static+instance method and a deobfuscate static method.

i.e. instead of:

// obfuscate
var foo = new FooModel(data)
var obfuscated = foo.obfuscate

// deobfuscate
var emptyFoo = new FooModel()
emptyFoo.deobfuscate = obfuscated

More like:

// obfuscate
var foo = new FooModel(data)
var obfuscated = foo.obfuscate() // OR
obfuscated = FooModel.obfuscate(foo.obfuscate) 

// deobfuscate
FooModel.deobfuscate(obfuscated)

IMO, using getters/setters like this doesn't adequately communicate the intent of the code, the telltale sign being that obfuscate and deobfuscate are verbs, thus should probably be functions, rather than properties.

Also, this gets rid of the need for a dummy object during deobfuscation i.e. emptyFoo.

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