typischmann / retail-crm

2 stars 1 forks source link

Jackson Converter should not be used as static method. Refator it! #40

Closed typischmann closed 9 years ago

typischmann commented 9 years ago

Pro & Cons of static method

Advantages

Can do meta object operations ( like validating something before creating objects , keep count of number of objects )

Can do operations which have nothing to do with objects but still you want them to be tied to Class.

Disadvantages

Commonly used to static variables sometime leads to problems due to access by different objects.

Are not tied to objects so doesn't reflect pure Object Oriented approach.

Needs to be synchronized so as to avoid update conflicts by mutiple objects and threads.

It would be hard in Mock Test

tczhaodachuan commented 9 years ago

Mock test shouldn't test static method. But for synchronize issue, why toJson method needs it, it doesn't need to change shared objects.

typischmann commented 9 years ago

Okay!