Refactoring plans

Daniel Kreuter daniel.kreuter85 at gmail.com
Thu Jun 20 07:21:12 UTC 2013


Hi,

since we now only have JSON Support in the twitter API I would like to
rework the naming of some methods (we don't need to keep Choqok
compatible with previous versions, since old versions don't work
anymore).

When we had XML support, we had method names like readPostFromXML and
readPostFromJson. I find this is poor design so I want to change this.

There would be 2 ways.
First one:
Since we now only have JSON, a simple renaming from readPostFromJson
to readPost (as wel for the other methods) would do it.

Second way:
Introduce an abstract class or an interface which defines the methods
and implement it with the appropriate type (f.e. one for json, one for
xml and so on).
This way we can construct the appropriate type based on the format
used, and have one interface which rules them all.

The benefit of both ways would be, that the code is more maintainable.
No need to check for the format do call the correct version.

What's your opinion?

Cheers,

Daniel


More information about the Choqok-devel mailing list